0
我是WPF的新手,正在構建測試應用程序。在我的應用程序中,我有一個用戶控件調用另一個類來捕獲設備中的指紋。從設備捕獲指紋的類正在do while循環中運行,該循環不斷保持對設備的讀取。我想介紹一個可以打破這個做法的事件。在我的用戶控件中,我可以捕獲KeyDown事件。但是捕捉指紋的班級無法捕捉按鍵。我錯過了什麼?WPF子類捕獲按鍵事件
This is my Sample File.Xaml.cs code
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.Key == Key.LeftCtrl || e.Key == Key.RightCtrl)
{
}
else
base.OnKeyDown(e);
}
private void button_Click(object sender, RoutedEventArgs e)
{
TNTFMT220 tntFmt220 = new TNTFMT220();
string fingerPrintId = "";
var data = tntFmt220.ContiniousCaptureFingerPrint(ref fingerPrintId);
}
這是我的代碼取到指紋
public bool ContiniousCaptureFingerPrint(ref string FingerPrintScanned)
{
do
{
//get data from device
} while(dataReturned);
return true;
}
我試過以上,但得到同樣的問題。我會嘗試不同的線程方法。感謝您的洞察力 –