首页 > 解决方案 > WPF Keystroke Dynamics,测量飞行时间的最佳方法?

问题描述

我正在制作一个通过按键时间识别人的应用程序。这就是我测量时间的方式:

    private void Label_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Key == Key.A || e.Key == Key.O)
        {               
            stopwatch.Start();
        }
        else
        {
            e.Handled = true;
        }
    }

    private void Label_KeyUp(object sender, KeyEventArgs e)
    {
        if (e.Key == Key.A)
        {
            stopwatch.Stop();
            string aS = stopwatch.ElapsedMilliseconds.ToString(); //get time of pressing key
            int aI = Convert.ToInt32(aS); //string -> int
            a += aI; //summary of pressing key
            stopwatch.Reset();
            aCounter++;
        }

        if (e.Key == Key.O)
        {
            stopwatch.Stop();
            string oS = stopwatch.ElapsedMilliseconds.ToString();
            int oI = Convert.ToInt32(oS);
            o += oI;
            stopwatch.Reset();
            oCounter++;
        }
  }

而且我认为我的飞行时间有问题,因为有时特定键的度量是==0。如果有什么方法可以帮助我正确处理飞行时间?或者你有什么建议?感谢帮助

标签: c#wpfkeystrokebiometrics

解决方案


推荐阅读