/// <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;
		}