// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // Interaction logic for ShellView.xaml // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Views { using System.Windows; using System.Windows.Input; using HandBrake.ApplicationServices.Utilities; using HandBrakeWPF.Commands; using HandBrakeWPF.ViewModels.Interfaces; /// /// Interaction logic for ShellView.xaml /// public partial class ShellView : Window { /// /// Initializes a new instance of the class. /// public ShellView() { this.InitializeComponent(); // Start Encode (Ctrl+S) // Stop Encode (Ctrl+K) // Open Log Window (Ctrl+L) // Open Queue Window (Ctrl+Q) // Add to Queue (Ctrl+A) // Scan a File (Ctrl+F) // Scan a Folder (Ctrl+R) this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.S, ModifierKeys.Control)), new KeyGesture(Key.S, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.K, ModifierKeys.Control)), new KeyGesture(Key.K, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.L, ModifierKeys.Control)), new KeyGesture(Key.L, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.Q, ModifierKeys.Control)), new KeyGesture(Key.Q, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.A, ModifierKeys.Control)), new KeyGesture(Key.A, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.F, ModifierKeys.Control)), new KeyGesture(Key.F, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.R, ModifierKeys.Control)), new KeyGesture(Key.R, ModifierKeys.Control))); // Enable Windows 7 Taskbar progress indication. if (this.TaskbarItemInfo == null) { this.TaskbarItemInfo = Win7.WindowsTaskbar; } } /// /// Check with the user before closing. /// /// /// The CancelEventArgs. /// protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { IShellViewModel shellViewModel = this.DataContext as IShellViewModel; if (shellViewModel != null) { bool canClose = shellViewModel.CanClose(); if (!canClose) { e.Cancel = true; } } base.OnClosing(e); } } }