Ejemplo n.º 1
0
 /// <summary>
 /// 指令框按键按下事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void InstructionTextBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter && "" != InstructionTextBox.Text)
     {
         e.Handled = true;
         if (!constInstructionInputMode)
         {
             new Thread(() => { InstructionTextBox.Dispatcher.BeginInvoke((Action)(() => ExecuteTextBoxInstrution())); }).Start();
         }
         else
         {
             e.Handled = false; Resize(true, 12, 500); InstructionTextBox.Height = 500; InstructionTextBox.MaxLines = 500;
         }
         return;
     }
     if (e.Key == Key.Enter && "" == InstructionTextBox.Text)
     {
         Visibility = Visibility.Hidden; showOutput = false; Resize();
     }
     if (e.Key == Key.Escape)
     {
         Visibility = Visibility.Hidden; showOutput = false; Resize();
     }
     if (e.KeyboardDevice.Modifiers == ModifierKeys.Alt)
     {
         e.Handled = true; showOutput = !showOutput; Resize(); return;
     }
     if (e.Key == Key.Tab)
     {
         e.Handled = true;
         if (InstructionTextBox.Text[InstructionTextBox.Text.Length - 1] != ' ')
         {
             completing = true; InstructionTextBox.AppendText(" "); completing = false;
         }
         InstructionTextBox.CaretIndex = InstructionTextBox.Text.Length;
     }
 }