mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-14 19:49:15 +08:00
320f78b31b
1. remove this 2. auto property should be only 1 line 3. misc 4. part of refactoring for PR #494
51 lines
1.1 KiB
C#
51 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Input;
|
|
|
|
namespace Wox.ViewModel
|
|
{
|
|
public class BaseViewModel : INotifyPropertyChanged
|
|
{
|
|
|
|
protected void OnPropertyChanged(string propertyName)
|
|
{
|
|
if (null != PropertyChanged)
|
|
{
|
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
}
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
}
|
|
|
|
public class RelayCommand : ICommand
|
|
{
|
|
|
|
private Action<object> _action;
|
|
|
|
public RelayCommand(Action<object> action)
|
|
{
|
|
_action = action;
|
|
}
|
|
|
|
public virtual bool CanExecute(object parameter)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public event EventHandler CanExecuteChanged;
|
|
|
|
public virtual void Execute(object parameter)
|
|
{
|
|
if (null != _action)
|
|
{
|
|
_action(parameter);
|
|
}
|
|
}
|
|
}
|
|
}
|