protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.Parameter is string[]) { var stop = await Data.GetBusStop(((string[])e.Parameter)[1], CancellationTokenSource.Token); var route = await Data.GetRoute(((string[])e.Parameter)[0], CancellationTokenSource.Token); string destination = ((string[])e.Parameter)[2]; DescriptionBlock.Text = route.Value.Name + " to " + destination + " at " + stop.Value.Name; Windows.Devices.Geolocation.Geolocator locator = new Windows.Devices.Geolocation.Geolocator(); TitleBox.Text = destination; string city = null; try { var finder = await MapLocationFinder.FindLocationsAtAsync(new Windows.Devices.Geolocation.Geopoint(stop.Value.Position)); if (finder.Locations.Count > 0) { city = finder.Locations[0].Address.Town; CityContextBox.IsEnabled = true; CityContextBox.Content = "In " + city; } else { CityContextBox.Content = "(Could not get city)"; } } catch (Exception) { CityContextBox.Content = "(Could not get city)"; } location = new ContextLocation() { Latitude = stop.Value.Position.Latitude, Longitude = stop.Value.Position.Longitude, City = city }; favorite = new FavoriteArrival() { Contexts = new LocationContext[0], Route = route.Value.ID, Stop = stop.Value.ID, Destination = destination }; } }
public bool IsInContext(ContextLocation location) { if (Contexts == null && Contexts.Length == 0) return false; else return Contexts.Any(ctxt => ctxt.IsInContext(location)); }
public bool IsInContext(ContextLocation location) { if (Contexts == null && Contexts.Length == 0) { return(false); } else { return(Contexts.Any(ctxt => ctxt.IsInContext(location))); } }
public override bool IsInContext(ContextLocation location) { switch (Direction) { case CardinalDirection.North: return location.Latitude >= RelativeLocation.Latitude; case CardinalDirection.South: return location.Latitude <= RelativeLocation.Latitude; case CardinalDirection.East: return location.Longitude >= RelativeLocation.Longitude; case CardinalDirection.West: return location.Longitude <= RelativeLocation.Longitude; } return false; }
public override bool IsInContext(ContextLocation location) { switch (Direction) { case CardinalDirection.North: return(location.Latitude >= RelativeLocation.Latitude); case CardinalDirection.South: return(location.Latitude <= RelativeLocation.Latitude); case CardinalDirection.East: return(location.Longitude >= RelativeLocation.Longitude); case CardinalDirection.West: return(location.Longitude <= RelativeLocation.Longitude); } return(false); }
public static double Distance(ContextLocation start, ContextLocation end) { return(HelperFunctions.GetDistanceBetweenPoints(start.Latitude, start.Longitude, end.Latitude, end.Longitude)); }
public override bool IsInContext(ContextLocation location) { return ContextLocation.Distance(RelativeLocation, location) <= Distance; }
public override bool IsInContext(ContextLocation location) { return location.City == RelativeLocation.City; }
public abstract bool IsInContext(ContextLocation location);
public override bool IsInContext(ContextLocation location) { return(ContextLocation.Distance(RelativeLocation, location) <= Distance); }
public override bool IsInContext(ContextLocation location) { return(location.City == RelativeLocation.City); }
public static double Distance(ContextLocation start, ContextLocation end) { return HelperFunctions.GetDistanceBetweenPoints(start.Latitude, start.Longitude, end.Latitude, end.Longitude); }