aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ControlledObservableCollection.cs
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2018-04-17 11:53:29 +0300
committerAvi Levkovich <avi@twine-s.com>2018-04-17 11:53:29 +0300
commitbfbfc3f93276421a56300f89c4906bc992a0798e (patch)
tree9c5cf287c52a52d987004f9b19456ddce0f04816 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ControlledObservableCollection.cs
parent9477ac8fff7aa1b2043a2713ea01eafde15a4458 (diff)
parenta5ec5d754dd516dfadbb34fe1b167eff817ded6e (diff)
downloadTango-bfbfc3f93276421a56300f89c4906bc992a0798e.tar.gz
Tango-bfbfc3f93276421a56300f89c4906bc992a0798e.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ControlledObservableCollection.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ControlledObservableCollection.cs49
1 files changed, 49 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ControlledObservableCollection.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ControlledObservableCollection.cs
new file mode 100644
index 000000000..e16393e83
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ControlledObservableCollection.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.MachineStudio.Logging
+{
+ public class ControlledObservableCollection<T> : ObservableCollection<T>
+ {
+ public bool DisableNotification { get; set; }
+
+ public ControlledObservableCollection() : base()
+ {
+
+ }
+
+ public ControlledObservableCollection(IEnumerable<T> collection) : base(collection)
+ {
+
+ }
+
+ protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
+ {
+ if (!DisableNotification)
+ {
+ base.OnCollectionChanged(e);
+ }
+ }
+
+ public void AddRange(IEnumerable<T> collection)
+ {
+ foreach (var item in collection)
+ {
+ Add(item);
+ }
+ }
+
+ public void InsertRange(int index, IEnumerable<T> collection)
+ {
+ foreach (var item in collection)
+ {
+ Insert(index, item);
+ }
+ }
+ }
+}