How to navigate to Windows Phone 8 start screen us

2019-09-06 00:51发布

I have built a very basic sound board app by following video tutorial series on channel 9 [http://channel9.msdn.com/Series/Windows-Phone-8-Development-for-Absolute-Beginners]. Each page in the app displays a list of sound tiles, which on tap plays associated sound. I have extended the app to allow user to tile the individual sound to phone's start screen. Everything works fine upto this point.

Now whenever user taps the sound from start screen, I want app tile to just play the sound, however its navigating into the application at the moment. I have raised similar question on channel 9 and the video series author suggested me that its possible by calling NavigationService.GoBack method on OnNavigatedTo event. I tried that, however I am getting exception with message 'Cannot go back when CanGoBack is false'. Here is the channel 9 thread - http://channel9.msdn.com/Series/Windows-Phone-8-Development-for-Absolute-Beginners/Part-23-Testing-and-Submitting-to-the-Store

Appreciate if someone helps me to resolve the issue.

Entire source code of my app is available on GitHub at https://github.com/PrasadHonrao/WindowsPhone8/tree/master/SoundJabber

Thanks.

3条回答
在下西门庆
2楼-- · 2019-09-06 00:59

To programmatically exit an application, you can call:

Application.Current.Terminate();

Unfortunately, it will work only on Windows Phone 8, this method isn't available on Windows Phone 7.

查看更多
迷人小祖宗
3楼-- · 2019-09-06 01:10

You can't use navigationService.GoBack when you don't have navigation history. When you are in your main page and you want to exit your application you can use NavigationService.RemoveBackEntry() for remove navigation history.

If you want play sound for a specifique user.Create Model ou uri sound as parameter.

For information: when you use Application.Current.Terminate();.You don't pass in your app.cs.

查看更多
叼着烟拽天下
4楼-- · 2019-09-06 01:13

the simplest you can do is Application.Current.Terminate();

查看更多
登录 后发表回答