| 123456789101112131415161718192021222324252627282930313233343536 |
- // 事件传递类,用于传递界面的事件
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Input;
- namespace MvvmScaffoldFrame48.ViewModel
- {
- public class RelayCommand : ICommand
- {
- public event EventHandler CanExecuteChanged;
- private Action<object> _Excute { get; set; }
- private Predicate<object> _CanExcute { get; set; }
- public RelayCommand(Action<object> ExcuteMethod, Predicate<object> CanExcuteMethod)
- {
- _Excute = ExcuteMethod;
- _CanExcute = CanExcuteMethod;
- }
- public bool CanExecute(object parameter)
- {
- return _CanExcute(parameter);
- }
- public void Execute(object parameter)
- {
- _Excute(parameter);
- }
- }
- }
|