Executing Coroutines on activation and deactivation

May 26, 2011 at 9:06 AM

Hello

Often you need to load some data either in initialization or activation of the view models. The coroutines are a perfect match to do this. Is there an easy way to allow to call coroutines on initialization, activation or deactivation of the view models?

 

Daniel

Coordinator
May 26, 2011 at 12:48 PM

The easiest way is to call Couroutine.BeginExecute

May 26, 2011 at 1:51 PM

Hy Rob

The problem is that with this approach we won't get access to the FrameworkElement and therefore the busy indication cannot be found. Any ideas?

Daniel

Coordinator
May 26, 2011 at 2:11 PM

You can do it in the OnViewLoad with BeginExecuteFor.

Sep 10, 2011 at 4:31 AM

How would I show a dialog from the VM's OnViewReady?

In a VM method bound to a button, I can do the following:

public IEnumerable ShowMyPopup() 
{ 
   var showMyDialog = new ShowDialog(); 
   yield return showMyDialog; 

   var myResult = showMyDialog.Dialog.Result; 
}

 

 How would I do the same thing from OnViewReady?