HamBook – Diff between revs 21 and 54

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 21 Rev 54
Line 1... Line -...
1 using Configuration.Annotations; -  
2 using System.Collections.ObjectModel; -  
3 using System.ComponentModel; 1 using System.ComponentModel;
4 using System.Runtime.CompilerServices; 2 using System.Runtime.CompilerServices;
5 using System.Threading; -  
6 using System.Xml.Serialization; 3 using System.Xml.Serialization;
-   4 using Configuration.Annotations;
-   5 using RJCP.IO.Ports;
Line 7... Line 6...
7   6  
8 namespace Configuration 7 namespace Configuration
9 { 8 {
10 [XmlRoot(Namespace = "urn:hambook-configuration-schema", ElementName = "Configuration")] 9 [XmlRoot(Namespace = "urn:hambook-configuration-schema", ElementName = "Configuration")]
11 public class Configuration : INotifyPropertyChanged 10 public class Configuration : INotifyPropertyChanged
12 { -  
13 private bool _launchOnBoot = false; 11 {
14 private string _radio = "Yaesu FT-891"; -  
15 private string _port = "COM1"; -  
16 private int _speed = 38400; 12 private Audio _audio = new Audio();
17 private int _dataBits = 8; -  
18 private RJCP.IO.Ports.Parity _parity = RJCP.IO.Ports.Parity.None; -  
19 private RJCP.IO.Ports.StopBits _stopBits = RJCP.IO.Ports.StopBits.One; 13 private int _dataBits = 8;
20 private Definitions _definitions = new Definitions(); 14 private Definitions _definitions = new Definitions();
21 private RJCP.IO.Ports.Handshake _handshake = RJCP.IO.Ports.Handshake.None; 15 private Handshake _handshake = Handshake.None;
22 private SerialPortTimeout _serialPortTimeout = new SerialPortTimeout(); 16 private bool _launchOnBoot;
23 private Audio _audio = new Audio(); 17 private Navigation _navigation = new Navigation();
-   18 private Notifications _notifications = new Notifications();
-   19 private Parity _parity = Parity.None;
-   20 private string _port = "COM1";
-   21 private string _radio = "Yaesu FT-891";
-   22 private SerialPortTimeout _serialPortTimeout = new SerialPortTimeout();
-   23 private int _speed = 38400;
24 private Notifications _notifications = new Notifications(); 24 private StopBits _stopBits = StopBits.One;
25 private Visualisations _visualisations = new Visualisations(); -  
Line 26... Line 25...
26 private Navigation _navigation = new Navigation(); 25 private Visualisations _visualisations = new Visualisations();
27   26  
28 public bool LaunchOnBoot 27 public bool LaunchOnBoot
29 { 28 {
30 get => _launchOnBoot; 29 get => _launchOnBoot;
31 set 30 set
32 { -  
33 if (value == _launchOnBoot) -  
34 { -  
Line 35... Line 31...
35 return; 31 {
36 } 32 if (value == _launchOnBoot) return;
37   33  
38 _launchOnBoot = value; 34 _launchOnBoot = value;
Line 43... Line 39...
43 public string Radio 39 public string Radio
44 { 40 {
45 get => _radio; 41 get => _radio;
46 set 42 set
47 { 43 {
48 if (value == _radio) 44 if (value == _radio) return;
49 { -  
50 return; -  
51 } -  
Line 52... Line 45...
52   45  
53 _radio = value; 46 _radio = value;
54 OnPropertyChanged(); 47 OnPropertyChanged();
55 } 48 }
Line 58... Line 51...
58 public string Port 51 public string Port
59 { 52 {
60 get => _port; 53 get => _port;
61 set 54 set
62 { 55 {
63 if (value == _port) 56 if (value == _port) return;
64 { -  
65 return; -  
66 } -  
Line 67... Line 57...
67   57  
68 _port = value; 58 _port = value;
69 OnPropertyChanged(); 59 OnPropertyChanged();
70 } 60 }
Line 73... Line 63...
73 public int Speed 63 public int Speed
74 { 64 {
75 get => _speed; 65 get => _speed;
76 set 66 set
77 { 67 {
78 if (value == _speed) 68 if (value == _speed) return;
79 { -  
80 return; -  
81 } -  
Line 82... Line 69...
82   69  
83 _speed = value; 70 _speed = value;
84 OnPropertyChanged(); 71 OnPropertyChanged();
85 } 72 }
-   73 }
86 } 74  
87 public int DataBits 75 public int DataBits
88 { 76 {
89 get => _dataBits; 77 get => _dataBits;
90 set 78 set
91 { 79 {
92 if (value == _dataBits) -  
93 { -  
94 return; -  
Line 95... Line 80...
95 } 80 if (value == _dataBits) return;
96   81  
97 _dataBits = value; 82 _dataBits = value;
98 OnPropertyChanged(); 83 OnPropertyChanged();
Line 99... Line 84...
99 } 84 }
100 } 85 }
101   86  
102 public RJCP.IO.Ports.Parity Parity 87 public Parity Parity
103 { 88 {
104 get => _parity; 89 get => _parity;
105 set -  
106 { -  
107 if (value == _parity) -  
Line 108... Line 90...
108 { 90 set
109 return; 91 {
110 } 92 if (value == _parity) return;
111   93  
Line 112... Line 94...
112 _parity = value; 94 _parity = value;
113 OnPropertyChanged(); 95 OnPropertyChanged();
114 } 96 }
115 } 97 }
116   98  
117 public RJCP.IO.Ports.StopBits StopBits 99 public StopBits StopBits
118 { -  
119 get => _stopBits; -  
120 set -  
Line 121... Line 100...
121 { 100 {
122 if (value == _stopBits) 101 get => _stopBits;
123 { 102 set
124 return; 103 {
Line 125... Line 104...
125 } 104 if (value == _stopBits) return;
126   105  
127 _stopBits = value; 106 _stopBits = value;
128 OnPropertyChanged(); 107 OnPropertyChanged();
129 } 108 }
130 } 109 }
131   -  
132 public RJCP.IO.Ports.Handshake Handshake -  
133 { -  
Line 134... Line 110...
134 get => _handshake; 110  
135 set 111 public Handshake Handshake
136 { 112 {
137 if (value == _handshake) 113 get => _handshake;
Line 147... Line 123...
147 public SerialPortTimeout SerialPortTimeout 123 public SerialPortTimeout SerialPortTimeout
148 { 124 {
149 get => _serialPortTimeout; 125 get => _serialPortTimeout;
150 set 126 set
151 { 127 {
152 if (value == _serialPortTimeout) 128 if (value == _serialPortTimeout) return;
153 { -  
154 return; -  
155 } -  
Line 156... Line 129...
156   129  
157 _serialPortTimeout = value; 130 _serialPortTimeout = value;
158 OnPropertyChanged(); 131 OnPropertyChanged();
159 } 132 }
Line 162... Line 135...
162 public Definitions Definitions 135 public Definitions Definitions
163 { 136 {
164 get => _definitions; 137 get => _definitions;
165 set 138 set
166 { 139 {
167 if (value == _definitions) 140 if (value == _definitions) return;
168 { -  
169 return; -  
170 } -  
Line 171... Line 141...
171   141  
172 _definitions = value; 142 _definitions = value;
173 OnPropertyChanged(); 143 OnPropertyChanged();
174 } 144 }
Line 177... Line 147...
177 public Audio Audio 147 public Audio Audio
178 { 148 {
179 get => _audio; 149 get => _audio;
180 set 150 set
181 { 151 {
182 if (value == _audio) 152 if (value == _audio) return;
183 { -  
184 return; -  
185 } -  
Line 186... Line 153...
186   153  
187 _audio = value; 154 _audio = value;
188 OnPropertyChanged(); 155 OnPropertyChanged();
189 } 156 }
Line 192... Line 159...
192 public Notifications Notifications 159 public Notifications Notifications
193 { 160 {
194 get => _notifications; 161 get => _notifications;
195 set 162 set
196 { 163 {
197 if (value == _notifications) 164 if (value == _notifications) return;
198 { -  
199 return; -  
200 } -  
Line 201... Line 165...
201   165  
202 _notifications = value; 166 _notifications = value;
203 OnPropertyChanged(); 167 OnPropertyChanged();
204 } 168 }
-   169 }
205 } 170  
206 public Visualisations Visualisations 171 public Visualisations Visualisations
207 { 172 {
208 get => _visualisations; 173 get => _visualisations;
209 set 174 set
210 { 175 {
211 if (value == _visualisations) -  
212 { -  
213 return; -  
Line 214... Line 176...
214 } 176 if (value == _visualisations) return;
215   177  
216 _visualisations = value; 178 _visualisations = value;
217 OnPropertyChanged(); 179 OnPropertyChanged();
Line 221... Line 183...
221 public Navigation Navigation 183 public Navigation Navigation
222 { 184 {
223 get => _navigation; 185 get => _navigation;
224 set 186 set
225 { 187 {
226 if (value == _navigation) 188 if (value == _navigation) return;
227 { -  
228 return; -  
229 } -  
Line 230... Line 189...
230   189  
231 _navigation = value; 190 _navigation = value;
232 OnPropertyChanged(); 191 OnPropertyChanged();
233 } 192 }
Line 234... Line -...
234 } -  
235   -  
236 public Configuration() -  
237 { -  
238 } 193 }
Line 239... Line 194...
239   194  
240 public event PropertyChangedEventHandler PropertyChanged; 195 public event PropertyChangedEventHandler PropertyChanged;
241   196  
242 [NotifyPropertyChangedInvocator] 197 [NotifyPropertyChangedInvocator]
243 protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) 198 protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
244 { 199 {
245 PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 200 PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
246 } 201 }