// --------------------------------------------------------------------------------------------------------------------
//
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
//
//
// The queue commands.
//
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.Commands.Menu
{
using System;
using System.Windows.Input;
using HandBrakeWPF.ViewModels.Interfaces;
///
/// The queue commands.
///
public class QueueCommands : ICommand
{
///
/// Gets or sets the queue view model.
///
public IQueueViewModel QueueViewModel { get; set; }
///
/// Initializes a new instance of the class.
///
///
/// The queue View Model.
///
public QueueCommands(IQueueViewModel queueViewModel)
{
this.QueueViewModel = queueViewModel;
}
///
/// 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;
}
///
/// 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)
{
switch ((QueueCommandParams)parameter)
{
case QueueCommandParams.ClearAll:
this.QueueViewModel.Clear();
break;
case QueueCommandParams.ClearCompleted:
this.QueueViewModel.ClearCompleted();
break;
case QueueCommandParams.ClearSelected:
this.QueueViewModel.RemoveSelectedJobs();
break;
case QueueCommandParams.Import:
this.QueueViewModel.Import();
break;
case QueueCommandParams.Export:
this.QueueViewModel.Export();
break;
}
}
///
/// The can execute changed.
///
public event EventHandler CanExecuteChanged;
}
}