HamBook – Blame information for rev 7
?pathlinks?
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; |
||
7 | office | 6 | using System.Threading; |
1 | office | 7 | using System.Xml.Serialization; |
8 | |||
9 | namespace Configuration |
||
10 | { |
||
11 | [XmlRoot(Namespace = "urn:hambook-configuration-schema", ElementName = "Configuration")] |
||
12 | public class Configuration : INotifyPropertyChanged |
||
13 | { |
||
14 | private bool _launchOnBoot = false; |
||
15 | |||
16 | private string _radio = "Yaesu FT-891"; |
||
17 | private string _port = "COM1"; |
||
18 | private int _speed = 38400; |
||
19 | private int _dataBits = 8; |
||
20 | private Parity _parity = Parity.None; |
||
21 | private StopBits _stopBits = StopBits.One; |
||
5 | office | 22 | private Definitions _definitions = new Definitions(); |
7 | office | 23 | private Handshake _handshake = Handshake.None; |
24 | private SerialPortTimeout _serialPortTimeout = new SerialPortTimeout(); |
||
1 | office | 25 | |
26 | public bool LaunchOnBoot |
||
27 | { |
||
28 | get => _launchOnBoot; |
||
29 | set |
||
30 | { |
||
31 | if (value == _launchOnBoot) |
||
32 | { |
||
33 | return; |
||
34 | } |
||
35 | |||
36 | _launchOnBoot = value; |
||
37 | OnPropertyChanged(); |
||
38 | } |
||
39 | } |
||
40 | |||
41 | public string Radio |
||
42 | { |
||
43 | get => _radio; |
||
44 | set |
||
45 | { |
||
46 | if (value == _radio) |
||
47 | { |
||
48 | return; |
||
49 | } |
||
50 | |||
51 | _radio = value; |
||
52 | OnPropertyChanged(); |
||
53 | } |
||
54 | } |
||
55 | |||
56 | public string Port |
||
57 | { |
||
58 | get => _port; |
||
59 | set |
||
60 | { |
||
61 | if (value == _port) |
||
62 | { |
||
63 | return; |
||
64 | } |
||
65 | |||
66 | _port = value; |
||
67 | OnPropertyChanged(); |
||
68 | } |
||
69 | } |
||
70 | |||
71 | public int Speed |
||
72 | { |
||
73 | get => _speed; |
||
74 | set |
||
75 | { |
||
76 | if (value == _speed) |
||
77 | { |
||
78 | return; |
||
79 | } |
||
80 | |||
81 | _speed = value; |
||
82 | OnPropertyChanged(); |
||
83 | } |
||
84 | } |
||
85 | |||
86 | public int DataBits |
||
87 | { |
||
88 | get => _dataBits; |
||
89 | set |
||
90 | { |
||
91 | if (value == _dataBits) |
||
92 | { |
||
93 | return; |
||
94 | } |
||
95 | |||
96 | _dataBits = value; |
||
97 | OnPropertyChanged(); |
||
98 | } |
||
99 | } |
||
100 | |||
101 | public Parity Parity |
||
102 | { |
||
103 | get => _parity; |
||
104 | set |
||
105 | { |
||
106 | if (value == _parity) |
||
107 | { |
||
108 | return; |
||
109 | } |
||
110 | |||
111 | _parity = value; |
||
112 | OnPropertyChanged(); |
||
113 | } |
||
114 | } |
||
115 | |||
116 | public StopBits StopBits |
||
117 | { |
||
118 | get => _stopBits; |
||
119 | set |
||
120 | { |
||
121 | if (value == _stopBits) |
||
122 | { |
||
123 | return; |
||
124 | } |
||
125 | |||
126 | _stopBits = value; |
||
127 | OnPropertyChanged(); |
||
128 | } |
||
129 | } |
||
130 | |||
7 | office | 131 | public Handshake Handshake |
132 | { |
||
133 | get => _handshake; |
||
134 | set |
||
135 | { |
||
136 | if (value == _handshake) |
||
137 | { |
||
138 | return; |
||
139 | } |
||
140 | |||
141 | _handshake = value; |
||
142 | OnPropertyChanged(); |
||
143 | } |
||
144 | } |
||
145 | |||
146 | public SerialPortTimeout SerialPortTimeout |
||
147 | { |
||
148 | get => _serialPortTimeout; |
||
149 | set |
||
150 | { |
||
151 | if (value == _serialPortTimeout) |
||
152 | { |
||
153 | return; |
||
154 | } |
||
155 | |||
156 | _serialPortTimeout = value; |
||
157 | OnPropertyChanged(); |
||
158 | } |
||
159 | } |
||
160 | |||
5 | office | 161 | public Definitions Definitions |
162 | { |
||
163 | get => _definitions; |
||
164 | set |
||
165 | { |
||
166 | if (value == _definitions) |
||
167 | { |
||
168 | return; |
||
169 | } |
||
170 | |||
171 | _definitions = value; |
||
172 | OnPropertyChanged(); |
||
173 | } |
||
174 | } |
||
175 | |||
176 | public Configuration() |
||
177 | { |
||
178 | } |
||
179 | |||
1 | office | 180 | public event PropertyChangedEventHandler PropertyChanged; |
181 | |||
182 | [NotifyPropertyChangedInvocator] |
||
183 | protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) |
||
184 | { |
||
185 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
||
186 | } |
||
187 | } |
||
188 | } |