Example #1
0
 /// <summary>Allows derived classes of AListNode to fire the AListBase.ListChanging event properly.</summary>
 protected void CallListChanging(AListBase <K, T> tree, ListChangeInfo <T> listChangeInfo)
 {
     if (tree._listChanging != null)
     {
         tree.CallListChanging(listChangeInfo);
     }
 }
Example #2
0
 private void ListChangeHandler(IDictionary <K, V> sender, ListChangeInfo <KeyValuePair <K, V> > args)
 {
     Assert.AreEqual(int.MinValue, args.Index);
     Assert.AreEqual(args.SizeChange, args.NewItems.Count - args.OldItems.Count);
     if (args.Action == NotifyCollectionChangedAction.Remove)
     {
         Assert.Less(args.SizeChange, 0);
     }
     if (args.Action == NotifyCollectionChangedAction.Add)
     {
         Assert.Greater(args.SizeChange, 0);
     }
 }
Example #3
0
        public void OnListChanging(IListSource <T> sender, ListChangeInfo <T> e)
        {
            if (_parent is IListChanging <T> )
            {
                (_parent as IListChanging <T>).OnListChanging(sender, e);
            }
            int addCount    = e.NewItems.Count;
            int removeCount = addCount - e.SizeChange;

            for (int i = e.Index; i < e.Index + removeCount; i++)
            {
                try {
                    _list[i].OnBeingRemoved(_parent);                     // could throw
                } catch {
                    // Notify earlier items that changes are being "undone"
                    for (int j = e.Index; j < i; j++)
                    {
                        try { _list[i].OnBeingAdded(_parent); } catch { }
                    }
                    throw;
                }
            }
            for (int i = 0; i < addCount; i++)
            {
                try {
                    e.NewItems[i].OnBeingAdded(_parent);                     // could throw
                } catch {
                    // Notify children that changes are being "undone"
                    for (int j = 0; j < i; j++)
                    {
                        try { e.NewItems[j].OnBeingRemoved(_parent); } catch { }
                    }
                    for (int j = e.Index; j < e.Index + removeCount; j++)
                    {
                        try { _list[i].OnBeingAdded(_parent); } catch { }
                    }
                    throw;
                }
            }
        }
Example #4
0
 void IListChanging <LLShapeLayer> .OnListChanging(IListSource <LLShapeLayer> sender, ListChangeInfo <LLShapeLayer> e)
 {
     Invalidate();
 }
Example #5
0
 public new void OnListChanging(IListSource <T> sender, ListChangeInfo <T> e)
 {
     base.OnListChanging(sender, e);
     _parent.OnListChanging(sender, e);
 }