博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
实现Icommand接口
阅读量:4324 次
发布时间:2019-06-06

本文共 1065 字,大约阅读时间需要 3 分钟。

public class RelayCommand : ICommand    {        private Action _execute;        private Predicate _canExecute;        public event EventHandler CanExecuteChanged        {            add            {                CommandManager.RequerySuggested += value;            }            remove            {                CommandManager.RequerySuggested -= value;            }        }        public RelayCommand(Action execute) : this(execute, null)        {        }        public RelayCommand(Action execute, Predicate canExecute)        {            if (execute == null)            {                throw new ArgumentNullException("execute");            }            this._execute = execute;            this._canExecute = canExecute;        }        [DebuggerStepThrough]        public bool CanExecute(object parameter)        {            return this._canExecute == null || this._canExecute(parameter);        }        public void Execute(object parameter)        {            this._execute(parameter);        }    }

 

转载于:https://www.cnblogs.com/z-huan/p/7541515.html

你可能感兴趣的文章
生产订单“生产线别”带入生产入库单
查看>>
crontab导致磁盘空间满问题的解决
查看>>
java基础 第十一章(多态、抽象类、接口、包装类、String)
查看>>
Hadoop 服务器配置的副本数量 管不了客户端
查看>>
欧建新之死
查看>>
C程序之修改Windows的控制台颜色(转载)
查看>>
自定义滚动条
查看>>
[QT][待解决问题]对话框ui载入卡顿问题
查看>>
jquery中单选选中及清除选中状态
查看>>
APP开发手记01(app与web的困惑)
查看>>
笛卡尔遗传规划Cartesian Genetic Programming (CGP)简单理解(1)
查看>>
mysql 日期时间运算函数(转)
查看>>
初识前端作业1
查看>>
为啥程序会有bug?
查看>>
跨域技术
查看>>
JS里的居民们7-对象和数组转换
查看>>
计算两个日期的时间间隔,返回的是时间间隔的日期差的绝对值.
查看>>
python初体验
查看>>
配置vue,vue脚手架的应用(老版本)
查看>>
Start with PJSIP on windows
查看>>