// --------------------------------------------------------------------------------------------------------------------
//
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
//
//
// Keyboard Shortcut Processor
//
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.Commands
{
using System;
using System.Windows.Input;
using HandBrakeWPF.Helpers;
using HandBrakeWPF.ViewModels;
using HandBrakeWPF.ViewModels.Interfaces;
///
/// Keyboard Shortcut Processor
///
public class ProcessQueueShortcutCommand : ICommand
{
///
/// The Gesture
///
private readonly KeyGesture gesture;
///
/// Initializes a new instance of the class.
///
///
/// The gesture.
///
public ProcessQueueShortcutCommand(KeyGesture gesture)
{
this.gesture = gesture;
}
///
/// Defines the method to be called when the command is invoked.
///
/// Data used by the command. If the command does not require data to be passed, this object can be set to null.
public void Execute(object parameter)
{
if (gesture != null)
{
QueueViewModel vm = (QueueViewModel)IoCHelper.Get();
if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.P)
{
vm.PlayFile();
}
if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.I)
{
vm.OpenSourceDir();
}
if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D)
{
vm.OpenDestDir();
}
if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.E)
{
vm.EditSelectedJob();
}
if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.R)
{
vm.ResetSelectedJobs();
}
if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.T)
{
vm.MoveToTop();
}
if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.B)
{
vm.MoveToBottom();
}
}
}
///
/// Defines the method that determines whether the command can execute in its current state.
///
///
/// true if this command can be executed; otherwise, false.
///
/// Data used by the command. If the command does not require data to be passed, this object can be set to null.
public bool CanExecute(object parameter)
{
return true;
}
///
/// Can Execute Changed
///
public event EventHandler CanExecuteChanged { add { } remove { } }
}
}