From e66cd269ad02302f2a5a4ec377112cd61789647e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 16 Apr 2018 17:45:25 +0300 Subject: Application Logs & Embedded Logs on Logging Module! --- .../ControlledObservableCollection.cs | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ControlledObservableCollection.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ControlledObservableCollection.cs') 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 : ObservableCollection + { + public bool DisableNotification { get; set; } + + public ControlledObservableCollection() : base() + { + + } + + public ControlledObservableCollection(IEnumerable collection) : base(collection) + { + + } + + protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) + { + if (!DisableNotification) + { + base.OnCollectionChanged(e); + } + } + + public void AddRange(IEnumerable collection) + { + foreach (var item in collection) + { + Add(item); + } + } + + public void InsertRange(int index, IEnumerable collection) + { + foreach (var item in collection) + { + Insert(index, item); + } + } + } +} -- cgit v1.3.1