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