aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Scripting/Tango.Scripting/Properties/AssemblyInfo.cs
Path not found
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);
            }
        }
    }
}