找传奇、传世资源到传世资源站!

MVVMDemo windowphone项目例子源码下载

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

MVVM模式的demo

using System;using System.Windows.Input;namespace MVVMDemo{ public class SampleCommand : ICommand { private readonly Action _execute; private readonly Func<bool> _canExecute; public SampleCommand(Action execute) : this(execute, null) { } public SampleCommand(Action execute, Func<bool> canExecute) { if (execute == null) { throw new ArgumentNullException("execute"); } this._execute = execute; if (canExecute != null) { this._canExecute = canExecute; } } public bool CanExecute(object parameter) { return this._canExecute == null ? true : this._canExecute.Invoke(); } public event EventHandler CanExecuteChanged; public void Execute(object parameter) { if (this.CanExecute(parameter) && this._execute != null) { this._execute.Invoke(); } } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复