public void BindCommand(IRibbonButtonToolCommand command, object viewModel)
 {
     this.adaptedCommand = command;
     command.ExecuteIfInstanceIsOfType<INotifyPropertyChanged>(inpc => inpc.PropertyChanged += this.HandlePropertyChanged);
     viewModel.ExecuteIfInstanceIsOfType<INotifyPropertyChanged>(inpc => inpc.PropertyChanged += this.HandlePropertyChanged);
     this.UpdateCanExecute();
 }
 public void BindCommand(IRibbonButtonToolCommand command, object viewModel)
 {
     this.adaptedCommand = command;
     command.ExecuteIfInstanceIsOfType <INotifyPropertyChanged>(inpc => inpc.PropertyChanged   += this.HandlePropertyChanged);
     viewModel.ExecuteIfInstanceIsOfType <INotifyPropertyChanged>(inpc => inpc.PropertyChanged += this.HandlePropertyChanged);
     this.UpdateCanExecute();
 }
        public void UnbindCommand(object viewModel)
        {
            viewModel.ExecuteIfInstanceIsOfType<INotifyPropertyChanged>(inpc => inpc.PropertyChanged -= this.HandlePropertyChanged);
            this.adaptedCommand.ExecuteIfInstanceIsOfType<INotifyPropertyChanged>(inpc => inpc.PropertyChanged -= this.HandlePropertyChanged);

            this.CanExecute = false;

            this.adaptedCommand = null;
        }
        public void UnbindCommand(object viewModel)
        {
            viewModel.ExecuteIfInstanceIsOfType <INotifyPropertyChanged>(inpc => inpc.PropertyChanged           -= this.HandlePropertyChanged);
            this.adaptedCommand.ExecuteIfInstanceIsOfType <INotifyPropertyChanged>(inpc => inpc.PropertyChanged -= this.HandlePropertyChanged);

            this.CanExecute = false;

            this.adaptedCommand = null;
        }
 public void WireExecute(IRibbonButtonToolCommand command)
 {
     Message.SetAttach(this.buttonTool, ActionName);
     Action.SetTarget(this.buttonTool, command);
 }