Richard (and others),
So, I have the code that returns the location, and I have the code of the calling code. Here is (hopefully) the final release. When I call GetGPSCoordinates, the next statement runs immediately, without waiting for the subscription to complete. Here is an example in the OnClick event handler.
Location newLoc = new Location();
GetGPSCoordinates(this.Input.Text).ObserveOnDispatcher().Subscribe(x =>
{
if (x.Results.Count > 0 && x.Results[0].Locations.Count > 0)
{
newLoc = x.Results[0].Locations[0];
Output.Text = "Latitude: " + newLoc.Latitude.ToString() +
", Longtude: " + newLoc.Longitude.ToString();
}
else
{
Output.Text = "Invalid address";
}
});
Output.Text = " Outside of subscribe --- Latitude: " + newLoc.Latitude.ToString() +
", Longtude: " + newLoc.Longitude.ToString();
Output.Text, , , .
- , , Foreach. Rx Extensions , async . , , .
, , ?