2024-08-25 00:11:31 -07:00
|
|
|
using System;
|
|
|
|
using System.Windows.Input;
|
|
|
|
using Avalonia.Controls;
|
|
|
|
|
|
|
|
namespace SourceGit
|
|
|
|
{
|
|
|
|
public partial class App
|
|
|
|
{
|
2024-09-02 05:27:12 -07:00
|
|
|
public class Command : ICommand
|
2024-08-25 00:11:31 -07:00
|
|
|
{
|
|
|
|
public event EventHandler CanExecuteChanged
|
|
|
|
{
|
|
|
|
add { }
|
|
|
|
remove { }
|
|
|
|
}
|
|
|
|
|
2024-09-02 05:27:12 -07:00
|
|
|
public Command(Action<object> action)
|
2024-08-25 00:11:31 -07:00
|
|
|
{
|
|
|
|
_action = action;
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool CanExecute(object parameter) => _action != null;
|
|
|
|
public void Execute(object parameter) => _action?.Invoke(parameter);
|
|
|
|
|
|
|
|
private Action<object> _action = null;
|
|
|
|
}
|
2024-08-27 22:42:25 -07:00
|
|
|
|
2024-09-02 05:27:12 -07:00
|
|
|
public static readonly Command OpenPreferenceCommand = new Command(_ => OpenDialog(new Views.Preference()));
|
|
|
|
public static readonly Command OpenHotkeysCommand = new Command(_ => OpenDialog(new Views.Hotkeys()));
|
|
|
|
public static readonly Command OpenAppDataDirCommand = new Command(_ => Native.OS.OpenInFileManager(Native.OS.DataDir));
|
|
|
|
public static readonly Command OpenAboutCommand = new Command(_ => OpenDialog(new Views.About()));
|
|
|
|
public static readonly Command CheckForUpdateCommand = new Command(_ => Check4Update(true));
|
|
|
|
public static readonly Command QuitCommand = new Command(_ => Quit(0));
|
|
|
|
public static readonly Command CopyTextBlockCommand = new Command(p => CopyTextBlock(p as TextBlock));
|
2024-08-25 00:11:31 -07:00
|
|
|
}
|
|
|
|
}
|