The region navigation mechanism of Prism is a very powerful and flexible mechanism for navigating between views in a region.
Unfortunately, the region navigation mechanism of Prism only supports synchronous navigation between views. Sometimes however,it is necessary that some asynchronous code is executed during the navigation from one view to another. An example is a wizard where
between two wizard steps an asynchronous web service call has to be performed to validate input or to process some data.
To overcome this limitation, I've created the IAsyncNavigationAware interface and corresponding ASyncRegionNavigationService. Similar to Prism's IConfirmNavigationRequest interface (which does execute asynchronously), the interface uses continuations to
proceed the navigation process:
public interface IAsyncNavigationAware
void NavigateTo(NavigationContext navigationContext, Action continuationCallback);
bool IsNavigationTarget(NavigationContext navigationContext);
void NavigateFrom(NavigationContext navigationContext, Action continuationCallback);
As you can see, this interface uses continuations for the two navigation actions. This way, asynchronous code can be executed when navigating to or navigating from a view/viewmodel and when this code completes, calling continuationCallback() will continue
the navigation process.
I've also created the IConfirmAsyncNavigationRequest interface which is similar to IConfirmNavigationRequest but now derives from IAsyncNavigationAware.
I've also created the AsyncNavigationAwareBehavior region behavior which takes care of attaching the RegionAsyncNavigationService to your regions.
Please let me know if anyone is interested or if this can perhaps added to the source code of Prism.