wasSharp – Diff between revs 10 and 27

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 10 Rev 27
1 /////////////////////////////////////////////////////////////////////////// 1 ///////////////////////////////////////////////////////////////////////////
2 // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // 2 // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 //
3 // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // 3 // Please see: http://www.gnu.org/licenses/gpl.html for legal details, //
4 // rights of fair usage, the disclaimer and warranty conditions. // 4 // rights of fair usage, the disclaimer and warranty conditions. //
5 /////////////////////////////////////////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////////////
6   6  
7 using System; 7 using System;
8 using System.Collections.Generic; 8 using System.Collections.Generic;
9 using System.Collections.ObjectModel; 9 using System.Collections.ObjectModel;
10 using System.Collections.Specialized; 10 using System.Collections.Specialized;
11   11  
12 namespace wasSharp.Collections.Specialized 12 namespace wasSharp.Collections.Specialized
13 { 13 {
14 /// <summary> 14 /// <summary>
15 /// An observable collection allowing the add of a range of items. 15 /// An observable collection allowing the add of a range of items.
16 /// </summary> 16 /// </summary>
17 /// <typeparam name="T">the collection type</typeparam> 17 /// <typeparam name="T">the collection type</typeparam>
18 public class ExtendedObservableCollection<T> : ObservableCollection<T> 18 public class ExtendedObservableCollection<T> : ObservableCollection<T>
19 { 19 {
20 private bool _suppressNotification; 20 private bool _suppressNotification;
21   21  
22 protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) 22 protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
23 { 23 {
24 if (!_suppressNotification) 24 if (!_suppressNotification)
25 base.OnCollectionChanged(e); 25 base.OnCollectionChanged(e);
26 } 26 }
27   27  
28 public void AddRange(IEnumerable<T> list) 28 public void AddRange(IEnumerable<T> list)
29 { 29 {
30 if (list == null) 30 if (list == null)
31 throw new ArgumentNullException(nameof(list)); 31 throw new ArgumentNullException(nameof(list));
32   32  
33 _suppressNotification = true; 33 _suppressNotification = true;
34   34  
35 foreach (var item in list) 35 foreach (var item in list)
36 { 36 {
37 Add(item); 37 Add(item);
38 } 38 }
39 _suppressNotification = false; 39 _suppressNotification = false;
40 OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); 40 OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
41 } 41 }
42 } 42 }
43 } -  
44   43 }
-   44  
45
Generated by GNU Enscript 1.6.5.90.
-  
46   -  
47   -  
48   -