HamBook – Diff between revs 11 and 12
?pathlinks?
Rev 11 | Rev 12 | |||
---|---|---|---|---|
Line 13... | Line 13... | |||
13 | using System.Media; |
13 | using System.Media; |
|
14 | using System.Reflection; |
14 | using System.Reflection; |
|
15 | using RJCP.IO.Ports; |
15 | using RJCP.IO.Ports; |
|
16 | using System.Diagnostics; |
16 | using System.Diagnostics; |
|
17 | using System.IO; |
17 | using System.IO; |
|
- | 18 | using Toasts; |
||
- | 19 | using System.Drawing; |
||
- | 20 | using Configuration; |
||
Line 18... | Line 21... | |||
18 | |
21 | |
|
19 | namespace HamBook |
22 | namespace HamBook |
|
20 | { |
23 | { |
|
21 | public class BandScan |
24 | public class BandScan |
|
Line 25... | Line 28... | |||
25 | private CancellationToken _scanningCancellationToken; |
28 | private CancellationToken _scanningCancellationToken; |
|
26 | private CatAssemblies _catAssemblies; |
29 | private CatAssemblies _catAssemblies; |
|
27 | private int _minFrequency; |
30 | private int _minFrequency; |
|
28 | private int _maxFrequency; |
31 | private int _maxFrequency; |
|
29 | private SerialPortStream _serialPort; |
32 | private SerialPortStream _serialPort; |
|
- | 33 | private Configuration.Configuration _configuration; |
||
30 | private int _currentFrequency; |
34 | private int _currentFrequency; |
|
31 | private Task _scanTask; |
35 | private Task _scanTask; |
|
Line 32... | Line 36... | |||
32 | |
36 | |
|
33 | private BandScan() |
37 | private BandScan() |
|
34 | { |
38 | { |
|
Line 35... | Line 39... | |||
35 | } |
39 | } |
|
36 | |
40 | |
|
37 | public BandScan(CatAssemblies catAssemblies, int min, int max, SerialPortStream serialPort) : this() |
41 | public BandScan(CatAssemblies catAssemblies, int min, int max, SerialPortStream serialPort, Configuration.Configuration configuration) : this() |
|
38 | { |
42 | { |
|
39 | _catAssemblies = catAssemblies; |
43 | _catAssemblies = catAssemblies; |
|
40 | _minFrequency = min; |
44 | _minFrequency = min; |
|
- | 45 | _maxFrequency = max; |
||
Line 41... | Line 46... | |||
41 | _maxFrequency = max; |
46 | _serialPort = serialPort; |
|
Line 42... | Line 47... | |||
42 | _serialPort = serialPort; |
47 | _configuration = configuration; |
|
43 | |
48 | |
|
Line 114... | Line 119... | |||
114 | var command = $"{split}{Radios.Generic.Constants.EOT}"; |
119 | var command = $"{split}{Radios.Generic.Constants.EOT}"; |
|
Line 115... | Line 120... | |||
115 | |
120 | |
|
116 | switch (_catAssemblies.CatParse<BusyState>("BY", new object[] { command })) |
121 | switch (_catAssemblies.CatParse<BusyState>("BY", new object[] { command })) |
|
117 | { |
122 | { |
|
- | 123 | case BusyState.ON: |
||
- | 124 | if (!_configuration.Notifications.TryGetNotificationState(NotificationType.SignalScanDetect, out var notificationState)) |
||
- | 125 | { |
||
- | 126 | var toastFrom = new ToastForm( |
||
- | 127 | $"{Resources.Signal_detected_during_scan}", |
||
- | 128 | $"{Resources.Frequency}: {_currentFrequency}Hz", |
||
- | 129 | notificationState.LingerTime, |
||
- | 130 | Constants.AssemblyIcon); |
||
- | 131 | |
||
- | 132 | toastFrom.Show(); |
||
118 | case BusyState.ON: |
133 | |
|
- | 134 | await Task.Delay(TimeSpan.FromSeconds(detect), _scanningCancellationToken); |
||
119 | await Task.Delay(TimeSpan.FromSeconds(detect), _scanningCancellationToken); |
135 | } |
|
120 | continue; |
136 | continue; |
|
121 | } |
137 | } |
|
122 | } |
138 | } |