HamBook – Diff between revs 13 and 54

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 13 Rev 54
Line 1... Line -...
1 using Configuration.Annotations; -  
2 using System; -  
3 using System.Collections.Concurrent; 1 using System.Collections.Concurrent;
4 using System.Collections.Generic; -  
5 using System.Collections.ObjectModel; -  
6 using System.ComponentModel; 2 using System.ComponentModel;
7 using System.Linq; -  
8 using System.Runtime.CompilerServices; 3 using System.Runtime.CompilerServices;
9 using System.Text; -  
10 using System.Threading.Tasks; 4 using Configuration.Annotations;
Line 11... Line 5...
11   5  
12 namespace Configuration 6 namespace Configuration
13 { 7 {
14 public class Notifications : INotifyPropertyChanged 8 public class Notifications : INotifyPropertyChanged
-   9 {
-   10 private static readonly ConcurrentDictionary<NotificationType, NotificationState> _notificationStates =
15 { 11 new ConcurrentDictionary<NotificationType, NotificationState>();
16 12  
17 private NotificationState[] _notificationState = new NotificationState[] 13 private NotificationState[] _notificationState =
18 { 14 {
19 new NotificationState { Type = NotificationType.SignalScanDetect, Enabled = false, LingerTime = 1000 }, 15 new NotificationState { Type = NotificationType.SignalScanDetect, Enabled = false, LingerTime = 1000 }
Line -... Line 16...
-   16 };
-   17  
-   18 public Notifications()
-   19 {
-   20 if (_notificationStates.Count == 0)
-   21 foreach (var state in _notificationState)
-   22 _notificationStates.TryAdd(state.Type, state);
20 }; 23 }
21   24  
22 public NotificationState[] State 25 public NotificationState[] State
23 { 26 {
24 get => _notificationState; 27 get => _notificationState;
25 set 28 set
26 { -  
27 if (value == _notificationState) -  
28 { -  
Line 29... Line 29...
29 return; 29 {
30 } 30 if (value == _notificationState) return;
31   31  
32 _notificationState = value; 32 _notificationState = value;
Line 33... Line -...
33 OnPropertyChanged(); -  
34 } -  
35 } -  
36   -  
37 public Notifications() -  
38 { -  
39 if (_notificationStates.Count == 0) 33 OnPropertyChanged();
40 { -  
41 foreach (var state in _notificationState) -  
42 { -  
Line 43... Line 34...
43 _notificationStates.TryAdd(state.Type, state); 34 }
44 } 35 }
45 } 36  
46 } 37 public event PropertyChangedEventHandler PropertyChanged;
Line 47... Line -...
47   -  
48 public bool TryGetNotificationState(NotificationType notificationType, out NotificationState notificationState) -  
49 { -  
50 return _notificationStates.TryGetValue(notificationType, out notificationState); -  
51 } 38  
52   39 public bool TryGetNotificationState(NotificationType notificationType, out NotificationState notificationState)
53 private static ConcurrentDictionary<NotificationType, NotificationState> _notificationStates = new ConcurrentDictionary<NotificationType, NotificationState>(); 40 {
54   41 return _notificationStates.TryGetValue(notificationType, out notificationState);
55 public event PropertyChangedEventHandler PropertyChanged; 42 }
56   43  
57 [NotifyPropertyChangedInvocator] 44 [NotifyPropertyChangedInvocator]
58 protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) 45 protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)