/[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 87 - (show annotations) (download)
Mon Oct 11 21:19:18 2010 UTC (11 years, 1 month ago) by rvvs89
File size: 2052 byte(s)
Serializing a MetadataList to route extension data is now working.
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 }
25
26 void control_ItemsChanged(object sender, EventArgs e)
27 {
28 if (instances[0] == this)
29 {
30 IActivity selected = CollectionUtils.GetSingleItemOfType<IActivity>(MetadataActivityReportPages.View.SelectionProvider.SelectedItems);
31 if (selected != null && selected != currentActivity)
32 {
33 if (currentList != null)
34 {
35 currentList.Commit();
36 }
37 currentActivity = selected;
38 currentList = MetadataList.LoadFromActivity(currentActivity);
39 }
40 }
41 }
42
43 public static IList<MetadataRouteControlLayer> Instances
44 {
45 get { return instances; }
46 }
47
48 public IRouteControl Control
49 {
50 get { return control; }
51 }
52
53 public IRouteControlLayerProvider Provider
54 {
55 get { return provider; }
56 }
57
58 public int ZOrder
59 {
60 get { return 0; }
61 }
62 }
63 }

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26