private async void GO_Click(object sender, RoutedEventArgs e) { //take a picture of the person giving the order var peopleIdentified = await TakePictureAndIdentifyAsync(); var result = await WebClientAccess.Order(CommandTextBox.Text); var pins = GetAuthorizedPins(result.Entity, peopleIdentified); foreach (var pin in pins) { switch (result.Intent) { case Intent.LightOn: pin.Write(GpioPinValue.Low); break; case Intent.LightOff: pin.Write(GpioPinValue.High); break; case Intent.None: default: break; } } CommandTextBox.Text = ""; CommandTextBox.Focus(FocusState.Keyboard); }
private void Window_Loaded(object sender, RoutedEventArgs e) { CommandTextBox.Text = Command; OutputTextBox.Text = Output; CommandTextBox.Focus(); }
public UserCommandDialog(Action <string> doDommand) { m_DoCommand = doDommand; InitializeComponent(); CommandTextBox.HistoryLength = 50; // Keep a fair bit of history for user commands. // Initialize from persistent store. var history = App.ConfigData["UserCommandHistory"]; if (history != null) { CommandTextBox.SetHistory(history.Split(';')); } Loaded += delegate(object sender, RoutedEventArgs e) { CommandTextBox.Focus(); }; Closing += delegate(object sender, CancelEventArgs e) { CommandTextBox.Text = ""; CommandTextBox.Focus(); Hide(); e.Cancel = true; }; }
public MainWindow() { InitializeComponent(); DataContext = new MainWindowViewModel(); _commandFasade = new CommandFasade(DataContext as MainWindowViewModel); CommandTextBox.Focus(); }
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs eventArgs) { base.OnGotKeyboardFocus(eventArgs); if (ReferenceEquals(eventArgs.NewFocus, this)) { // Move focus to text box. (Usually only necessary when the view is focused // using the menu item or a key binding.) CommandTextBox.Focus(); } }
private void SaveButton_Click(object sender, EventArgs e) { if (CommandTextBox.Text.Contains(" ")) { MessageBox.Show("Command Must Be One Word !!!"); CommandTextBox.Focus(); return; } this.cmd.Command = CommandTextBox.Text; this.cmd.Connection = ConnectionComboBox.Text; this.cmd.Description = DescriptionTextBox.Text; this.cmd.SqlCommandText = SqlRichTextBox.Text; this.DialogResult = DialogResult.OK; }
private void TextBox_KeyUp(object sender, KeyEventArgs e) { if (e.Key != Key.Enter) { return; } var text = CommandTextBox.Text; CommandTextBox.Text = ""; DoSerialPortAction(() => { ExecuteWaitAndRead(text); }, () => { CommandTextBox.Focus(); }); }
private void SetupFocus() { SshConnectViewModel vm = (SshConnectViewModel)DataContext; if (vm.CommandInput) { CommandTextBox.Focus(FocusState.Programmatic); } else if (string.IsNullOrEmpty(vm.Username)) { UserTextBox.Focus(FocusState.Programmatic); } else if (string.IsNullOrEmpty(vm.Host)) { HostTextBox.Focus(FocusState.Programmatic); } else { Focus(FocusState.Programmatic); } }
public CPackConsole(string projectRootDirectory) { DataContext = new CPackConsoleViewModel(projectRootDirectory); Service = new CPackService(); PreviousCommands = new List <string>(); InitializeComponent(); CommandTextBox.Focus(); DialogContext = SynchronizationContext.Current; MyContext.PropertyChanged += (sender, args) => { if (args.PropertyName == "TextBoxEnabled") { Thread.Sleep(200); DialogContext.Post(val => { if (CommandTextBox.IsEnabled) { CommandTextBox.Focus(); } }, sender); } }; MyContext.Exit += MyContext_Exit; }
private void SetupFocus() { CommandTextBox.Focus(FocusState.Programmatic); }
private void ResultTextBlock_PreviewMouseLeftButtonDown(Object Sender, MouseButtonEventArgs MouseButtonEventArgs) { CommandTextBox.Focus(); }