// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // A Command to handle the Preset Menu Clicks. // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Commands { using System; using System.Windows.Input; using Caliburn.Micro; using HandBrakeWPF.Services.Presets.Model; using HandBrakeWPF.ViewModels.Interfaces; /// /// The preset menu select command. /// public class PresetMenuSelectCommand : ICommand { private readonly Preset preset; /// /// Initializes a new instance of the class. /// /// /// The preset. /// public PresetMenuSelectCommand(Preset preset) { this.preset = preset; } /// 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) { IMainViewModel mvm = IoC.Get(); mvm.PresetSelect(this.preset); } /// /// The can execute changed. /// public event EventHandler CanExecuteChanged; } }