Пример #1
0
 // Control window visibility using keyboard
 private void CommandLine_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         Visibility = Visibility.Collapsed;
         e.Handled  = true;
     }
     else if (e.Key == Key.Enter && Input.IsKeyboardFocused)
     {
         InitiateCommand();
         e.Handled = true;
     }
     else if (e.Key == Key.Up)
     {
         _commandHistory.SetToNextNode();
         Input.Text = _commandHistory.CurrentNode;
         e.Handled  = true;
     }
     else if (e.Key == Key.Down)
     {
         _commandHistory.SetToPreviousNode();
         Input.Text = _commandHistory.CurrentNode;
     }
 }