mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-23 08:27:58 +08:00
6514712054
* Should be last stylecop change! * two more tweaks
36 lines
806 B
C#
36 lines
806 B
C#
// Copyright (c) Microsoft Corporation
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using System;
|
|
using System.Windows.Input;
|
|
|
|
namespace PowerLauncher.ViewModel
|
|
{
|
|
public class RelayCommand : ICommand
|
|
{
|
|
private readonly Action<object> _action;
|
|
|
|
public RelayCommand(Action<object> action)
|
|
{
|
|
_action = action;
|
|
}
|
|
|
|
public virtual bool CanExecute(object parameter)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public event EventHandler CanExecuteChanged
|
|
{
|
|
add { }
|
|
remove { }
|
|
}
|
|
|
|
public virtual void Execute(object parameter)
|
|
{
|
|
_action?.Invoke(parameter);
|
|
}
|
|
}
|
|
}
|