/// <summary> /// Creates the path async. /// </summary> /// <returns>The path async.</returns> public IObservable <Unit> SelectFeedbackAsync() { IsLoading = true; IsError = false; return(GoogleMapsWebServiceController .GetDirectionsPolyLine(null, null, _currentTravelMode) .ObserveOn(this.Scheduler) .Catch <object, Exception>(error => { DidException(error, "Select failed using call to web service GetEReactiveUIAroundMeById"); return Observable.Empty <AuthContract>(); }) .Do(geocode => { IsLoading = false; }).Select(x => Unit.Default)); }
/// <summary> /// Creates the path async. /// </summary> /// <returns>The path async.</returns> public IObservable <Unit> CreatePathAsync(GoogleMapsTravelModes travelMode) { IsLoading = true; IsError = false; _currentTravelMode = travelMode; var startCoordinate = new GeoCoordinate(CurrentLocation.Latitude, CurrentLocation.Longitude); return(GoogleMapsWebServiceController .GetDirectionsPolyLine(startCoordinate, _endCoordinate, _currentTravelMode) .ObserveOn(this.Scheduler) .Catch <GoogleGeocodeContract, Exception>(error => { DidException(error, "Select failed using call to web service GetEReactiveUIAroundMeById"); return Observable.Empty <GoogleGeocodeContract>(); }) .Do(geocode => { IsLoading = false; var routes = geocode.Routes; var route = routes?.Length > 0 ? routes[0] : null; if (route != null) { var polyline = route.Bounds; var path = CreatePath(route.OverviewPolyline.Points); // update new path PathUpdate?.Invoke(this, new PathUpdateEventArgs() { StartCoordinate = startCoordinate, EndCoordinate = _endCoordinate, Path = path, }); } }).Select(x => Unit.Default)); }