public async Task <NetPortableServices.Direction> WalkDistanceAsync(double sourceLat, double sourceLon, double targetLat, double targetLon) { #if WINDOWS_PHONE_APP TimeSpan starTime = DateTime.Now.TimeOfDay; var sw = Stopwatch.StartNew(); var retVal = await WhenAny( queryTimeOut(), queryWalkDistance(sourceLat, sourceLon, targetLat, targetLon) ); sw.Stop(); QueryTimes.Add(sw.Elapsed); PerfLogging.AddRow("walkQuery", sourceLat, sourceLon, targetLat, targetLon, starTime, sw.Elapsed, retVal != null ? retVal.DistanceInMeters : -1, retVal != null ? retVal.EstimatedDuration : TimeSpan.Zero); return(retVal); #endif return(null); }
public async void SetListContent() { StatusBar.GetForCurrentView().ProgressIndicator.ProgressValue = null; StatusBar.GetForCurrentView().ProgressIndicator.ShowAsync(); var location = await CurrentLocation.Get(); //logging UniversalDirections.QueryTimes.Clear(); var sw = Stopwatch.StartNew(); var nearStops = await StopTransfers.NearStops(location, radius.Value); sw.Stop(); ListView.ItemsSource = nearStops.Select(s => new StopModel(s.StopGroup, true)).ToList(); ListView.Height = ListView.ItemsSource().Count > 0 ? double.NaN : 0; StatusBar.GetForCurrentView().ProgressIndicator.HideAsync(); PerfLogging.AddRow( "setListContent", sw.Elapsed, UniversalDirections.QueryTimes.Count, UniversalDirections.QueryTimes.Count > 0 ? UniversalDirections.QueryTimes.Average(x => x.TotalMilliseconds) : 0.0); }