コード例 #1
0
 private void OnAfterCollectionChaneg(ReportingCollectionEventArgs e)
 {
     if (AfterCollectionChanged == null)
     {
         return;
     }
     AfterCollectionChanged(this, e);
 }
コード例 #2
0
 private void OnBeforeCollectionChaneg(ReportingCollectionEventArgs e)
 {
     if (BeforeCollectionChange == null)
     {
         return;
     }
     BeforeCollectionChange(this, e);
 }
コード例 #3
0
        public bool Remove(T item)
        {
            ReportingCollectionEventArgs e = new ReportingCollectionEventArgs(item, ReportingCollectionAction.Remove);

            OnBeforeCollectionChaneg(e);
            if (e.Cancel)
            {
                return(false);
            }
            return(items.Remove(item));
        }
コード例 #4
0
        public void Add(T item)
        {
            ReportingCollectionEventArgs e = new ReportingCollectionEventArgs(item, ReportingCollectionAction.Add);

            OnBeforeCollectionChaneg(e);
            if (e.Cancel)
            {
                return;
            }
            items.Add(item);
            ReportingCollectionEventArgs afterE = new ReportingCollectionEventArgs(items, ReportingCollectionAction.Add);

            OnAfterCollectionChaneg(afterE);
        }
コード例 #5
0
        public void Insert(int index, T item)
        {
            ReportingCollectionEventArgs e = new ReportingCollectionEventArgs(item, ReportingCollectionAction.Add);

            OnBeforeCollectionChaneg(e);
            if (e.Cancel)
            {
                return;
            }

            items.Insert(index, item);

            ReportingCollectionEventArgs afterE = new ReportingCollectionEventArgs(items, ReportingCollectionAction.Remove);

            OnAfterCollectionChaneg(afterE);
        }
コード例 #6
0
        public void Clear()
        {
            ReportingCollectionEventArgs e = new ReportingCollectionEventArgs(items, ReportingCollectionAction.Remove);

            OnBeforeCollectionChaneg(e);
            if (e.Cancel)
            {
                return;
            }

            items.Clear();

            ReportingCollectionEventArgs afterE = new ReportingCollectionEventArgs(items, ReportingCollectionAction.Remove);

            OnAfterCollectionChaneg(afterE);
        }
コード例 #7
0
        public void RemoveAt(int index)
        {
            ReportingCollectionEventArgs e = new ReportingCollectionEventArgs(items[index], ReportingCollectionAction.Remove);

            OnBeforeCollectionChaneg(e);
            if (e.Cancel)
            {
                return;
            }

            items.RemoveAt(index);

            ReportingCollectionEventArgs afterE = new ReportingCollectionEventArgs(items, ReportingCollectionAction.Remove);

            OnAfterCollectionChaneg(afterE);
        }
コード例 #8
0
        public T this[int index]
        {
            get { return(items[index]); }
            set
            {
                ReportingCollectionEventArgs eBefore = new ReportingCollectionEventArgs(value, ReportingCollectionAction.Edit);
                OnBeforeCollectionChaneg(eBefore);
                if (eBefore.Cancel)
                {
                    return;
                }

                items[index] = value;

                ReportingCollectionEventArgs eAfter = new ReportingCollectionEventArgs(value, ReportingCollectionAction.Edit);
                OnBeforeCollectionChaneg(eAfter);
            }
        }