Example #1
0
 protected override int FindIndex(object item, object seed, IComparer <object> comparer, int low, int high)
 {
     System.ComponentModel.IEditableCollectionView editableCollectionView = this.view as System.ComponentModel.IEditableCollectionView;
     if (editableCollectionView != null && editableCollectionView.IsAddingNew)
     {
         --high;
     }
     return(base.FindIndex(item, seed, comparer, low, high));
 }
 void SCM.IEditableCollectionView.RemoveAt(int index)
 {
     SCM.IEditableCollectionView proxiedView = this.ProxiedView as SCM.IEditableCollectionView;
     if (proxiedView == null)
     {
         throw new InvalidOperationException("RemoveAt is not allowed for view");
     }
     proxiedView.RemoveAt(index);
 }
 void SCM.IEditableCollectionView.EditItem(object item)
 {
     SCM.IEditableCollectionView proxiedView = this.ProxiedView as SCM.IEditableCollectionView;
     if (proxiedView == null)
     {
         throw new InvalidOperationException("EditItem is not allowed for view");
     }
     proxiedView.EditItem(item);
 }
 void SCM.IEditableCollectionView.CommitNew()
 {
     SCM.IEditableCollectionView proxiedView = this.ProxiedView as SCM.IEditableCollectionView;
     if (proxiedView == null)
     {
         throw new InvalidOperationException("CommitNew is not allowed for view");
     }
     proxiedView.CommitNew();
 }
 object SCM.IEditableCollectionView.AddNew()
 {
     SCM.IEditableCollectionView proxiedView = this.ProxiedView as SCM.IEditableCollectionView;
     if (proxiedView == null)
     {
         throw new InvalidOperationException("AddNew is not allowed for view");
     }
     return(proxiedView.AddNew());
 }
 public virtual void Refresh()
 {
     SCM.IEditableCollectionView editableCollectionView = this as SCM.IEditableCollectionView;
     if (editableCollectionView != null && (editableCollectionView.IsAddingNew || editableCollectionView.IsEditingItem))
     {
         throw new InvalidOperationException("CollectionView_Member NotAllowed During Refresh");
     }
     else
     {
         this.RefreshInternal();
     }
 }
 public virtual IDisposable DeferRefresh()
 {
     SCM.IEditableCollectionView editableCollectionView = this as SCM.IEditableCollectionView;
     if (editableCollectionView != null && (editableCollectionView.IsAddingNew || editableCollectionView.IsEditingItem))
     {
         throw new InvalidOperationException("CollectionView_Member NotAllowed During DeferRefresh");
     }
     else
     {
         ++this.deferLevel;
         return((IDisposable) new CollectionView.DeferHelper(this));
     }
 }
        public virtual bool MoveCurrentTo(object item)
        {
            this.VerifyRefreshNotDeferred();
            if (object.Equals(this.CurrentItem, item) && (item != null || this.IsCurrentInView))
            {
                return(this.IsCurrentInView);
            }
            int position = -1;

            SCM.IEditableCollectionView editableCollectionView = this as SCM.IEditableCollectionView;
            if ((editableCollectionView != null && editableCollectionView.IsAddingNew && object.Equals(item, editableCollectionView.CurrentAddItem)) || item == null || this.PassesFilter(item))
            {
                position = this.IndexOf(item);
            }
            return(this.MoveCurrentToPosition(position));
        }