我在wp8.1中制作应用程序我想确保在某些过程中用户不允许按下Windows Phone的硬件后门按钮。 如果他这样做,那么我的自定义catch块异常应该运行。
我不知道如何处理我的应用程序的后退异常。 请提供您在制作自定义例外时提供的任何代码段或帮助。
谢谢
public class InvalidDataException : ApplicationException { public InvalidDataException() { } public InvalidDataException(string msg) : base(msg) { } }I am making an app in wp8.1 I want to make sure that during certain process user is not allowed to press the hardware backbutton of windows phone. IF he does then my custom catch block exception should run.
I don't know how to handle the backbutton exception for my app. Please provide any snippet or help you can in making custom exception.
Thanks
public class InvalidDataException : ApplicationException { public InvalidDataException() { } public InvalidDataException(string msg) : base(msg) { } }最满意答案
如果将BackPressedEventArgs(e)参数的Handled属性设置为True,则将阻止此事件的操作系统操作,您可以触发自定义异常。
当您将此属性设置为true时,操作系统将停止导航回来。但是,您不应该阻止用户终止您的应用程序。否则您的应用程序会更改为不进入商店。
If you set BackPressedEventArgs (e) parameter's Handled property to True , you will block the OS action on this event you can trigger your custom exception.
When you set this property to true OS will stop to navigate back.However , you shouldn't prevent user from terminating your app.Otherwise your app has a change to not get into the Store.
更多推荐
发布评论