Beispiel #1
0
 private void Detach()
 {
     if (_attached)
     {
         var binder = CommandBindingManager.FindBinder(SourceObject as IComponent);
         binder.Dettach(Command, SourceObject, _sourceEvent);
     }
 }
Beispiel #2
0
 private void Attach()
 {
     if (!_attached && Command != null && _validEvent)
     {
         var binder = CommandBindingManager.FindBinder(SourceObject as IComponent);
         binder.Attach(Command, SourceObject, _sourceEvent);
         _attached = true;
     }
 }
Beispiel #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;
 }
Beispiel #4
0
 public CommandBindingCollection(CommandBindingManager commandBindingManager)
 {
     Debug.Assert(commandBindingManager != null);
     _commandBindingManager = commandBindingManager;
 }