private void KeyHandler(object sender, KeyEventArgs e) { ICommand command = null; if (e.Key == Key.Escape) { command = new TogleVisibilityCommand(); } else if (e.Key == Key.Enter) { string processFound = ""; foreach (string item in SearchBox.AutoSuggestionList) { if (item.StartsWith(SearchBox.Text)) { processFound = item; } } if (string.IsNullOrEmpty(processFound)) { command = new StartApplicationCommand(); } else { command = new SetFocusCommand(); } viewModelBase.TogleVisible.Execute(this); } if (command != null) { command.Execute(this); } }
public ViewModelBase() { this.MainWindow = Application.Current.MainWindow as MainWindow; TogleVisible = new TogleVisibilityCommand(); WakeUp = new WakeUpCommand(); SetFocus = new SetFocusCommand(); StartApplication = new StartApplicationCommand(); }
public bool SetFocus(string controlId, int ordinal, string parentId) { var command = new SetFocusCommand { AutomationIdentifier = CreateAutomationIdentifier(controlId), Ordinal = ordinal, ParentIdentifier = CreateAutomationIdentifier(parentId) }; var result = SyncExecuteCommand(command); return(result is SuccessResult); }
public bool SetFocus(string controlId, int ordinal, string parentId) { var command = new SetFocusCommand { AutomationIdentifier = CreateAutomationIdentifier(controlId), Ordinal = ordinal, ParentIdentifier = CreateAutomationIdentifier(parentId) }; var result = SyncExecuteCommand(command); return result is SuccessResult; }
public bool SetFocus(string controlId) { var command = new SetFocusCommand() { AutomationIdentifier = CreateAutomationIdentifier(controlId) }; var result = SyncExecuteCommand(command); return result is SuccessResult; }