Exemple #1
0
        public bool Equals(CollectionEvent <T> otherEvent, SCG.IEqualityComparer <T> itemequalityComparer)
        {
            if (otherEvent == null || Act != otherEvent.Act || !object.ReferenceEquals(Sender, otherEvent.Sender))
            {
                return(false);
            }
            switch (Act)
            {
            case EventTypeEnum.None:
                break;

            case EventTypeEnum.Changed:
                return(true);

            case EventTypeEnum.Cleared:
                if (Args is ClearedRangeEventArgs)
                {
                    ClearedRangeEventArgs a = Args as ClearedRangeEventArgs, o = otherEvent.Args as ClearedRangeEventArgs;
                    if (o == null)
                    {
                        return(false);
                    }
                    return(a.Full == o.Full && a.Start == o.Start && a.Count == o.Count);
                }
                else
                {
                    if (otherEvent.Args is ClearedRangeEventArgs)
                    {
                        return(false);
                    }
                    ClearedEventArgs a = Args as ClearedEventArgs, o = otherEvent.Args as ClearedEventArgs;
                    return(a.Full == o.Full && a.Count == o.Count);
                }

            case EventTypeEnum.Added:
            {
                ItemCountEventArgs <T> a = Args as ItemCountEventArgs <T>, o = otherEvent.Args as ItemCountEventArgs <T>;
                return(itemequalityComparer.Equals(a.Item, o.Item) && a.Count == o.Count);
            }

            case EventTypeEnum.Removed:
            {
                ItemCountEventArgs <T> a = Args as ItemCountEventArgs <T>, o = otherEvent.Args as ItemCountEventArgs <T>;
                return(itemequalityComparer.Equals(a.Item, o.Item) && a.Count == o.Count);
            }

            case EventTypeEnum.Inserted:
            {
                ItemAtEventArgs <T> a = Args as ItemAtEventArgs <T>, o = otherEvent.Args as ItemAtEventArgs <T>;
                return(a.Index == o.Index && itemequalityComparer.Equals(a.Item, o.Item));
            }

            case EventTypeEnum.RemovedAt:
            {
                ItemAtEventArgs <T> a = Args as ItemAtEventArgs <T>, o = otherEvent.Args as ItemAtEventArgs <T>;
                return(a.Index == o.Index && itemequalityComparer.Equals(a.Item, o.Item));
            }
            }
            throw new ApplicationException("Illegal Action: " + Act);
        }
Exemple #2
0
 void queue_ItemRemoved(object sender, ItemCountEventArgs <int> e)
 {
     events.Add(new KeyValuePair <Acts, int>(Acts.Remove, e.Item));
 }
Exemple #3
0
 void w_ItemRemoved(object sender, ItemCountEventArgs<int> eventArgs)
 {
     throw new NotImplementedException();
 }
Exemple #4
0
 void removed(object sender, ItemCountEventArgs <T> eventArgs)
 {
     happened.Add(new CollectionEvent <T>(EventTypeEnum.Removed, eventArgs, sender));
 }
Exemple #5
0
 void queue_ItemRemoved(object sender, ItemCountEventArgs<int> e)
 {
     events.Add(new KeyValuePair<Acts, int>(Acts.Remove, e.Item));
 }
Exemple #6
0
 private void DecrementCount(Object sender, ItemCountEventArgs <V> args)
 {
     count -= args.Count;
 }
Exemple #7
0
 private void queue_ItemAdded(object sender, ItemCountEventArgs <int> e)
 {
     events.Add(new KeyValuePair <Acts, int>(Acts.Add, e.Item));
 }
Exemple #8
0
 private void w_ItemRemoved(object sender, ItemCountEventArgs <int> eventArgs)
 {
     throw new NotImplementedException();
 }
Exemple #9
0
 private void queue_ItemRemoved(object sender, ItemCountEventArgs <int> e)
 {
     events.Add(new System.Collections.Generic.KeyValuePair <Acts, int>(Acts.Remove, e.Item));
 }
Exemple #10
0
        private int count = 0;      // Cached value count, updated by events only

        private void IncrementCount(object sender, ItemCountEventArgs <V> args)
        {
            count += args.Count;
        }
Exemple #11
0
 void queue_ItemAdded(object sender, ItemCountEventArgs<int> e)
 {
     events.Add(new C5.KeyValuePair<Acts, int>(Acts.Add, e.Item));
 }
Exemple #12
0
 private void added(object sender, ItemCountEventArgs <T> eventArgs)
 {
     happened.Add(new CollectionEvent <T>(EventType.Added, eventArgs, sender));
 }
Exemple #13
0
 /// <summary>
 /// This event is added when a sprite is added to this sprite
 /// list.
 /// </summary>
 private void OnSpriteAdded(
     object sender,
     ItemCountEventArgs <ISprite> args)
 {
     args.Item.Invalidate += OnSpriteInvalidated;
 }