跳到主要内容

github/tai

公开

Tai · Windows 软件与网站使用时长统计。上游 Planshit/Tai 的源码镜像,非灵栈原创;MIT 许可。来源:https://github.com/Planshit/Tai 。本次为手动同步,暂不提供安装包。

浏览文件

Command.cs

39 行 · 886 B历史下载
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using System.Windows.Input;
7
8namespace UI.Controls
9{
10 public class Command : ICommand
11 {
12 private Action<object> _action;
13
14 public Command(Action<object> action)
15 {
16 _action = action;
17 }
18
19
20 #region ICommand Members
21 public bool CanExecute(object parameter)
22 {
23 return true;
24 }
25 public event EventHandler CanExecuteChanged;
26 public void Execute(object parameter)
27 {
28 _action(parameter);
29 OnExecuted();
30 }
31 public delegate void ExecutedHandler(object parameter);
32 public event ExecutedHandler Executed;
33 public void OnExecuted()
34 {
35 Executed?.Invoke(null);
36 }
37 #endregion
38 }
39}