Will caliburn.micro do the right thing with async method on ViewModel?

The support of asynchronous programming model in Caliburn.Micro is pretty good now.

Few things you can do:

  • Use async/await in Action method. Be careful, as action methods are technically event handlers, you shoud do async void rather than async Task.
  • Asynchronous event handlers for Screen's events, like Activated, ViewLoaded and other.
  • Asynchronous overrides for Screen's methods: OnInitialize, OnActivate, ... You can override then as protected override async void OnInitialize(){} and inside you can await another task.
  • Convert Coroutines to Tasks. Use ExecuteAsync() extension method. Coroutines still have some advantages in some scenarios, like execution context.
  • IHandleWithTask<TMessage> - pretty handy...

There's a blog post desribing some use cases with few code snippets. And a GitHub repository with sample project I've used to play with async/await in Caliburn.


The answer is 'yes', starting with Caliburn.Micro 1.5.

See release announcement.