private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         Close();
     }
     if (e.Key == Key.Enter)
     {
         EnsureButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
     }
 }
 private void CommunicationsettingParamsDialog_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         EnsureButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
     }
     else
     {
         if (e.Key == Key.Escape)
         {
             CancelButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
         }
     }
 }
 private void Window_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         EnsureButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
     }
     else
     {
         if (e.Key == Key.Escape)
         {
             CancelButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
         }
     }
 }
 private void OnWindowKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         this.Close();
     }
     if (e.Key == Key.Enter)
     {
         if (CollectionSource.Count() != 0)
         {
             Label label = CollectionStack.SelectItem;
             if (label != null)
             {
                 if (label.Content as string != oldText)
                 {
                     InstructionInputTextBox.Tag = "true";
                     string[] words = InstructionInputTextBox.Text.Split(' ');
                     words[words.Length - 1]      = label.Content as string;
                     InstructionInputTextBox.Text = words[0];
                     for (int i = 1; i < words.Length; i++)
                     {
                         InstructionInputTextBox.Text += " " + words[i];
                     }
                     InstructionInputTextBox.SelectionStart = InstructionInputTextBox.Text.Length;
                     //InstructionInputTextBox.Text = label.Content as string;
                 }
                 else
                 {
                     ResetStatus(label);
                 }
             }
         }
         else
         {
             EnsureButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
         }
     }
 }