bool CanExecute(RoutedUICommand command) { TextArea textArea = this.TextArea; if (textArea == null) return false; else return command.CanExecute(null, textArea); }
private bool CanExecute(RoutedUICommand command) { TextArea textArea = this.TextArea; if (textArea == null) { return(false); } else { return(command.CanExecute(null, textArea)); } }
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())); }
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); } } } }
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); } }
bool CanExecute(RoutedUICommand command) { return(command.CanExecute(null, textArea)); }