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


UCC Code Repository

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 86 by rvvs89, Mon Oct 11 06:42:56 2010 UTC revision 87 by rvvs89, Mon Oct 11 21:19:18 2010 UTC
# Line 2  Line 2 
2  using System.Collections.Generic;  using System.Collections.Generic;
3  using System.Text;  using System.Text;
4  using ZoneFiveSoftware.Common.Visuals.Mapping;  using ZoneFiveSoftware.Common.Visuals.Mapping;
5    using ZoneFiveSoftware.Common.Data.Fitness;
6    using ZoneFiveSoftware.Common.Visuals.Util;
7    
8  namespace MetadataPlugin.Source  namespace MetadataPlugin.Source
9  {  {
# Line 10  namespace MetadataPlugin.Source Line 12  namespace MetadataPlugin.Source
12          private static IList<MetadataRouteControlLayer> instances = new List<MetadataRouteControlLayer>(3);          private static IList<MetadataRouteControlLayer> instances = new List<MetadataRouteControlLayer>(3);
13          private IRouteControl control;          private IRouteControl control;
14          private MetadataRouteControlLayerProvider provider;          private MetadataRouteControlLayerProvider provider;
15            private IActivity currentActivity;
16            private MetadataList currentList;
17    
18          public MetadataRouteControlLayer(MetadataRouteControlLayerProvider provider, IRouteControl control)          public MetadataRouteControlLayer(MetadataRouteControlLayerProvider provider, IRouteControl control)
19          {          {
20              this.provider = provider;              this.provider = provider;
21              this.control = control;              this.control = control;
22              instances.Add(this);              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          public static IList<MetadataRouteControlLayer> Instances

Legend:
Removed from v.86  
changed lines
  Added in v.87

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26