c# - 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。如果有什么方法可以帮助我正确处理飞行时间?或者你有什么建议?感谢帮助
解决方案
推荐阅读
- vb.net - 如何在嵌套的 for 循环中修复我的循环 2 个数据集
- postgresql - 如何在 postgresql 中组合多个 select 语句?
- java - 使用 Java8 stream()、collect() 和 groupingBy() 等根据两个相同的 beans 属性值添加整数值
- sed - 如何在 /etc/fstab 文件中查找字符串引导并将 UUID 替换为内核设备名称 /dev/sda1?
- azure - 是否有任何 API 可以查询 Azure VM 的可用磁盘/内存空间?
- kubernetes - 如何使用“kubectl -l/--selector”在 Kubernetes 部署中扩展特定 pod
- python - 如何使用 np.where() 函数基于 2 列的值之间的比较,即 Total_Summer 和 Total_Winter 列和 3 个参数?
- windows - 如何使用 ipt trace
- json - kubectl 应用 -f
它适用于什么地方? - c# - 从 C# 中的 unqiue(独立)元素获取索引