HamBook – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 using Configuration.Annotations;
2 using System.Collections.ObjectModel;
3 using System.ComponentModel;
4 using System.IO.Ports;
5 using System.Runtime.CompilerServices;
6 using System.Xml.Serialization;
7  
8 namespace Configuration
9 {
10 [XmlRoot(Namespace = "urn:hambook-configuration-schema", ElementName = "Configuration")]
11 public class Configuration : INotifyPropertyChanged
12 {
13 private bool _launchOnBoot = false;
14  
15 private string _radio = "Yaesu FT-891";
16 private string _port = "COM1";
17 private int _speed = 38400;
18 private int _dataBits = 8;
19 private Parity _parity = Parity.None;
20 private StopBits _stopBits = StopBits.One;
21  
22 public bool LaunchOnBoot
23 {
24 get => _launchOnBoot;
25 set
26 {
27 if (value == _launchOnBoot)
28 {
29 return;
30 }
31  
32 _launchOnBoot = value;
33 OnPropertyChanged();
34 }
35 }
36  
37 public string Radio
38 {
39 get => _radio;
40 set
41 {
42 if (value == _radio)
43 {
44 return;
45 }
46  
47 _radio = value;
48 OnPropertyChanged();
49 }
50 }
51  
52 public string Port
53 {
54 get => _port;
55 set
56 {
57 if (value == _port)
58 {
59 return;
60 }
61  
62 _port = value;
63 OnPropertyChanged();
64 }
65 }
66  
67 public int Speed
68 {
69 get => _speed;
70 set
71 {
72 if (value == _speed)
73 {
74 return;
75 }
76  
77 _speed = value;
78 OnPropertyChanged();
79 }
80 }
81  
82 public int DataBits
83 {
84 get => _dataBits;
85 set
86 {
87 if (value == _dataBits)
88 {
89 return;
90 }
91  
92 _dataBits = value;
93 OnPropertyChanged();
94 }
95 }
96  
97 public Parity Parity
98 {
99 get => _parity;
100 set
101 {
102 if (value == _parity)
103 {
104 return;
105 }
106  
107 _parity = value;
108 OnPropertyChanged();
109 }
110 }
111  
112 public StopBits StopBits
113 {
114 get => _stopBits;
115 set
116 {
117 if (value == _stopBits)
118 {
119 return;
120 }
121  
122 _stopBits = value;
123 OnPropertyChanged();
124 }
125 }
126  
127 public event PropertyChangedEventHandler PropertyChanged;
128  
129 [NotifyPropertyChangedInvocator]
130 protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
131 {
132 PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
133 }
134 }
135 }