1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ShellView.xaml.cs" company="HandBrake Project (http://handbrake.fr)">
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
// </copyright>
// <summary>
// Interaction logic for ShellView.xaml
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.Views
{
using System.Windows;
using System.Windows.Input;
using HandBrakeWPF.Commands;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
/// Interaction logic for ShellView.xaml
/// </summary>
public partial class ShellView : Window
{
/// <summary>
/// Initializes a new instance of the <see cref="ShellView"/> class.
/// </summary>
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)));
}
/// <summary>
/// Check with the user before closing.
/// </summary>
/// <param name="e">
/// The CancelEventArgs.
/// </param>
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
bool canClose = ((IShellViewModel)this.DataContext).CanClose();
if (!canClose)
{
e.Cancel = true;
}
base.OnClosing(e);
}
}
}
|