【问题标题】:Count how many times user click back button (Windows Phone)计算用户点击后退按钮的次数(Windows Phone)
【发布时间】:2012-05-30 18:38:10
【问题描述】:

在我的 Windows Phone 应用程序中,我需要计算用户从当前页面单击返回按钮的次数。有可能吗?

【问题讨论】:

  • 为什么要这样做?可能有更好的方法来实现相同的结果。
  • 我需要避免用户按下按钮太多次
  • 为什么?你想阻止或阻止什么?

标签: c# windows-phone-7


【解决方案1】:

BackButtonPress 有一个事件

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)

【讨论】:

  • 呃,那有什么问题呢?试着在里面放一个计数器,就像下面 ENTHIL 给出的那样。
【解决方案2】:

你试过这样吗?

int counter =0;

protected override void OnBackKeyPress
                  (System.ComponentModel.CancelEventArgs e)
{
    base.OnBackKeyPress(e);

    counter++;

    textbox1.text = counter.tostring();

    navigation process;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-18
    • 1970-01-01
    • 2015-02-06
    • 2017-11-29
    • 2013-06-10
    相关资源
    最近更新 更多