如何使用 C# 导航到 Windows Phone 8 开始屏幕 [英] How to navigate to Windows Phone 8 start screen using C#

查看:25
本文介绍了如何使用 C# 导航到 Windows Phone 8 开始屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照第 9 频道 [http://channel9.msdn.com/Series/Windows-Phone-8-Development-for-Absolute-Beginners] 上的视频教程系列构建了一个非常基本的音板应用程序.应用程序中的每个页面都显示一个声音图块列表,点击时会播放相关的声音.我已经扩展了应用程序以允许用户将单个声音平铺到手机的开始屏幕.到目前为止一切正常.

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.

现在每当用户从开始屏幕点击声音时,我都希望应用程序磁贴只播放声音,但此时它会导航到应用程序中.我在第 9 频道上提出了类似的问题,视频系列作者建议我通过在 OnNavigatedTo 事件上调用 NavigationService.GoBack 方法来实现这一点.我试过了,但是我收到消息CanGoBack 为假时无法返回"的异常.这是第 9 频道线程 - http://channel9.msdn.com/Series/Windows-Phone-8-Development-for-Absolute-Beginners/Part-23-Testing-and-Submitting-to-the-商店

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.

我的应用程序的整个源代码可在 GitHub 上获得,地址为 https://github.com/PrasadHonrao/WindowsPhone8/tree/master/SoundJabber

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

谢谢.

推荐答案

要以编程方式退出应用程序,您可以调用:

To programmatically exit an application, you can call:

Application.Current.Terminate();

遗憾的是,此方法仅适用于 Windows Phone 8,此方法不适用于 Windows Phone 7.

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

这篇关于如何使用 C# 导航到 Windows Phone 8 开始屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆