예제 #1
0
        public TValue this[TKey key] {
            get { return(_dictionary[key]); }
            set {
                ChangedAction action = ContainsKey(key) ? ChangedAction.Update : ChangedAction.Add;

                _dictionary[key] = value;
                OnChanged(new ChangedEventArgs <KeyValuePair <TKey, TValue> >(new KeyValuePair <TKey, TValue>(key, value), action));
            }
        }
예제 #2
0
        public override void Process(Player player, object value)
        {
            int previous = SelectedIndex;

            base.Process(player, value);
            if (SelectedIndex != previous)
            {
                PropInfo.SetValue(Target, Enum.ToObject(typeof(TEnumType), (int)SelectedIndex), null);
                ChangedAction?.Invoke();
            }
        }
예제 #3
0
        internal CollectionReceivedEventArgs(ChangedAction action, IEnumerable <T> data)
        {
            Action = action.ToClientValue();
            var ary = data.ToArray();

#if NETSTANDARD1_5
            Data = ary;
#else
            Data = Array.AsReadOnly(ary);
#endif
        }
        public static NotifyCollectionChangedAction ToClientValue(this ChangedAction v)
        {
            switch (v)
            {
            case ChangedAction.Add:
                return(NotifyCollectionChangedAction.Add);

            case ChangedAction.Remove:
                return(NotifyCollectionChangedAction.Remove);

            case ChangedAction.Replace:
                return(NotifyCollectionChangedAction.Replace);

            case ChangedAction.Reset:
            default:
                return(NotifyCollectionChangedAction.Reset);
            }
        }
예제 #5
0
 public DataItemEventArgs(T item, ChangedAction changedAction)
 {
     this.item          = item;
     this.changedAction = changedAction;
 }
예제 #6
0
 public ChangedEventArgs(T item, ChangedAction action)
 {
     Item   = item;
     Action = action;
 }
예제 #7
0
 public CollectionChangedEvent(int index, T value, ChangedAction action)
 {
     Index       = index;
     Value       = value;
     this.Action = action;
 }
예제 #8
0
 public DictionaryChangedEventArgs(KeyValuePair <K, V> item, ChangedAction action)
 {
     Item   = item;
     Action = action;
 }