Question

I am trying to launch the Connection settings task from the secondary tile. For that I am creating a tile and giving the uri as like

"ShellTile.Create(new Uri("/LaunchSettings.xaml", UriKind.Relative), standardTileData);".

In LaunchSettings.Xaml launching Bluetooth setting using URI Scheme. like

"await Launcher.LaunchUriAsync(new Uri("ms-settings-Bluetooth:"));"

But once settings launched if I click back button, its coming to the LaunchSettings.xaml. Not returning to the Start screen. How to achieve that?

Please advice.

Was it helpful?

Solution

You need to exit the application in the OnNavigatedToEvent, so add the following override to your LaunchSettings.xaml.cs file:

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    if (e.NavigationMode == NavigationMode.Back)
        Application.Current.Terminate();

    base.OnNavigatedTo(e);
}

Note that this will not trigger for example the Application_Closing event (see this link: http://msdn.microsoft.com/en-us/library/windowsphone/develop/system.windows.application.terminate(v=vs.105).aspx).

OTHER TIPS

Just write Application.Current.Terminate(); after the Launcher.

launches the Uri while closing your app.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top