public void Clear() { this.peds.Clear(); if (this.ListChanged == null) { ListChangedEvent listChanged = this.ListChanged; } else { this.ListChanged(this); } }
public void Add(PedData item) { this.peds.Add(item); if (this.ListChanged == null) { ListChangedEvent listChanged = this.ListChanged; } else { this.ListChanged(this); } }
public void Add(VehicleData item) { this.vehicles.Add(item); if (this.ListChanged == null) { ListChangedEvent listChanged = this.ListChanged; } else { this.ListChanged(this); } }
public bool Remove(PedData item) { bool flag = this.peds.Remove(item); if (this.ListChanged == null) { ListChangedEvent listChanged = this.ListChanged; } else { this.ListChanged(this); } return(flag); }
/// <summary> /// Disconnects everything /// </summary> /// <remarks> /// Do not call this directly /// </remarks> public virtual void Disconnect() { if (TypeValidator.IsCompatible(parentView.GetType(), typeof(IListEvents)) == true) { (parentView as IListEvents).ElementAdded -= myAddedMethod; (parentView as IListEvents).ElementChanged -= myChangedMethod; (parentView as IListEvents).ElementRemoved -= myRemovedMethod; (parentView as IListEvents).ElementsSorted -= mySortedMethod; (parentView as IListEvents).ListChanged -= myListChangedMethod; myAddedMethod = null; myChangedMethod = null; myListChangedMethod = null; myRemovedMethod = null; mySortedMethod = null; } parentView = null; }
public BaseGenericClientObservableListView(IList <T> aParentView) { if (aParentView == null) { throw new NullReferenceException("Parent view can't be null"); } parentView = aParentView; if (TypeValidator.IsCompatible(parentView.GetType(), typeof(IListEvents)) == true) { myAddedMethod = new ElementAddedInListObjectEvent(ElementAddedIntoMaster); myChangedMethod = new ElementChangedInListObjectEvent(ElementChangedInMaster); myListChangedMethod = new ListChangedEvent(MasterListChanged); myRemovedMethod = new ElementRemovedFromListObjectEvent(ElementRemovedFromMaster); mySortedMethod = new ElementsInListSortedEvent(ElementsSortedInMaster); (parentView as IListEvents).ElementAdded += myAddedMethod; (parentView as IListEvents).ElementChanged += myChangedMethod; (parentView as IListEvents).ElementRemoved += myRemovedMethod; (parentView as IListEvents).ElementsSorted += mySortedMethod; (parentView as IListEvents).ListChanged += myListChangedMethod; } }
public BaseClientObservableListView (IList aParentView) { if (aParentView == null) throw new NullReferenceException ("Parent view can't be null"); parentView = aParentView; if (TypeValidator.IsCompatible(parentView.GetType(), typeof(IListEvents)) == true) { myAddedMethod = new ElementAddedInListObjectEvent (ElementAddedIntoMaster); myChangedMethod = new ElementChangedInListObjectEvent (ElementChangedInMaster); myListChangedMethod = new ListChangedEvent (MasterListChanged); myRemovedMethod = new ElementRemovedFromListObjectEvent (ElementRemovedFromMaster); mySortedMethod = new ElementsInListSortedEvent (ElementsSortedInMaster); (parentView as IListEvents).ElementAdded += myAddedMethod; (parentView as IListEvents).ElementChanged += myChangedMethod; (parentView as IListEvents).ElementRemoved += myRemovedMethod; (parentView as IListEvents).ElementsSorted += mySortedMethod; (parentView as IListEvents).ListChanged += myListChangedMethod; } }
/// <summary> /// Disconnects everything /// </summary> /// <remarks> /// Do not call this directly /// </remarks> public virtual void Disconnect () { if (parentView != null && TypeValidator.IsCompatible(parentView.GetType(), typeof(IListEvents)) == true) { (parentView as IListEvents).ElementAdded -= myAddedMethod; (parentView as IListEvents).ElementChanged -= myChangedMethod; (parentView as IListEvents).ElementRemoved -= myRemovedMethod; (parentView as IListEvents).ElementsSorted -= mySortedMethod; (parentView as IListEvents).ListChanged -= myListChangedMethod; myAddedMethod = null; myChangedMethod = null; myListChangedMethod = null; myRemovedMethod = null; mySortedMethod = null; } parentView = null; }