private void OnAfterCollectionChaneg(ReportingCollectionEventArgs e) { if (AfterCollectionChanged == null) { return; } AfterCollectionChanged(this, e); }
private void OnBeforeCollectionChaneg(ReportingCollectionEventArgs e) { if (BeforeCollectionChange == null) { return; } BeforeCollectionChange(this, e); }
public bool Remove(T item) { ReportingCollectionEventArgs e = new ReportingCollectionEventArgs(item, ReportingCollectionAction.Remove); OnBeforeCollectionChaneg(e); if (e.Cancel) { return(false); } return(items.Remove(item)); }
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); }
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); }
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); }
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); }
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); } }