Пример #1
0
 private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         if (_viewModel.Dialog.IsVisible)
         {
             _viewModel.Dialog.IsVisible = false;
         }
         else
         {
             _viewModel.BeginClose();
         }
     }
     else
     {
         if (Keyboard.Modifiers == ModifierKeys.Alt && e.SystemKey == Key.Space)
         {
             e.Handled = true;
         }
         else
         {
             KeyboardNavigator.OnKeyDown(this, ref e);
         }
     }
 }
Пример #2
0
 private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         if (_viewModel.IsShowingModalDialog)
         {
             _viewModel.CollapseApp();
         }
         else
         {
             _viewModel.BeginClose();
         }
     }
     else
     {
         KeyboardNavigator.OnKeyDown(this, ref e);
     }
 }
Пример #3
0
 private void FullWindow_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         if (ViewModel.Dialog.IsVisible)
         {
             ViewModel.Dialog.IsVisible = false;
         }
         else
         {
             CloseButton_Click(null, null);
         }
     }
     else
     {
         KeyboardNavigator.OnKeyDown(this, ref e);
     }
 }