如何识别Windows Mobile 6.5上缺少触摸屏和键盘

时间:2011-10-16 14:38:31

标签: c# windows-mobile

如何识别Windows-mobile 6.5上缺少触摸屏和键盘?

如果我没有触摸屏幕或按任何键我需要返回主屏幕

如何在Windows Mobile 6.5上使用C#进行操作?

2 个答案:

答案 0 :(得分:2)

我同意Henk的意见,即不清楚是否要检测用户缺少输入或检测是否存在这些接口。用于检测用户空闲状况,this might be of interest。用于检测硬件接口可用性,this might help

答案 1 :(得分:1)

我在自己的设备上执行此操作。

只需添加Timer和名为Reset()的简短函数。

const int TIME_LIMIT = 50000; // set to whatever you need
int timeout;
Timer Timer1;

void Form1() {
   Timer1 = new Timer();
   Timer1.Interval = 200; // 200 milliseconds
   Timer1.Tick += new EventHandler(Timer_Tick);
}

void ShowSubPanel() {
  Timer_Reset();
  panelSub1.BringToFront();
}

void Timer_Reset() {
  Timer_Stop();
  Timer_Start();
}

void Timer_Start() {
  timeout = 0;
  Timer1.Start();
}

void Timer_Stop() {
  Timer1.Stop();
}

void Timer_Tick() {
  if (TIME_LIMIT < timeout++) {
    Timer_Stop();
    // Here, call your Main Form
    Main.BringToFront(); // I use Panels instead of forms
  }
}