HamBook – Diff between revs 56 and 58
?pathlinks?
Rev 56 | Rev 58 | |||
---|---|---|---|---|
Line 10... | Line 10... | |||
10 | namespace HamBook |
10 | namespace HamBook |
|
11 | { |
11 | { |
|
12 | public partial class SettingsForm : Form |
12 | public partial class SettingsForm : Form |
|
13 | { |
13 | { |
|
14 | private readonly Configuration.Configuration _configuration; |
14 | private readonly Configuration.Configuration _configuration; |
|
- | 15 | private readonly CancellationToken _cancellationToken; |
||
Line 15... | Line 16... | |||
15 | |
16 | |
|
16 | public SettingsForm() |
17 | public SettingsForm() |
|
17 | { |
18 | { |
|
18 | InitializeComponent(); |
19 | InitializeComponent(); |
|
19 | Utilities.WindowState.FormTracker.Track(this); |
20 | Utilities.WindowState.FormTracker.Track(this); |
|
Line 20... | Line 21... | |||
20 | } |
21 | } |
|
21 | |
22 | |
|
22 | public SettingsForm(Configuration.Configuration configuration, CancellationToken cancellationToken) : this() |
23 | public SettingsForm(Configuration.Configuration configuration, CancellationToken cancellationToken) : this() |
|
- | 24 | { |
||
23 | { |
25 | _configuration = configuration; |
|
Line 24... | Line 26... | |||
24 | _configuration = configuration; |
26 | _cancellationToken = cancellationToken; |
|
Line 25... | Line 27... | |||
25 | } |
27 | } |
|
26 | |
28 | |
|
27 | public bool SaveOnClose { get; private set; } |
29 | public bool SaveOnClose { get; private set; } |
|
Line 28... | Line 30... | |||
28 | |
30 | |
|
29 | private void SettingsForm_Load(object sender, EventArgs e) |
31 | private void SettingsForm_Load(object sender, EventArgs e) |
|
- | 32 | { |
||
- | 33 | var ports = SerialPort.GetPortNames(); |
||
30 | { |
34 | |
|
- | 35 | if (ports != null && ports.Length != 0) |
||
Line 31... | Line 36... | |||
31 | var ports = SerialPort.GetPortNames(); |
36 | { |
|
32 | |
37 | foreach (var port in ports) |
|
Line 33... | Line 38... | |||
33 | if (ports != null && ports.Length != 0) |
38 | { |
|
Line 200... | Line 205... | |||
200 | switch (dataGridView.Columns[e.ColumnIndex].Name) |
205 | switch (dataGridView.Columns[e.ColumnIndex].Name) |
|
201 | { |
206 | { |
|
202 | case "EnableColumn": |
207 | case "EnableColumn": |
|
203 | ProcessEnable(dataGridView.Rows[e.RowIndex]); |
208 | ProcessEnable(dataGridView.Rows[e.RowIndex]); |
|
204 | break; |
209 | break; |
|
- | 210 | case "LingerColumn": |
||
- | 211 | ProcessLinger(dataGridView.Rows[e.RowIndex]); |
||
- | 212 | break; |
||
205 | } |
213 | } |
|
206 | } |
214 | } |
|
Line 207... | Line 215... | |||
207 | |
215 | |
|
208 | private void DataGridView1_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e) |
216 | private void DataGridView1_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e) |
|
Line 243... | Line 251... | |||
243 | case NotificationType.SignalScanDetect: |
251 | case NotificationType.SignalScanDetect: |
|
244 | notificationState.Enabled = (bool)enableCheckBoxCell.Value; |
252 | notificationState.Enabled = (bool)enableCheckBoxCell.Value; |
|
245 | break; |
253 | break; |
|
246 | } |
254 | } |
|
247 | } |
255 | } |
|
- | 256 | |
||
- | 257 | private void ProcessLinger(DataGridViewRow dataGridViewRow) |
||
- | 258 | { |
||
- | 259 | var lingerCheckBoxCell = |
||
- | 260 | (DataGridViewTextBoxCell)dataGridViewRow.Cells["LingerColumn"]; |
||
- | 261 | |
||
- | 262 | foreach (var notificationState in _configuration.Notifications.State) |
||
- | 263 | switch (notificationState.Type) |
||
- | 264 | { |
||
- | 265 | case NotificationType.SignalScanDetect: |
||
- | 266 | if (int.TryParse($"{lingerCheckBoxCell.Value}", out var value)) |
||
- | 267 | { |
||
- | 268 | notificationState.LingerTime = value; |
||
- | 269 | } |
||
- | 270 | |
||
- | 271 | break; |
||
- | 272 | } |
||
- | 273 | } |
||
248 | } |
274 | } |
|
249 | } |
275 | } |
|
250 | |
276 | |