Beispiel #1
0
        private void DisabledKeys_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (KeyStrokeCommand != null)
            {
                KeyStrokeCommand.CanExecute(DisabledKeys.ToArray());
            }
            var disabledKeyArray = (from String disabledKey in e.NewItems
                                    select disabledKey).ToArray();
            var enabledKeyArray = (from String enabledKey in e.OldItems
                                   select enabledKey).ToArray();

            switch (e.Action)
            {
            case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
                OnNewDisabledKeys(disabledKeyArray);
                break;

            case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
            case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
                OnNewEnabledKeys(enabledKeyArray);
                break;

            case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
                OnNewDisabledKeys(disabledKeyArray);
                OnNewEnabledKeys(enabledKeyArray);
                break;

            default:
            case System.Collections.Specialized.NotifyCollectionChangedAction.Move:
                break;
            }
        }
Beispiel #2
0
 private bool OnCanExecuteStringStroke(String String)
 {
     if (DisabledKeys == null)
     {
         return(true);
     }
     return(!DisabledKeys.Contains(String));
 }