diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-04-16 17:45:25 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-04-16 17:45:25 +0300 |
| commit | e66cd269ad02302f2a5a4ec377112cd61789647e (patch) | |
| tree | 3f229e2460a16e3b3383cb39e7458a19469553d2 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ControlledObservableCollection.cs | |
| parent | 53f93d7fd2d2aa4571bad6e93e0c519fce242753 (diff) | |
| download | Tango-e66cd269ad02302f2a5a4ec377112cd61789647e.tar.gz Tango-e66cd269ad02302f2a5a4ec377112cd61789647e.zip | |
Application Logs & Embedded Logs on Logging Module!
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.cs | 49 |
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); + } + } + } +} |
