HamBook – Diff between revs 12 and 54
?pathlinks?
Rev 12 | Rev 54 | |||
---|---|---|---|---|
Line 1... | Line -... | |||
1 | using Configuration; |
- | ||
2 | using Configuration.Annotations; |
- | ||
3 | using System; |
- | ||
4 | using System.Collections.Concurrent; |
1 | using System.Collections.Concurrent; |
|
5 | using System.Collections.Generic; |
- | ||
6 | using System.Collections.ObjectModel; |
- | ||
7 | using System.ComponentModel; |
2 | using System.ComponentModel; |
|
8 | using System.Linq; |
- | ||
9 | using System.Runtime.CompilerServices; |
3 | using System.Runtime.CompilerServices; |
|
10 | using System.Text; |
- | ||
11 | using System.Threading.Tasks; |
4 | using Configuration.Annotations; |
|
Line 12... | Line 5... | |||
12 | |
5 | |
|
13 | namespace Configuration |
6 | namespace Configuration |
|
14 | { |
7 | { |
|
15 | public class Definitions : INotifyPropertyChanged |
8 | public class Definitions : INotifyPropertyChanged |
|
- | 9 | { |
||
- | 10 | private static readonly ConcurrentDictionary<int, Band> _metersToBand = new ConcurrentDictionary<int, Band>(); |
||
16 | { |
11 | |
|
17 | private Band[] _bands = new Band[] |
12 | private Band[] _bands = |
|
18 | { |
13 | { |
|
19 | new Band { Meters = 6, Min = 050000000, Max = 054000000 }, |
14 | new Band { Meters = 6, Min = 050000000, Max = 054000000 }, |
|
20 | new Band { Meters = 10, Min = 028000000, Max = 029700000 }, |
15 | new Band { Meters = 10, Min = 028000000, Max = 029700000 }, |
|
21 | new Band { Meters = 11, Min = 026965000, Max = 027405000 }, |
16 | new Band { Meters = 11, Min = 026965000, Max = 027405000 }, |
|
22 | new Band { Meters = 12, Min = 024920000, Max = 024990000 }, |
17 | new Band { Meters = 12, Min = 024920000, Max = 024990000 }, |
|
23 | new Band { Meters = 15, Min = 021000000, Max = 021450000 }, |
18 | new Band { Meters = 15, Min = 021000000, Max = 021450000 }, |
|
24 | new Band { Meters = 17, Min = 018068000, Max = 018168000 }, |
19 | new Band { Meters = 17, Min = 018068000, Max = 018168000 }, |
|
25 | new Band { Meters = 20, Min = 014000000, Max = 014350000 }, |
20 | new Band { Meters = 20, Min = 014000000, Max = 014350000 }, |
|
26 | new Band { Meters = 30, Min = 010100000, Max = 010150000 }, |
21 | new Band { Meters = 30, Min = 010100000, Max = 010150000 }, |
|
27 | new Band { Meters = 40, Min = 007000000, Max = 007300000 }, |
22 | new Band { Meters = 40, Min = 007000000, Max = 007300000 } |
|
Line -... | Line 23... | |||
- | 23 | }; |
||
- | 24 | |
||
- | 25 | public Definitions() |
||
- | 26 | { |
||
- | 27 | if (_metersToBand.Count == 0) |
||
- | 28 | foreach (var band in _bands) |
||
- | 29 | _metersToBand.TryAdd(band.Meters, band); |
||
28 | }; |
30 | } |
|
29 | |
31 | |
|
30 | public Band[] Bands |
32 | public Band[] Bands |
|
31 | { |
33 | { |
|
32 | get => _bands; |
34 | get => _bands; |
|
33 | set |
35 | set |
|
34 | { |
- | ||
35 | if (value == _bands) |
- | ||
36 | { |
- | ||
Line 37... | Line 36... | |||
37 | return; |
36 | { |
|
38 | } |
- | ||
39 | |
- | ||
40 | _metersToBand.Clear(); |
37 | if (value == _bands) return; |
|
41 | foreach (var band in value) |
- | ||
Line 42... | Line 38... | |||
42 | { |
38 | |
|
Line 43... | Line 39... | |||
43 | _metersToBand.TryAdd(band.Meters, band); |
39 | _metersToBand.Clear(); |
|
44 | } |
40 | foreach (var band in value) _metersToBand.TryAdd(band.Meters, band); |
|
45 | |
41 | |
|
Line 46... | Line -... | |||
46 | _bands = value; |
- | ||
47 | |
- | ||
48 | OnPropertyChanged(); |
- | ||
49 | } |
- | ||
50 | } |
- | ||
51 | |
- | ||
52 | public Definitions() |
42 | _bands = value; |
|
53 | { |
- | ||
54 | if (_metersToBand.Count == 0) |
- | ||
55 | { |
- | ||
56 | foreach (var band in _bands) |
- | ||
57 | { |
- | ||
Line 58... | Line 43... | |||
58 | _metersToBand.TryAdd(band.Meters, band); |
43 | |
|
59 | } |
44 | OnPropertyChanged(); |
|
60 | } |
45 | } |
|
61 | } |
46 | } |
|
62 | |
47 | |
|
63 | private static ConcurrentDictionary<int, Band> _metersToBand = new ConcurrentDictionary<int, Band>(); |
48 | public event PropertyChangedEventHandler PropertyChanged; |
|
64 | |
49 | |
|
65 | /// <summary> |
50 | /// <summary> |
|
66 | /// Retrieve the minimum and maximum frequency from meters. |
51 | /// Retrieve the minimum and maximum frequency from meters. |
|
67 | /// </summary> |
52 | /// </summary> |
|
Line 68... | Line -... | |||
68 | /// <param name="meters">meters corresponding to a band</param> |
- | ||
69 | /// <param name="band">the band</param> |
- | ||
70 | /// <returns>true upon a band definition existing</returns> |
53 | /// <param name="meters">meters corresponding to a band</param> |
|
71 | public bool TryGetBand(int meters, out Band band) |
54 | /// <param name="band">the band</param> |
|
72 | { |
55 | /// <returns>true upon a band definition existing</returns> |
|
73 | return _metersToBand.TryGetValue(meters, out band); |
56 | public bool TryGetBand(int meters, out Band band) |
|
74 | } |
57 | { |
|
75 | |
58 | return _metersToBand.TryGetValue(meters, out band); |
|
76 | public event PropertyChangedEventHandler PropertyChanged; |
59 | } |
|
77 | |
60 | |