/[cits3200i]/branches/metadata-branch-rvvs89/UWAPlugins/MetadataPlugin/Source/MetadataRouteControlLayer.cs


UCC Code Repository

Contents of /branches/metadata-branch-rvvs89/UWAPlugins/MetadataPlugin/Source/MetadataRouteControlLayer.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 90 - (show annotations) (download)
Tue Oct 12 21:18:41 2010 UTC (11 years, 1 month ago) by rvvs89
File size: 2214 byte(s)
Attaching metadata now works.
Saving metadata now works.
Loading metadata now works.
Editing metadata and cancelling your changes now works.
MetadataList now only commits on change.
Icons appear on the track when metadata is added.
Icons can be double clicked to launch the editor.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using ZoneFiveSoftware.Common.Visuals.Mapping;
5 using ZoneFiveSoftware.Common.Data.Fitness;
6 using ZoneFiveSoftware.Common.Visuals.Util;
7
8 namespace MetadataPlugin.Source
9 {
10 class MetadataRouteControlLayer : IRouteControlLayer
11 {
12 private static IList<MetadataRouteControlLayer> instances = new List<MetadataRouteControlLayer>(3);
13 private IRouteControl control;
14 private MetadataRouteControlLayerProvider provider;
15 private IActivity currentActivity;
16 private MetadataList currentList;
17
18 public MetadataRouteControlLayer(MetadataRouteControlLayerProvider provider, IRouteControl control)
19 {
20 this.provider = provider;
21 this.control = control;
22 instances.Add(this);
23 control.ItemsChanged += new EventHandler(control_ItemsChanged);
24 control.MapControlChanged += new EventHandler(control_MapControlChanged);
25 }
26
27 private void control_MapControlChanged(object sender, EventArgs e)
28 {
29 }
30
31 private void control_ItemsChanged(object sender, EventArgs e)
32 {
33 if (instances[0] == this)
34 {
35 IActivity selected = CollectionUtils.GetSingleItemOfType<IActivity>(MetadataActivityReportPages.View.SelectionProvider.SelectedItems);
36 if (selected != null && selected != currentActivity)
37 {
38 currentActivity = selected;
39 currentList = MetadataList.LoadFromActivity(currentActivity);
40 }
41 }
42 }
43
44 public static IList<MetadataRouteControlLayer> Instances
45 {
46 get { return instances; }
47 }
48
49 public MetadataList CurrentList
50 {
51 get { return currentList; }
52 }
53
54 public IRouteControl Control
55 {
56 get { return control; }
57 }
58
59 public IRouteControlLayerProvider Provider
60 {
61 get { return provider; }
62 }
63
64 public int ZOrder
65 {
66 get { return 0; }
67 }
68 }
69 }

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26