Hi,
Sorry if the subject is confusing, but here's what I want and I'm a bit lost on how to accomplish that:
I have an OperationResult
LoadAsync that does the following:
return Coroutine.StartParallel(InitializeCore)
.AsOperationResult()
.ContinueWith(
or => Coroutine.Start(InitializeApplicationStorage, op => op.OnComplete(onSuccess, onFail))
.AsOperationResult()
.Execute()
);
the private IEnumerable<INotifyCompleted> InitializeCore() executes a few yield return EntityManager.insertentitytypehere.Where(q => predicatehere).ExecuteAsync();
When the above routine finishes, the InitializeApplicationStorage routine is executed and here lies my problem; I have to do something like this:
foreach (var questionObject in qoWithImages)
// ReSharper restore LoopCanBeConvertedToQuery
{
var o = questionObject;
yield return EntityManager.InvokeServerMethodAsync(
typeName, methodName,
callBack =>
{
//omitted for brevity => writing the received byte[] to isolated storage
},
null,
new object[] { questionObject.image_name, questionObject.test_id }
);
}
I want the main LoadAsync onSuccess to be called when the last callback has finished, with other words, to continue when all the async functions have completed.
How can I do that?
Thanks again!