Widow – Diff between revs 9 and 11

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 9 Rev 11
Line 24... Line 24...
24 if (Equals(value, _window)) 24 if (Equals(value, _window))
25 { 25 {
26 return; 26 return;
27 } 27 }
Line 28... Line 28...
28   28  
29 _window.CollectionChanged -= _window_CollectionChanged; 29 _window.CollectionChanged -= Window_CollectionChanged;
-   30 _window.Clear();
30 _window = value; 31  
31 _windows.Clear(); 32 _windows.Clear();
32 foreach (var window in value) 33 foreach (var window in value)
-   34 {
-   35 _window.Add(window);
-   36  
-   37 if (_windows.Contains(window.Title))
-   38 {
-   39 continue;
-   40 }
33 { 41  
34 _windows.Add(window.Name); 42 _windows.Add(window.Title);
Line 35... Line 43...
35 } 43 }
36   44  
37 _window.CollectionChanged += _window_CollectionChanged; 45 _window.CollectionChanged += Window_CollectionChanged;
38 OnPropertyChanged(); 46 OnPropertyChanged();
Line 39... Line 47...
39 } 47 }
Line 40... Line 48...
40 } 48 }
Line 41... Line 49...
41   49  
Line 42... Line 50...
42 #endregion 50 #endregion
Line 43... Line 51...
43   51  
Line 44... Line 52...
44 #region Private Delegates, Events, Enums, Properties, Indexers and Fields 52 #region Private Delegates, Events, Enums, Properties, Indexers and Fields
Line 45... Line 53...
45   53  
46 private ObservableCollection<Window> _window = new ObservableCollection<Window>(); 54 private readonly ObservableCollection<Window> _window = new ObservableCollection<Window>();
47   55  
48 private HashSet<string> _windows = new HashSet<string>(); 56 private readonly HashSet<string> _windows = new HashSet<string>();
49   57  
Line 50... Line 58...
50 #endregion 58 #endregion
51   59  
52 #region Constructors, Destructors and Finalizers 60 #region Constructors, Destructors and Finalizers
53   61  
Line 54... Line 62...
54 [UsedImplicitly] 62 [UsedImplicitly]
Line 55... Line 63...
55 public Windows() 63 public Windows()
Line 70... Line 78...
70   78  
Line 71... Line 79...
71 #endregion 79 #endregion
Line 72... Line 80...
72   80  
73 #region Event Handlers 81 #region Event Handlers
74   82  
75 private void _window_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) 83 private void Window_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
76 { 84 {
77 if (e.OldItems != null) 85 if (e.OldItems != null)
78 { 86 {
79 foreach (var window in e.OldItems.OfType<Window>()) 87 foreach (var window in e.OldItems.OfType<Window>())
80 { 88 {
81 if (_windows.Contains(window.Name)) 89 if (_windows.Contains(window.Title))
82 { 90 {
83 _windows.Remove(window.Name); 91 _windows.Remove(window.Title);
Line 84... Line 92...
84 } 92 }
85 } 93 }
86 } 94 }
87   95  
88   96  
89 if (e.NewItems != null) 97 if (e.NewItems != null)
90 { 98 {
91 foreach (var window in e.NewItems.OfType<Window>()) 99 foreach (var window in e.NewItems.OfType<Window>())
92 { 100 {
93 if (!_windows.Contains(window.Name)) 101 if (!_windows.Contains(window.Title))
94 { 102 {
Line 95... Line 103...
95 _windows.Add(window.Name); 103 _windows.Add(window.Title);
Line 96... Line 104...
96 } 104 }
Line 97... Line 105...
97 } 105 }
98 } 106 }
99 } 107 }
100   108  
Line 101... Line 109...
101 #endregion 109 #endregion
Line 102... Line 110...
102   110