none
Hello guys can somebody help just tell me how to deal with exception i mean to showmassege or turn the map off RRS feed

  • Question

  •  try
                {
                    string x = loc.Text;
                    pos = await geolocator.GetGeopositionAsync();
                    location = new Location(pos.Coordinate.Latitude, pos.Coordinate.Longitude);
                    // Set the start and end waypoints
                    Bing.Maps.Directions.Waypoint startWaypoint = new Bing.Maps.Directions.Waypoint(location);
                    Bing.Maps.Directions.Waypoint endWaypoint = new Bing.Maps.Directions.Waypoint(x);
    
                    Bing.Maps.Directions.WaypointCollection waypoints = new Bing.Maps.Directions.WaypointCollection();
                    waypoints.Add(startWaypoint);
                    waypoints.Add(endWaypoint);
    
                    Bing.Maps.Directions.DirectionsManager directionsManager = myMap.DirectionsManager;
                    directionsManager.Waypoints = waypoints;
    
                    // Calculate route directions
                    Bing.Maps.Directions.RouteResponse response = await directionsManager.CalculateDirectionsAsync();
    
                    // Display the route on the map
                    directionsManager.ShowRoutePath(response.Routes[0]);
                }
                catch (System.UnauthorizedAccessException)
                {           
                    MessageBox.Show("Invalid Geocode Input.");
                }
                catch (TaskCanceledException)
                {
                    Console.WriteLine("No Internet Connection.");
                }
                catch (System.OutOfMemoryException)
                {
                    Console.WriteLine("Out of Memory");
                }
                catch (COMException)
                {
                    Console.WriteLine("No Internet Connection.");
                }

    • Moved by Dmitry G MatveevMicrosoft employee Tuesday, December 17, 2013 11:46 PM Moved to Bing Maps. Question is about handling/showing exception on the map, not related to AppInsights
    Tuesday, December 17, 2013 2:22 PM

Answers

  • It's not clear what you are asking. It looks like you are using the Bing Maps Native control for Windows Store apps. If you simply want to show a message when an error occurs you can use the MessageDialog class which is in the Windows.UI.Popup namespace. For example:

    var dialog = new MessageDialog("No results found.", "Geocoding Result");
    await dialog.ShowAsync();


    http://rbrundritt.wordpress.com

    Wednesday, December 18, 2013 9:13 AM

All replies

  • It's not clear what you are asking. It looks like you are using the Bing Maps Native control for Windows Store apps. If you simply want to show a message when an error occurs you can use the MessageDialog class which is in the Windows.UI.Popup namespace. For example:

    var dialog = new MessageDialog("No results found.", "Geocoding Result");
    await dialog.ShowAsync();


    http://rbrundritt.wordpress.com

    Wednesday, December 18, 2013 9:13 AM
  • Thank u sir u gave me the answer for my problem I just didn't know how to display the maseege dialog thank u :D
    Thursday, December 19, 2013 10:16 AM