/[cits3200i]/branches/gps-running-clean-r116/HighScorePlugin/Source/HighScoreActivityDetailPage.cs


UCC Code Repository

Contents of /branches/gps-running-clean-r116/HighScorePlugin/Source/HighScoreActivityDetailPage.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5 - (show annotations) (download)
Sun Sep 5 15:48:34 2010 UTC (11 years, 3 months ago) by rvvs89
File size: 5455 byte(s)
Branching a local copy of the HEAD revision of the gps-running project on Google Code.
We will probably have to use this project as a template for our own plugins if we want to support SportTracks 2.1.
1 /*
2 Copyright (C) 2007, 2008 Kristian Bisgaard Lassen
3 Copyright (C) 2010 Kristian Helkjaer Lassen
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 3 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 using System;
20 using System.Collections.Generic;
21 using System.Text;
22 using System.ComponentModel;
23
24 using ZoneFiveSoftware.Common.Visuals.Fitness;
25 using ZoneFiveSoftware.Common.Data.Fitness;
26 using ZoneFiveSoftware.Common.Visuals;
27 #if !ST_2_1
28 using ZoneFiveSoftware.Common.Data;
29 using ZoneFiveSoftware.Common.Visuals.Util;
30 #endif
31
32 namespace GpsRunningPlugin.Source
33 {
34 class HighScoreActivityDetailPage :
35 #if ST_2_1
36 IActivityDetailPage
37 #else
38 IDetailPage
39 #endif
40 {
41 #region IActivityDetailPage Members
42 #if !ST_2_1
43 public HighScoreActivityDetailPage(IDailyActivityView view)
44 {
45 this.view = view;
46 view.SelectionProvider.SelectedItemsChanged += new EventHandler(OnViewSelectedItemsChanged);
47 }
48
49 private void OnViewSelectedItemsChanged(object sender, EventArgs e)
50 {
51 activities = GpsRunningPlugin.Util.CollectionUtils.GetAllContainedItems<IActivity>(view.SelectionProvider);
52 if ((control != null))
53 {
54 control.Activities = activities;
55 }
56 }
57 public System.Guid Id { get { return new Guid("{0af379d0-5ebe-11df-a08a-0800200c9a66}"); } }
58
59 #else
60 public IActivity Activity
61 {
62 set
63 {
64 if (null == value) { activities = null; }
65 else { activities = new List<IActivity> { value }; }
66 if ((control != null))
67 {
68 control.Activities = activities;
69 }
70 }
71 }
72 #endif
73 public IList<string> MenuPath
74 {
75 get { return menuPath; }
76 set { menuPath = value; OnPropertyChanged("MenuPath"); }
77 }
78
79 public bool MenuEnabled
80 {
81 get { return menuEnabled; }
82 set { menuEnabled = value; OnPropertyChanged("MenuEnabled"); }
83 }
84
85 public bool MenuVisible
86 {
87 get { return menuVisible; }
88 set { menuVisible = value; OnPropertyChanged("MenuVisible"); }
89 }
90
91 public bool PageMaximized
92 {
93 get { return pageMaximized; }
94 set { pageMaximized = value; OnPropertyChanged("PageMaximized"); }
95 }
96 public void RefreshPage()
97 {
98 if (control != null)
99 {
100 control.Refresh();
101 }
102 }
103
104 #endregion
105
106 #region IDialogPage Members
107
108 public System.Windows.Forms.Control CreatePageControl()
109 {
110 if (control == null)
111 {
112 control = new HighScoreViewer(activities, false, false);
113 }
114 return control;
115 }
116
117 public bool HidePage()
118 {
119 if (control != null) { return control.HidePage(); }
120 return true;
121 }
122
123 public string PageName
124 {
125 get
126 {
127 return Title;
128 }
129 }
130
131 public void ShowPage(string bookmark)
132 {
133 if (control != null) { control.ShowPage(bookmark); }
134 }
135
136 public IPageStatus Status
137 {
138 get { return null; }
139 }
140
141 public void ThemeChanged(ITheme visualTheme)
142 {
143 // m_visualTheme = visualTheme;
144 if (control != null)
145 {
146 control.ThemeChanged(visualTheme);
147 }
148 }
149
150 public string Title
151 {
152 get { return Properties.Resources.ApplicationName; }
153 }
154
155 public void UICultureChanged(System.Globalization.CultureInfo culture)
156 {
157 if (control != null)
158 {
159 control.UICultureChanged(culture);
160 }
161 }
162
163 #endregion
164
165 #region INotifyPropertyChanged Members
166
167 #pragma warning disable 67
168 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
169
170 #endregion
171
172 #if !ST_2_1
173 private IDailyActivityView view = null;
174 #endif
175 private IList<IActivity> activities = new List<IActivity>();
176 private HighScoreViewer control = null;
177 private IList<string> menuPath = null;
178 private bool menuEnabled = true;
179 private bool menuVisible = true;
180 private bool pageMaximized = false;
181
182 private void OnPropertyChanged(string propertyName)
183 {
184 if (PropertyChanged != null)
185 {
186 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
187 }
188 }
189 }
190 }

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26