当前位置: 移动技术网 > IT编程>开发语言>.net > WPF Customize DelegateCommand

WPF Customize DelegateCommand

2019年06月11日  | 移动技术网IT编程  | 我要评论

成人小游戏下载,刺鲶,sgimeguard.exe

public class delcmd : icommand
{
private readonly predicate<object> _canexecute;
private readonly action<object> _execute;

public event eventhandler canexecutechanged
{
add { commandmanager.requerysuggested += value; }
remove { commandmanager.requerysuggested -= value; }
}

public delcmd(action<object> execute):this(execute,null)
{

}

public delcmd(action<object> execute,predicate<object> canexecute)
{
_execute = execute;
_canexecute = canexecute;
}
public bool canexecute(object parameter)
{
if(_canexecute==null)
{
return true;
}
return _canexecute(parameter);
}

public void execute(object parameter)
{
_execute(parameter);
}

}

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网