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


UCC Code Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 92 - (show annotations) (download)
Tue Oct 12 22:01:08 2010 UTC (11 years, 1 month ago) by rvvs89
File size: 2075 byte(s)
Added conditions to IActions to ensure that points/ranges are only addable when a point/range is selected.
Fixed metadata deletion not triggeting MetadataList commit.
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Drawing;
5 using System.Text;
6 using ZoneFiveSoftware.Common.Data.Fitness;
7 using ZoneFiveSoftware.Common.Visuals;
8 using ZoneFiveSoftware.Common.Visuals.Fitness;
9 using ZoneFiveSoftware.Common.Visuals.Util;
10
11 namespace MetadataPlugin.Source
12 {
13 class AddToPointAction : IAction
14 {
15 private IActivity activity;
16 private IDailyActivityView view;
17 private IList<string> menuPath = new List<string> { "Metadata" };
18 private DateTime start;
19 private DateTime end;
20
21 public AddToPointAction(IDailyActivityView view)
22 {
23 this.view = view;
24 }
25
26 public bool Enabled
27 {
28 get
29 {
30 Refresh();
31 return activity != null && start == end && start >= activity.StartTime;
32 }
33 }
34
35 public bool HasMenuArrow
36 {
37 get { return false; }
38 }
39
40 public Image Image
41 {
42 get { return null; }
43 }
44
45 public IList<string> MenuPath
46 {
47 get { return menuPath; }
48 }
49
50 public void Refresh()
51 {
52 activity = CollectionUtils.GetSingleItemOfType<IActivity>(view.SelectionProvider.SelectedItems);
53 MetadataRouteControlLayer.Instances[0].CalculateSelectedRegion(out start, out end);
54 }
55
56 public void Run(Rectangle rectButton)
57 {
58 AddMetadataDialog.Instance.Control.MetadataLocation = MetadataLocation.POINT;
59 AddMetadataDialog.Instance.Control.Point = start;
60 AddMetadataDialog.Instance.ShowDialog();
61 }
62
63 public string Title
64 {
65 get { return "Add To Point"; }
66 }
67
68 public bool Visible
69 {
70 get { return true; }
71 }
72
73 #pragma warning disable 67
74 public event PropertyChangedEventHandler PropertyChanged;
75 #pragma warning restore 67
76 }
77 }

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26