Exemplo n.º 1
0
        RemoveItem(int index)
        {
            EventHandler <SetChangedEventArgs <T> > handler = OnSetChanged;

            if (handler == null)
            {
                base.RemoveItem(index);
            }
            else
            {
                handler(this, SetChangedEventArgs <T> .Removed(base[index], index));
                base.RemoveItem(index);
                for (int i = index; i < Count; i++)
                {
                    handler(this, SetChangedEventArgs <T> .Moved(base[i], i + 1, i));
                }
            }
        }
Exemplo n.º 2
0
        protected override void InsertItem(int index, T item)
        {
            EventHandler <SetChangedEventArgs <T> > handler = OnSetChanged;

            if (handler == null)
            {
                base.InsertItem(index, item);
            }
            else
            {
                base.InsertItem(index, item);
                handler(this, SetChangedEventArgs <T> .Added(item, index));
                for (int i = index + 1; i < base.Count; i++)
                {
                    handler(this, SetChangedEventArgs <T> .Moved(base[i], i - 1, i));
                }
            }
        }