ActionExecutionContext is null when running Coroutine.Execute() from ViewModel

Nov 19, 2010 at 9:11 PM

I'm trying to accomplish a very similar task to How to execute a command from a constructor , but it's not working for me.

I'm doing a charting application, and I want the chart to draw the line for the default "investment" selected in a combobox when the screen loads.  I have coroutines set up to make my web service calls, and they work when responding to a button click to draw the chart.

When I run Coroutine.Execute(DrawChart().GetEnumerator()), the coroutine runs, but the callback never triggers.  When stepping through the code, I see that the ActionExecutionContext is null when the coroutine is run in the ViewModel's OnActivate(), OnViewLoaded(object view), or the Investment setter method.  For the life of me I can't figure out how to explicitly get a reference to the ActionExecutionContext from the ViewModel. 

The function is question is:

public IEnumerable<IResult> DrawChart()
	yield return Loader.Show("Retrieving Investment History...");

	if (Investment != null)
		yield return new Framework.WebServiceResult<ServiceSoapClient, GetInvestmentHistoryCompletedEventArgs>(
			x => x.GetInvestmentHistoryAsync(Fund.Code, Investment.Code, StartDate, EndDate), x => SetInvestmentHistory(x.Result)


	yield return Loader.Hide();

The WebServiceResult is taken from Caliburn.Micro and a WebServiceResult.

The screen in question is currently the only screen in the application (a Screen viewmodel hosted in a Conductor ShellViewModel), if the problem could be related to the program initialization.

Any help would be much appreciated!

Mar 6, 2013 at 8:53 AM
Got the same problem here. Is it "working as intended" that we have to Call the IEnumerable<IResult> from the View?
Mar 8, 2013 at 1:01 PM
Sorry, but I don't understand what your problem is.
Mar 8, 2013 at 5:14 PM