そのように実装している必要があります。コンストラクターでDelegateCommand<T>
別のものを渡し、メソッドからビット単位でデリゲートとデリゲートの (&&) を返します。Func<T,bool>
CanExecute()
canExecute
canSee
public class DelegateCommand<T> : ICommand
{
private readonly Action<T> executeMethod;
private readonly Func<T, bool> canExecuteMethod;
private readonly Func<T, bool> canSeeMethod;
public DelegateCommand(Action<T> executeMethod) : this(executeMethod, null)
{}
public DelegateCommand(Action<T> executeMethod,
Func<T, bool> canExecuteMethod)
: this(executeMethod, canExecuteMethod, null)
{}
public DelegateCommand(Action<T> executeMethod,
Func<T, bool> canExecuteMethod,
Func<T, bool> canSeeMethod)
{
this.executeMethod = executeMethod;
this.canExecuteMethod = canExecuteMethod;
this.canSeeMethod = canSeeMethod;
}
...... //Other implementations here
public bool CanExecute(T parameter)
{
if (canExecuteMethod == null) return true;
return canExecuteMethod(parameter) && canSeeMethod(parameter);
}
}