HamBook – Blame information for rev 5
?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; |
||
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; |
||
5 | office | 21 | private Definitions _definitions = new Definitions(); |
1 | office | 22 | |
23 | public bool LaunchOnBoot |
||
24 | { |
||
25 | get => _launchOnBoot; |
||
26 | set |
||
27 | { |
||
28 | if (value == _launchOnBoot) |
||
29 | { |
||
30 | return; |
||
31 | } |
||
32 | |||
33 | _launchOnBoot = value; |
||
34 | OnPropertyChanged(); |
||
35 | } |
||
36 | } |
||
37 | |||
38 | public string Radio |
||
39 | { |
||
40 | get => _radio; |
||
41 | set |
||
42 | { |
||
43 | if (value == _radio) |
||
44 | { |
||
45 | return; |
||
46 | } |
||
47 | |||
48 | _radio = value; |
||
49 | OnPropertyChanged(); |
||
50 | } |
||
51 | } |
||
52 | |||
53 | public string Port |
||
54 | { |
||
55 | get => _port; |
||
56 | set |
||
57 | { |
||
58 | if (value == _port) |
||
59 | { |
||
60 | return; |
||
61 | } |
||
62 | |||
63 | _port = value; |
||
64 | OnPropertyChanged(); |
||
65 | } |
||
66 | } |
||
67 | |||
68 | public int Speed |
||
69 | { |
||
70 | get => _speed; |
||
71 | set |
||
72 | { |
||
73 | if (value == _speed) |
||
74 | { |
||
75 | return; |
||
76 | } |
||
77 | |||
78 | _speed = value; |
||
79 | OnPropertyChanged(); |
||
80 | } |
||
81 | } |
||
82 | |||
83 | public int DataBits |
||
84 | { |
||
85 | get => _dataBits; |
||
86 | set |
||
87 | { |
||
88 | if (value == _dataBits) |
||
89 | { |
||
90 | return; |
||
91 | } |
||
92 | |||
93 | _dataBits = value; |
||
94 | OnPropertyChanged(); |
||
95 | } |
||
96 | } |
||
97 | |||
98 | public Parity Parity |
||
99 | { |
||
100 | get => _parity; |
||
101 | set |
||
102 | { |
||
103 | if (value == _parity) |
||
104 | { |
||
105 | return; |
||
106 | } |
||
107 | |||
108 | _parity = value; |
||
109 | OnPropertyChanged(); |
||
110 | } |
||
111 | } |
||
112 | |||
113 | public StopBits StopBits |
||
114 | { |
||
115 | get => _stopBits; |
||
116 | set |
||
117 | { |
||
118 | if (value == _stopBits) |
||
119 | { |
||
120 | return; |
||
121 | } |
||
122 | |||
123 | _stopBits = value; |
||
124 | OnPropertyChanged(); |
||
125 | } |
||
126 | } |
||
127 | |||
5 | office | 128 | public Definitions Definitions |
129 | { |
||
130 | get => _definitions; |
||
131 | set |
||
132 | { |
||
133 | if (value == _definitions) |
||
134 | { |
||
135 | return; |
||
136 | } |
||
137 | |||
138 | _definitions = value; |
||
139 | OnPropertyChanged(); |
||
140 | } |
||
141 | } |
||
142 | |||
143 | public Configuration() |
||
144 | { |
||
145 | } |
||
146 | |||
1 | office | 147 | public event PropertyChangedEventHandler PropertyChanged; |
148 | |||
149 | [NotifyPropertyChangedInvocator] |
||
150 | protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) |
||
151 | { |
||
152 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
||
153 | } |
||
154 | } |
||
155 | } |