Search code examples
catel

Catel's AsynchronousCommand correct usage


I've to call an async Task using a command. I tought that AsynchronousCommand would have done the trick but it accepts an Action as method so I've to use something as

public async void Something(object args)

would it be supposed to accept a Task on Command's definition?

UPDATE #1

Used TaskCommand as suggested by @Geert


Solution

  • Async void is very bad, because it cannot be awaited (meaning you can cause a lot of issues). Either use async Task ExecuteAsync or void Execute.