Exemple #1
0
 private void Detach()
 {
     if (_attached)
     {
         var binder = CommandBindingManager.FindBinder(SourceObject as IComponent);
         binder.Dettach(Command, SourceObject, _sourceEvent);
     }
 }
Exemple #2
0
 private void Attach()
 {
     if (!_attached && Command != null && _validEvent)
     {
         var binder = CommandBindingManager.FindBinder(SourceObject as IComponent);
         binder.Attach(Command, SourceObject, _sourceEvent);
         _attached = true;
     }
 }
Exemple #3
0
 /// <summary>
 /// Verifies whether the event is valid on the source object.
 /// </summary>
 private void VerifyEventValid()
 {
     if (!_validEvent)
     {
         var binder = CommandBindingManager.FindBinder(SourceObject as IComponent);
         if (binder.InputEvents.All(evt => SourceEvent != evt))
         {
             throw new InvalidEventException();
         }
     }
     _validEvent = true;
 }
Exemple #4
0
 public CommandBindingCollection(CommandBindingManager commandBindingManager)
 {
     Debug.Assert(commandBindingManager != null);
     _commandBindingManager = commandBindingManager;
 }