HamBook – Diff between revs 5 and 12

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 5 Rev 12
Line -... Line 1...
-   1 using Configuration;
1 using Configuration.Annotations; 2 using Configuration.Annotations;
2 using System; 3 using System;
-   4 using System.Collections.Concurrent;
3 using System.Collections.Generic; 5 using System.Collections.Generic;
4 using System.Collections.ObjectModel; 6 using System.Collections.ObjectModel;
5 using System.ComponentModel; 7 using System.ComponentModel;
6 using System.Linq; 8 using System.Linq;
7 using System.Runtime.CompilerServices; 9 using System.Runtime.CompilerServices;
Line 10... Line 12...
10   12  
11 namespace Configuration 13 namespace Configuration
12 { 14 {
13 public class Definitions : INotifyPropertyChanged 15 public class Definitions : INotifyPropertyChanged
-   16 {
-   17 private Band[] _bands = new Band[]
-   18 {
-   19 new Band { Meters = 6, Min = 050000000, Max = 054000000 },
-   20 new Band { Meters = 10, Min = 028000000, Max = 029700000 },
-   21 new Band { Meters = 11, Min = 026965000, Max = 027405000 },
-   22 new Band { Meters = 12, Min = 024920000, Max = 024990000 },
-   23 new Band { Meters = 15, Min = 021000000, Max = 021450000 },
-   24 new Band { Meters = 17, Min = 018068000, Max = 018168000 },
-   25 new Band { Meters = 20, Min = 014000000, Max = 014350000 },
-   26 new Band { Meters = 30, Min = 010100000, Max = 010150000 },
-   27 new Band { Meters = 40, Min = 007000000, Max = 007300000 },
-   28 };
14 { 29  
15 public ObservableCollection<Band> Bands 30 public Band[] Bands
16 { 31 {
17 get => _bands; 32 get => _bands;
18 set 33 set
19 { 34 {
Line 23... Line 38...
23 } 38 }
Line 24... Line 39...
24   39  
25 _metersToBand.Clear(); 40 _metersToBand.Clear();
26 foreach (var band in value) 41 foreach (var band in value)
27 { 42 {
28 _metersToBand.Add(band.Meters, band); 43 _metersToBand.TryAdd(band.Meters, band);
Line 29... Line 44...
29 } 44 }
Line 30... Line 45...
30   45  
31 _bands = value; 46 _bands = value;
32   47  
Line 33... Line 48...
33 OnPropertyChanged(); 48 OnPropertyChanged();
34 } 49 }
35 } 50 }
36   51  
37 public Definitions() 52 public Definitions()
38 { 53 {
39 if(_metersToBand.Count == 0) 54 if (_metersToBand.Count == 0)
40 { 55 {
41 foreach(var band in _bands) 56 foreach (var band in _bands)
42 { 57 {
Line 43... Line 58...
43 _metersToBand.Add(band.Meters, band); 58 _metersToBand.TryAdd(band.Meters, band);
44 } -  
45 } -  
46 } -  
47   -  
48 private Dictionary<int, Band> _metersToBand = new Dictionary<int, Band>(); -  
49   -  
50 private ObservableCollection<Band> _bands = new ObservableCollection<Band> -  
51 { -  
52 new Band { Meters = 6, Min = 050000000, Max = 054000000 }, -  
53 new Band { Meters = 10, Min = 028000000, Max = 029700000 }, -  
54 new Band { Meters = 11, Min = 026965000, Max = 027405000 }, -  
55 new Band { Meters = 12, Min = 024920000, Max = 024990000 }, -  
56 new Band { Meters = 15, Min = 021000000, Max = 021450000 }, -  
Line 57... Line 59...
57 new Band { Meters = 17, Min = 018068000, Max = 018168000 }, 59 }
58 new Band { Meters = 20, Min = 014000000, Max = 014350000 }, 60 }
59 new Band { Meters = 30, Min = 010100000, Max = 010150000 }, 61 }
60 new Band { Meters = 40, Min = 007000000, Max = 007300000 }, 62