I'm using the UniRx flavor of Reactive Extensions for the Unity3D game engine. Unity uses C#, so I guess it's similar to Rx.NET.
I need a more beautiful way of checking when several observable sequences complete.
In the example below, one of the sequences is dependent on the outcome of the first (since it needs an integer for processID
).
The observables are both of type IObservable<string>
.
var processListObservable = APIBuilder
.GetProcessList(authInfo.Token, authInfo.PlatformURL, (int)product.Id)
.Subscribe(listJson =>
{
processList = ProcessList.FromJson(listJson);
int processID = (int)processList.Processes[0].ProcessDataId;
//Retrieve Detailed information of the first entry
var processDetailsObservable = APIBuilder
.GetProcessDetails(token, platformURL, product.Id, processID)
.Subscribe(detailsJson =>
{
processData = ProcessData.FromJson(detailsJson);
SetupPlotView();
});
});
Any hint would be highly appreciated. Also some suggestions to solve the same scenario minus the dependency on the result of the first sequence.