- tweak: Search think
This commit is contained in:
28
Nebula.Launcher/Utils/DelegateCommand.cs
Normal file
28
Nebula.Launcher/Utils/DelegateCommand.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
using Nebula.Launcher.ViewModels;
|
||||
|
||||
namespace Nebula.Launcher.Utils;
|
||||
|
||||
public class DelegateCommand<T> : ICommand
|
||||
{
|
||||
private readonly Action<T> _func;
|
||||
public readonly Ref<T> TRef = new();
|
||||
|
||||
public DelegateCommand(Action<T> func)
|
||||
{
|
||||
_func = func;
|
||||
}
|
||||
|
||||
public bool CanExecute(object? parameter)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Execute(object? parameter)
|
||||
{
|
||||
_func(TRef.Value);
|
||||
}
|
||||
|
||||
public event EventHandler? CanExecuteChanged;
|
||||
}
|
||||
6
Nebula.Launcher/Utils/Ref.cs
Normal file
6
Nebula.Launcher/Utils/Ref.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Nebula.Launcher.Utils;
|
||||
|
||||
public class Ref<T>
|
||||
{
|
||||
public T Value = default!;
|
||||
}
|
||||
Reference in New Issue
Block a user