34 lines
870 B
Plaintext
34 lines
870 B
Plaintext
|
|
using DTS.Common.Interface.Menu.HamburgerMenu;
|
||
|
|
using System;
|
||
|
|
using System.Windows.Input;
|
||
|
|
|
||
|
|
namespace HamburgerMenu.Model
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// this is a simple menu command handler that just notifies when the command is executed
|
||
|
|
/// </summary>
|
||
|
|
public class MenuCommand : ICommand
|
||
|
|
{
|
||
|
|
public event EventHandler CanExecuteChanged;
|
||
|
|
|
||
|
|
public bool CanExecute(object parameter)
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Execute(object parameter)
|
||
|
|
{
|
||
|
|
MenuItemPressed?.Invoke(Id);
|
||
|
|
}
|
||
|
|
|
||
|
|
private readonly MenuItemPressedDelegate MenuItemPressed;
|
||
|
|
private readonly string Id;
|
||
|
|
|
||
|
|
public MenuCommand(string id, MenuItemPressedDelegate menuItemPressed)
|
||
|
|
{
|
||
|
|
Id = id;
|
||
|
|
MenuItemPressed = menuItemPressed;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|