Changeset 3019
- Timestamp:
- 03/14/10 18:26:23 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Collections/3.3
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Collections/3.3/ReadOnlyObservableArray.cs
r3017 r3019 33 33 private IObservableArray<T> array; 34 34 35 #region Persistence36 private ReadOnlyObservableArray() { }37 38 [StorableHook(HookType.AfterDeserialization)]39 private void PostDeserializationHook() {40 RegisterEvents();41 }42 #endregion43 44 35 #region Properties 45 36 public int Length { … … 62 53 #endregion 63 54 64 65 66 55 #region Constructors 56 protected ReadOnlyObservableArray() { } 67 57 public ReadOnlyObservableArray(IObservableArray<T> array) { 68 58 if (array == null) throw new ArgumentNullException(); 69 59 this.array = array; 70 60 RegisterEvents(); 71 }72 73 private void RegisterEvents() {74 array.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<T>>(array_ItemsReplaced);75 array.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<T>>(array_ItemsMoved);76 array.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<T>>(array_CollectionReset);77 array.PropertyChanged += new PropertyChangedEventHandler(array_PropertyChanged);78 61 } 79 62 #endregion … … 126 109 127 110 #region Events 111 [StorableHook(HookType.AfterDeserialization)] 112 protected void RegisterEvents() { 113 array.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<T>>(array_ItemsReplaced); 114 array.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<T>>(array_ItemsMoved); 115 array.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<T>>(array_CollectionReset); 116 array.PropertyChanged += new PropertyChangedEventHandler(array_PropertyChanged); 117 } 118 128 119 [field: NonSerialized] 129 120 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsReplaced; -
trunk/sources/HeuristicLab.Collections/3.3/ReadOnlyObservableCollection.cs
r3017 r3019 33 33 private IObservableCollection<T> collection; 34 34 35 #region persistence36 private ReadOnlyObservableCollection() { }37 38 [StorableHook(HookType.AfterDeserialization)]39 private void PostDeserializationHook() {40 RegisterEvents();41 }42 #endregion43 44 35 #region Properties 45 36 public int Count { … … 52 43 53 44 #region Constructors 45 protected ReadOnlyObservableCollection() { } 54 46 public ReadOnlyObservableCollection(IObservableCollection<T> collection) { 55 47 if (collection == null) throw new ArgumentNullException(); 56 48 this.collection = collection; 57 49 RegisterEvents(); 58 }59 60 private void RegisterEvents() {61 collection.ItemsAdded += new CollectionItemsChangedEventHandler<T>(collection_ItemsAdded);62 collection.ItemsRemoved += new CollectionItemsChangedEventHandler<T>(collection_ItemsRemoved);63 collection.CollectionReset += new CollectionItemsChangedEventHandler<T>(collection_CollectionReset);64 collection.PropertyChanged += new PropertyChangedEventHandler(collection_PropertyChanged);65 50 } 66 51 #endregion … … 102 87 103 88 #region Events 89 [StorableHook(HookType.AfterDeserialization)] 90 protected void RegisterEvents() { 91 collection.ItemsAdded += new CollectionItemsChangedEventHandler<T>(collection_ItemsAdded); 92 collection.ItemsRemoved += new CollectionItemsChangedEventHandler<T>(collection_ItemsRemoved); 93 collection.CollectionReset += new CollectionItemsChangedEventHandler<T>(collection_CollectionReset); 94 collection.PropertyChanged += new PropertyChangedEventHandler(collection_PropertyChanged); 95 } 96 104 97 [field: NonSerialized] 105 98 public event CollectionItemsChangedEventHandler<T> ItemsAdded; -
trunk/sources/HeuristicLab.Collections/3.3/ReadOnlyObservableDictionary.cs
r3017 r3019 33 33 private IObservableDictionary<TKey, TValue> dict; 34 34 35 #region persistence36 private ReadOnlyObservableDictionary() { }37 38 [StorableHook(HookType.AfterDeserialization)]39 private void PostDeserizlationHook() {40 RegisterEvents();41 }42 #endregion43 44 35 #region Properties 45 36 public ICollection<TKey> Keys { … … 66 57 67 58 #region Constructors 59 protected ReadOnlyObservableDictionary() { } 68 60 public ReadOnlyObservableDictionary(IObservableDictionary<TKey, TValue> dictionary) { 69 61 if (dictionary == null) throw new ArgumentNullException(); 70 62 dict = dictionary; 71 63 RegisterEvents(); 72 }73 74 private void RegisterEvents() {75 dict.ItemsAdded += new CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>>(dict_ItemsAdded);76 dict.ItemsRemoved += new CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>>(dict_ItemsRemoved);77 dict.ItemsReplaced += new CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>>(dict_ItemsReplaced);78 dict.CollectionReset += new CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>>(dict_CollectionReset);79 dict.PropertyChanged += new PropertyChangedEventHandler(dict_PropertyChanged);80 64 } 81 65 #endregion … … 130 114 131 115 #region Events 116 [StorableHook(HookType.AfterDeserialization)] 117 protected void RegisterEvents() { 118 dict.ItemsAdded += new CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>>(dict_ItemsAdded); 119 dict.ItemsRemoved += new CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>>(dict_ItemsRemoved); 120 dict.ItemsReplaced += new CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>>(dict_ItemsReplaced); 121 dict.CollectionReset += new CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>>(dict_CollectionReset); 122 dict.PropertyChanged += new PropertyChangedEventHandler(dict_PropertyChanged); 123 } 124 132 125 [field: NonSerialized] 133 126 public event CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> ItemsAdded; -
trunk/sources/HeuristicLab.Collections/3.3/ReadOnlyObservableKeyedCollection.cs
r3017 r3019 33 33 private IObservableKeyedCollection<TKey, TItem> collection; 34 34 35 #region persistence36 private ReadOnlyObservableKeyedCollection() { }37 38 [StorableHook(HookType.AfterDeserialization)]39 private void PostDeserizlationHook() {40 RegisterEvents();41 }42 #endregion43 44 35 #region Properties 45 36 public int Count { … … 58 49 59 50 #region Constructors 51 protected ReadOnlyObservableKeyedCollection() { } 60 52 public ReadOnlyObservableKeyedCollection(IObservableKeyedCollection<TKey, TItem> collection) { 61 53 if (collection == null) throw new ArgumentNullException(); 62 54 this.collection = collection; 63 55 RegisterEvents(); 64 }65 66 private void RegisterEvents() {67 collection.ItemsAdded += new CollectionItemsChangedEventHandler<TItem>(collection_ItemsAdded);68 collection.ItemsRemoved += new CollectionItemsChangedEventHandler<TItem>(collection_ItemsRemoved);69 collection.ItemsReplaced += new CollectionItemsChangedEventHandler<TItem>(collection_ItemsReplaced);70 collection.CollectionReset += new CollectionItemsChangedEventHandler<TItem>(collection_CollectionReset);71 collection.PropertyChanged += new PropertyChangedEventHandler(collection_PropertyChanged);72 56 } 73 57 #endregion … … 119 103 120 104 #region Events 105 [StorableHook(HookType.AfterDeserialization)] 106 protected void RegisterEvents() { 107 collection.ItemsAdded += new CollectionItemsChangedEventHandler<TItem>(collection_ItemsAdded); 108 collection.ItemsRemoved += new CollectionItemsChangedEventHandler<TItem>(collection_ItemsRemoved); 109 collection.ItemsReplaced += new CollectionItemsChangedEventHandler<TItem>(collection_ItemsReplaced); 110 collection.CollectionReset += new CollectionItemsChangedEventHandler<TItem>(collection_CollectionReset); 111 collection.PropertyChanged += new PropertyChangedEventHandler(collection_PropertyChanged); 112 } 113 121 114 [field: NonSerialized] 122 115 public event CollectionItemsChangedEventHandler<TItem> ItemsAdded; -
trunk/sources/HeuristicLab.Collections/3.3/ReadOnlyObservableList.cs
r3017 r3019 33 33 private IObservableList<T> list; 34 34 35 #region persistence36 private ReadOnlyObservableList() { }37 38 [StorableHook(HookType.AfterDeserialization)]39 private void PostDeserizlationHook() {40 RegisterEvents();41 }42 #endregion43 44 35 #region Properties 45 36 public int Count { … … 60 51 61 52 #region Constructors 53 protected ReadOnlyObservableList() { } 62 54 public ReadOnlyObservableList(IObservableList<T> list) { 63 55 if (list == null) throw new ArgumentNullException(); … … 65 57 RegisterEvents(); 66 58 } 67 68 private void RegisterEvents() { 59 #endregion 60 61 #region Access 62 public bool Contains(T item) { 63 return list.Contains(item); 64 } 65 66 public int IndexOf(T item) { 67 return list.IndexOf(item); 68 } 69 #endregion 70 71 #region Manipulation 72 void ICollection<T>.Add(T item) { 73 throw new NotSupportedException(); 74 } 75 76 void IList<T>.Insert(int index, T item) { 77 throw new NotSupportedException(); 78 } 79 80 bool ICollection<T>.Remove(T item) { 81 throw new NotSupportedException(); 82 } 83 void IList<T>.RemoveAt(int index) { 84 throw new NotSupportedException(); 85 } 86 87 void ICollection<T>.Clear() { 88 throw new NotSupportedException(); 89 } 90 #endregion 91 92 #region Conversion 93 public void CopyTo(T[] array, int arrayIndex) { 94 list.CopyTo(array, arrayIndex); 95 } 96 #endregion 97 98 #region Enumeration 99 public IEnumerator<T> GetEnumerator() { 100 return ((ICollection<T>)list).GetEnumerator(); 101 } 102 IEnumerator IEnumerable.GetEnumerator() { 103 return ((IEnumerable)list).GetEnumerator(); 104 } 105 #endregion 106 107 #region Events 108 [StorableHook(HookType.AfterDeserialization)] 109 protected void RegisterEvents() { 69 110 list.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<T>>(list_ItemsAdded); 70 111 ((IObservableCollection<T>)list).ItemsAdded += new CollectionItemsChangedEventHandler<T>(list_ItemsAdded); … … 77 118 list.PropertyChanged += new PropertyChangedEventHandler(list_PropertyChanged); 78 119 } 79 #endregion 80 81 #region Access 82 public bool Contains(T item) { 83 return list.Contains(item); 84 } 85 86 public int IndexOf(T item) { 87 return list.IndexOf(item); 88 } 89 #endregion 90 91 #region Manipulation 92 void ICollection<T>.Add(T item) { 93 throw new NotSupportedException(); 94 } 95 96 void IList<T>.Insert(int index, T item) { 97 throw new NotSupportedException(); 98 } 99 100 bool ICollection<T>.Remove(T item) { 101 throw new NotSupportedException(); 102 } 103 void IList<T>.RemoveAt(int index) { 104 throw new NotSupportedException(); 105 } 106 107 void ICollection<T>.Clear() { 108 throw new NotSupportedException(); 109 } 110 #endregion 111 112 #region Conversion 113 public void CopyTo(T[] array, int arrayIndex) { 114 list.CopyTo(array, arrayIndex); 115 } 116 #endregion 117 118 #region Enumeration 119 public IEnumerator<T> GetEnumerator() { 120 return ((ICollection<T>)list).GetEnumerator(); 121 } 122 IEnumerator IEnumerable.GetEnumerator() { 123 return ((IEnumerable)list).GetEnumerator(); 124 } 125 #endregion 126 127 #region Events 120 128 121 [field: NonSerialized] 129 122 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsAdded; -
trunk/sources/HeuristicLab.Collections/3.3/ReadOnlyObservableSet.cs
r3017 r3019 33 33 private IObservableSet<T> set; 34 34 35 #region persistence36 private ReadOnlyObservableSet() { }37 38 [StorableHook(HookType.AfterDeserialization)]39 private void PostDeserizlationHook() {40 RegisterEvents();41 }42 #endregion43 44 35 #region Properties 45 36 public int Count { … … 52 43 53 44 #region Constructors 45 protected ReadOnlyObservableSet() { } 54 46 public ReadOnlyObservableSet(IObservableSet<T> set) { 55 47 if (set == null) throw new ArgumentNullException(); 56 48 this.set = set; 57 49 RegisterEvents(); 58 }59 60 private void RegisterEvents() {61 set.ItemsAdded += new CollectionItemsChangedEventHandler<T>(set_ItemsAdded);62 set.ItemsRemoved += new CollectionItemsChangedEventHandler<T>(set_ItemsRemoved);63 set.CollectionReset += new CollectionItemsChangedEventHandler<T>(set_CollectionReset);64 set.PropertyChanged += new PropertyChangedEventHandler(set_PropertyChanged);65 50 } 66 51 #endregion … … 143 128 144 129 #region Events 130 [StorableHook(HookType.AfterDeserialization)] 131 protected void RegisterEvents() { 132 set.ItemsAdded += new CollectionItemsChangedEventHandler<T>(set_ItemsAdded); 133 set.ItemsRemoved += new CollectionItemsChangedEventHandler<T>(set_ItemsRemoved); 134 set.CollectionReset += new CollectionItemsChangedEventHandler<T>(set_CollectionReset); 135 set.PropertyChanged += new PropertyChangedEventHandler(set_PropertyChanged); 136 } 137 145 138 [field: NonSerialized] 146 139 public event CollectionItemsChangedEventHandler<T> ItemsAdded;
Note: See TracChangeset
for help on using the changeset viewer.