문제

When I press the back button to close the bing maps app and go back to the app, bing maps open again and again and again, can't close them. How to resolve this issue ?(I m on Windows phone 8)

 protected override  void OnNavigatedTo(NavigationEventArgs e)
    {
        base.OnNavigatedTo(e);

        if (NavigationContext.QueryString.TryGetValue("itineraire", out itineraire))
        {

            // You can specify a label and a geocoordinate for the end point.
            GeoCoordinate spaceNeedleLocation = App.Sitegeolocalisation;
            LabeledMapLocation spaceNeedleLML = new LabeledMapLocation(App.leSite.SiteName, spaceNeedleLocation);

            // If you set the geocoordinate parameter to null, the label parameter is used as a search term.
            MapsDirectionsTask mapsDirectionsTask = new MapsDirectionsTask();

            mapsDirectionsTask.End = spaceNeedleLML;

            // If mapsDirectionsTask.Start is not set, the user's current location is used as the start point.

            mapsDirectionsTask.Show();


        }
        else
        {
            MapsTask mapsTask = new MapsTask();

            mapsTask.ZoomLevel = 17;
            //Omit the Center property to use the user's current location.
            mapsTask.Center = App.Sitegeolocalisation;

            mapsTask.Show();


        }
    }
도움이 되었습니까?

해결책

You can test the property NavigationMode in NavigationEventArgs, if the NavigationMode is Back, just skip the code you have on the OnNavigatedTo method now.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top