private void Detach() { if (_attached) { var binder = CommandBindingManager.FindBinder(SourceObject as IComponent); binder.Dettach(Command, SourceObject, _sourceEvent); } }
private void Attach() { if (!_attached && Command != null && _validEvent) { var binder = CommandBindingManager.FindBinder(SourceObject as IComponent); binder.Attach(Command, SourceObject, _sourceEvent); _attached = true; } }
/// <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; }