Windows Phone 7 中的应用程序停用 - 由用户或系统引起。如何区分?
是否可以区分应用程序停用的原因?
当用户按下后退按钮或有来电\短信时,应用程序进入停用状态。我的问题是——如何辨别原因?防止作弊等很重要。
我有计时器 - 当有收入电话或短信时可以冻结它。如果按后退按钮,则不应保存它。
Is it possible to distinguish the cause of application deactivation?
Aplpication enters the deactivated state when users press back button or there is a call\SMS. My question is - how to distinguish the cause? It is important to prevent cheating etc.
I have time counter - it will be ok to freeze it when there's income call or SMS. In case of pressing back button it shouldn't be saved.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尚未测试,但它可能会起作用:
OnNavigedTo
并设置将标志设置为 false现在,当触发
Desactivated
事件时,如果该标志设置为 true,那么您就知道用户已按下后退按钮。Haven't tested it but it may work:
OnNavigatedTo
and set the flag to falseNow, when the
Desactivated
event is triggered, if the flag is set to true then you know the user has pressed the back button.如果这是为了防止游戏中作弊,我不会区分“返回”和“接到电话”,因为这会让用户感到困惑,并且会触发其他人通过让别人打电话给他们来作弊。
只需从游戏的最后一个保存点恢复或再次尝试该级别即可。
If this is to prevent cheating in a game I wouldn't make make a distinction between 'back' and 'getting a call' because to the user that would be confusing and it would trigger others to cheat by having someone call them.
Just resume from the game's last save point or offer to try the level again.