寻找解决方案,如果我在windows-mobile上2分钟不按任何键或触摸屏幕
我需要返回到LogIn屏幕(从我的程序的任何屏幕)。
提前感谢
发布于 2011-08-06 17:22:27
运行计时器,该计时器在收到OnTouch或OnKey事件并在指定时间后返回到登录屏幕时重置。
public partial class AnotherScreen : PhoneApplicationPage
{
private Timer _timer;
private int _timeSpan;
public AnotherScreen()
{
InitializeComponent();
_timer = new Timer(TimerTick,null,TimeSpan.Zero,TimeSpan.FromMinutes(2));
MouseEnter += (s, e) => _timeSpan = 0;
}
private void TimerTick(object obj)
{
_timeSpan += 1;
if (_timeSpan > 120)
{
Dispatcher.BeginInvoke(() =>NavigationService.Navigate(new Uri("/LoginScreen.xaml", UriKind.Relative)));
}
}
}发布于 2011-08-07 01:00:49
对于Windows Mobile (即不是Windows Phone),可以看看this blog entry。
https://stackoverflow.com/questions/6965672
复制相似问题