/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. /// This parameter is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { selectedLocations = e.Parameter as SelectedLocations; DetermineRouteAsync(/*selectedLocations*/); }
private async void submitButton_Click(object sender, RoutedEventArgs e) { if (searchingCurrLocation) { await ShowMessage.PopupMessage("Finding your location. Please Wait"); return; } bool foundS = false, foundD = false; Location s = null, d = null; /*if (locationcheckBox.IsChecked == true) * { * if (!hasCurrLocation) * { * await ShowMessage.PopupMessage("Couldn't get current location"); * return; * } * * Geopoint sourcepoint = new Geopoint(CurrentLocationFinder.currGeoposition.Coordinate.Point.Position); * MapLocationFinderResult result = await MapLocationFinder.FindLocationsAtAsync(sourcepoint); * if (result.Status == MapLocationFinderStatus.Success) * { * if (result.Locations.Count > 0) * { * sourceASBox.Text = result.Locations[0].Address.Town.ToString(); * //SearchLocations sln = new SearchLocations(sourceASBox.Text, sourcepoint.Position.Latitude, sourcepoint.Position.Longitude); * Location sln = new Location(sourceASBox.Text, result.Locations[0].Point.Position.Latitude, result.Locations[0].Point.Position.Longitude); * s = sln; * foundS = true; * } * } * }*/ if (sourceASBox.Text != "" && destASBox.Text != "") { foreach (Location sl in MeTravUtility.AllLocations) { if (!foundS && sl.name.Equals(sourceASBox.Text)) { foundS = true; s = sl; } if (!foundD && sl.name.Equals(destASBox.Text)) { foundD = true; d = sl; } if (foundS && foundD) { break; } } if (s == null || d == null) { await ShowMessage.PopupMessage("Invalid Source or Destination"); } else { SelectedLocations selectedlocations = new SelectedLocations(s, d); this.Frame.Navigate(typeof(Map), selectedlocations); } } else { await ShowMessage.PopupMessage("Invalid Source or Destination"); } }