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!