annotate Chronosv2/source/Presentation/Widgets/Clock/ClockWidgetViewModel.cs @ 21:dfc81f8bb838

working version for sttocks except ui within metrowpf
author adminsh@apollo
date Tue, 20 Mar 2012 15:07:31 +0000
parents 443821e55f06
children
rev   line source
10
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
1 using System;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
2 using System.Windows;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
3 using System.Windows.Media;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
4 using System.Windows.Threading;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
5 using Chronos.Presentation.ViewModel;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
6
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
7 namespace Chronos.Presentation.Widgets
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
8 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
9 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
10 /// Based on http://moonydesk.codeplex.com/
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
11 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
12 public sealed class ClockWidgetViewModel
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
13 : WidgetViewModel
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
14 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
15 #region · Fields ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
16
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
17 private Point degreeStartPoint;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
18 private Point degreeCurrentPoint;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
19 private bool isLargeArc;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
20 private int dayOfYear;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
21 private int year;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
22 private string seconds;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
23 private string minutes;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
24 private string hours;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
25 private string pmAm;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
26 private bool hours24;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
27 private string date;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
28 private string dayOfWeek;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
29 private int angle;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
30
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
31 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
32
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
33 #region · Properties ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
34
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
35 public Point DegreeStartPoint
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
36 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
37 get { return this.degreeStartPoint; }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
38 set
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
39 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
40 if (this.degreeStartPoint != value)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
41 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
42 this.degreeStartPoint = value;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
43
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
44 this.NotifyPropertyChanged(() => DegreeStartPoint);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
45 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
46 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
47 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
48
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
49 public Point DegreeCurrentPoint
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
50 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
51 get { return this.degreeCurrentPoint; }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
52 set
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
53 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
54 if (this.degreeCurrentPoint != value)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
55 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
56 this.degreeCurrentPoint = value;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
57
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
58 this.NotifyPropertyChanged(() => DegreeCurrentPoint);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
59 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
60 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
61 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
62
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
63 public bool IsLargeArc
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
64 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
65 get { return this.isLargeArc; }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
66 set
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
67 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
68 if (this.isLargeArc != value)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
69 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
70 this.isLargeArc = value;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
71
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
72 this.NotifyPropertyChanged(() => IsLargeArc);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
73 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
74 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
75 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
76
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
77 public string Seconds
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
78 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
79 get { return this.seconds; }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
80 set
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
81 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
82 if (this.seconds != value)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
83 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
84 this.seconds = value;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
85
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
86 this.NotifyPropertyChanged(() => Seconds);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
87 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
88 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
89 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
90
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
91 public string Minutes
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
92 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
93 get { return this.minutes; }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
94 set
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
95 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
96 if (this.minutes != value)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
97 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
98 this.minutes = value;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
99
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
100 this.NotifyPropertyChanged(() => Minutes);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
101 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
102 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
103 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
104
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
105 public string Hours
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
106 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
107 get { return this.hours; }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
108 set
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
109 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
110 if (this.hours != value)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
111 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
112 this.hours = value;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
113
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
114 this.NotifyPropertyChanged(() => Hours);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
115 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
116 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
117 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
118
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
119 public string PmAm
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
120 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
121 get { return this.pmAm; }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
122 set
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
123 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
124 if (this.pmAm != value)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
125 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
126 this.pmAm = value;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
127
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
128 this.NotifyPropertyChanged(() => PmAm);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
129 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
130 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
131 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
132
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
133 public bool Hours24
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
134 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
135 get { return this.hours24; }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
136 set
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
137 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
138 if (this.hours24 != value)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
139 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
140 this.hours24 = value;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
141
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
142 this.NotifyPropertyChanged(() => Hours24);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
143 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
144 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
145 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
146
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
147 public string Date
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
148 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
149 get { return this.date; }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
150 set
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
151 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
152 if (this.date != value)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
153 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
154 this.date = value;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
155
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
156 this.NotifyPropertyChanged(() => Date);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
157 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
158 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
159 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
160
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
161 public string DayOfWeek
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
162 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
163 get { return this.dayOfWeek; }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
164 set
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
165 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
166 if (this.dayOfWeek != value)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
167 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
168 this.dayOfWeek = value;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
169
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
170 this.NotifyPropertyChanged(() => DayOfWeek);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
171 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
172 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
173 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
174
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
175 public int Angle
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
176 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
177 get { return this.angle; }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
178 set
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
179 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
180 if (this.angle != value)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
181 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
182 this.angle = value;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
183
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
184 this.NotifyPropertyChanged(() => Angle);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
185 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
186 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
187 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
188
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
189 public int DayOfYear
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
190 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
191 get { return this.dayOfYear; }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
192 set
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
193 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
194 if (this.dayOfYear != value)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
195 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
196 this.dayOfYear = value;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
197
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
198 this.NotifyPropertyChanged(() => DayOfYear);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
199 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
200 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
201 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
202
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
203 public int Year
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
204 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
205 get { return this.year; }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
206 set
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
207 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
208 if (this.year != value)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
209 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
210 this.year = value;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
211
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
212 this.NotifyPropertyChanged(() => DayOfYear);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
213 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
214 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
215 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
216
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
217 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
218
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
219 #region · Constructors ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
220
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
221 public ClockWidgetViewModel()
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
222 : base()
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
223 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
224 this.DayOfYear = -1;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
225 this.Year = -1;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
226 this.Angle = -4;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
227 this.Hours24 = Properties.Settings.Default.hours24;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
228 this.DegreeStartPoint = new Point(110, 10);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
229 this.DegreeCurrentPoint = new Point(110, 210);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
230 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
231
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
232 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
233
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
234 #region · Methods ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
235
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
236 public void Start()
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
237 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
238 DispatcherTimer timer = new DispatcherTimer();
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
239
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
240 timer.Interval = TimeSpan.FromSeconds(0.1);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
241 timer.Tick += new EventHandler(OnTimerTick);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
242 timer.Start();
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
243
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
244 this.SetCurTime();
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
245 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
246
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
247 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
248
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
249 #region · Private Methods ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
250
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
251 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
252 /// Set current time
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
253 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
254 private void SetCurTime()
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
255 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
256 DateTime now = DateTime.Now;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
257
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
258 this.SetDeg((now.Second + now.Millisecond / 1000.0) * 6);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
259 this.Seconds = now.Second.ToString("00");
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
260 this.Minutes = now.Minute.ToString("00");
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
261
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
262 if (this.Hours24)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
263 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
264 this.Hours = now.Hour.ToString("00");
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
265 this.PmAm = String.Empty;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
266 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
267 else
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
268 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
269 this.Hours = now.ToString("hh");
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
270 this.PmAm = now.ToString("tt");
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
271 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
272
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
273 if (now.DayOfYear != this.DayOfYear || now.Year != this.Year)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
274 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
275 this.Date = now.ToString("d MMMM yyyy");
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
276 this.DayOfWeek = now.ToString("dddd");
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
277 this.DayOfYear = now.DayOfYear;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
278 this.Year = now.Year;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
279 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
280 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
281
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
282 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
283 /// Set seconds arc degree
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
284 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
285 /// <param name="degree"></param>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
286 private void SetDeg(double degree)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
287 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
288 double offset = this.DegreeStartPoint.X;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
289 double x = Math.Cos((degree - 90) * Math.PI / 180) * 100.0 + offset;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
290 double y = Math.Sin((degree - 90) * Math.PI / 180) * 100.0 + offset;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
291
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
292 this.DegreeCurrentPoint = new Point(x, y);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
293 this.IsLargeArc = (degree > 180);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
294 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
295
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
296 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
297
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
298 #region · Event Handlers ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
299
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
300 private void OnTimerTick(object sender, EventArgs e)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
301 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
302 this.SetCurTime();
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
303 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
304
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
305 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
306 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
307 }