示例#1
0
		bool CanExecute(RoutedUICommand command)
		{
			TextArea textArea = this.TextArea;
			if (textArea == null)
				return false;
			else
				return command.CanExecute(null, textArea);
		}
示例#2
0
        private bool CanExecute(RoutedUICommand command)
        {
            TextArea textArea = this.TextArea;

            if (textArea == null)
            {
                return(false);
            }
            else
            {
                return(command.CanExecute(null, textArea));
            }
        }
示例#3
0
 static Menu FromWpfCommand(RoutedUICommand command)
 {
     return(Menu.Item(command.Text, Observable
                      .FromEventPattern(command, "CanExecuteChanged")
                      .Select(_ => Unit.Default)
                      .StartWith(Unit.Default)
                      .Select(_ => command.CanExecute(null, null))
                      .DistinctUntilChanged()
                      .Switch(canExecute => Command.Create(
                                  isEnabled: canExecute,
                                  action: () => command.Execute(null, null))),
                      hotkey: command.InputGestures.ToHotKey()));
 }
示例#4
0
 public sealed override void ActivateItem(RoutedEventArgs e)
 {
     ActivateItemInternal(e);
     if (!e.Handled)
     {
         var asmList   = GetNode <AssemblyListTreeNode>(this);
         var inputElem = asmList == null ? null : asmList.OwnerTreeView as IInputElement;
         if (inputElem != null)
         {
             if (TreeNodeActivatedEvent.CanExecute(this, inputElem))
             {
                 TreeNodeActivatedEvent.Execute(this, inputElem);
             }
         }
     }
 }
示例#5
0
 public bool ExecuteCommand(string name, string argument = "")
 {
     if (Commands.ContainsKey(name))
     {
         RoutedUICommand command = Commands[name];
         bool            ok      = command.CanExecute(argument, Target);
         if (ok)
         {
             command.Execute(argument, Target);
         }
         return(ok);
     }
     else
     {
         return(false);
     }
 }
示例#6
0
 bool CanExecute(RoutedUICommand command)
 {
     return(command.CanExecute(null, textArea));
 }