/// <summary>
        /// Undo 操作。
        /// </summary>
        public void Undo()
        {
            try
            {
                IViCollectionChanged Collection = this.Collection;
                switch (this.Action)
                {
                case NotifyCollectionChangedAction.Add:
                    if (this.NewItems != null)
                    {
                        int count = this.NewItems.Count;
                        for (int i = 0; i < count; ++i)
                        {
                            Collection._RemoveAt(this.NewStartingIndex + i);
                        }
                    }
                    break;

                case NotifyCollectionChangedAction.Remove:
                    if (this.OldItems != null)
                    {
                        int count = this.OldItems.Count;
                        for (int i = 0; i < count; ++i)
                        {
                            Collection._InsertAt(this.OldStartingIndex + i, this.OldItems[i]);
                        }
                    }
                    break;

                case NotifyCollectionChangedAction.Replace:
                    if (this.OldItems != null)
                    {
                        int count = this.OldItems.Count;
                        for (int i = 0; i < count; ++i)
                        {
                            Collection._SetItem(this.OldStartingIndex + i, this.OldItems[i]);
                        }
                    }
                    break;
                }
            }
            catch (Exception ee)
            {
                Trace.WriteLine("### [" + ee.Source + "] Exception: " + ee.Message);
                Trace.WriteLine("### " + ee.StackTrace);
            }
        }
 public ViCollectionChangedEventArgs(IViCollectionChanged owner, NotifyCollectionChangedEventArgs e)
 {
     this.Owner = owner;
     this.e     = e;
 }
 /// <summary>
 /// 观察集合的元素变化。
 /// </summary>
 /// <param name="collection">集合</param>
 /// @warning 集合元素的属性变化不会被观察。
 public void ObserveCollectionChanged(IViCollectionChanged collection)
 {
     collection.CollectionChanged += item_PropertyChanged;
 }