Exemplo n.º 1
0
 private void UpdateCanExecute()
 {
     if (this.Command != null)
     {
         this.CanExecute = CommandHelpers.CanExecuteCommandSource(this);
     }
     else
     {
         this.CanExecute = true;
     }
 }
Exemplo n.º 2
0
        private void UnhookCommand(ICommand command)
        {
#if NET4
            var handler = CommandHelpers.GetCanExecuteChangedHandler(this);
            if (handler != null)
            {
                command.CanExecuteChanged -= handler;
                CommandHelpers.SetCanExecuteChangedHandler(this, null);
            }
#else
            CanExecuteChangedEventManager.RemoveHandler(command, new EventHandler <EventArgs>(this.OnCanExecuteChanged));
#endif
            this.UpdateCanExecute();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Executes the command which can be set by the user.
 /// </summary>
 public void RaiseCommand()
 {
     CommandHelpers.ExecuteCommandSource((ICommandSource)this);
 }