Skip to content

danielcirket/DelegateCommands

Repository files navigation

#Delegate Command Implementations

Examples:

ICommand:

public ICommand MyCommand { get; protected set; }

MyCommand = new DelegateCommand(x => MyAction());
MyCommand = new DelegateCommand(x => MyAction(), y => CanExecute());

MyCommand = new DelegateCommand<T>(x => MyActionWithParameter(x));
MyCommand = new DelegateCommand<T>(x => MyActionWithParameter(x), y => CanExecute());
private void MyAction()
{
    // Do stuff
}

private void MyActionWithParameter(T param)
{
    // Do stuff
}

IAwaitableCommand:

public IAwaitableCommand MyAwaitableCommand { get; protected set; }

MyAwaitableCommand = new AwaitableDelegateCommand(x => MyAction());
MyAwaitableCommand = new AwaitableDelegateCommand(x => MyAction(), y => CanExecute());

MyAwaitableCommand = new AwaitableDelegateCommand<T>(x => MyActionWithParameter(x));
MyAwaitableCommand = new AwaitableDelegateCommand<T>(x => MyActionWithParameter(x), y => CanExecute());
private Task MyAction()
{
    await SomeAsyncStuff();
}

private Task MyActionWithParameter(T param)
{
    await SomeAsyncStuff(param);
}

About

ICommand Implementations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages