2022-08-21 03:50:38 +03:00
|
|
|
using Eto.Forms;
|
|
|
|
|
|
|
|
namespace NAPS2.EtoForms;
|
|
|
|
|
|
|
|
public class ActionCommand : Command
|
|
|
|
{
|
2022-08-21 20:42:11 +03:00
|
|
|
public ActionCommand()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-08-21 03:50:38 +03:00
|
|
|
public ActionCommand(Action action) : base((sender, args) => action())
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public ActionCommand(Func<Task> action) : base(async (sender, args) => await action())
|
|
|
|
{
|
|
|
|
}
|
2022-11-08 03:10:10 +03:00
|
|
|
|
|
|
|
public string Text
|
|
|
|
{
|
|
|
|
get => string.IsNullOrEmpty(ToolBarText) ? MenuText : ToolBarText;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
ToolBarText = value;
|
|
|
|
MenuText = value;
|
2022-12-30 02:44:26 +03:00
|
|
|
TextChanged?.Invoke(this, EventArgs.Empty);
|
2022-11-08 03:10:10 +03:00
|
|
|
}
|
|
|
|
}
|
2022-12-30 02:44:26 +03:00
|
|
|
|
|
|
|
public event EventHandler? TextChanged;
|
2022-08-21 03:50:38 +03:00
|
|
|
}
|