我正在编写一个在Raspberry Pi和Windows IoT上运行的UWP应用程序的代码。
我有一个物理按钮(https://shkspr.mobi/blog/wp-content/uploads/2015/05/Push-Button-Pi.jpg) 和RFID阅读器(http://www.baaqii.com/promanage/productimage/Ewhole/A/A901-2.jpg)
每次按下按钮,我都希望应用程序显示弹出窗口。当我将RFID芯片放在RFID阅读器上时,它应该在其webview中显示某个HTML文件。
一切正常,但只能工作2次。在第三次RFID识别之后,我总是得到像这样的DebugMessage
The thread 0xb50 has exited with code 0 (0x0).
The thread 0xbd4 has exited with code 0 (0x0).
The thread 0x488 has exited with code 0 (0x0).
The thread 0x94c has exited with code 0 (0x0).
The thread 0x22c has exited with code 0 (0x0).
The thread 0x720 has exited with code 0 (0x0).
按钮和RFID阅读器不再工作了。我认为Dispatcher存在问题。
以下是四个功能:
private async void Button_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e) {
if (e.Edge == GpioPinEdge.RisingEdge) {
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
this.myHandler_ButtonPushed.Handle(new EventArgs());
});
}
}
private async void RFID_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e) {
if (e.Edge == GpioPinEdge.RisingEdge) {
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
this.myHandler_RfidIdentificated.Handle(new EventArgs());
});
}
}
public void Button_pushed(EventArgs e) {
popup1.IsOpen = true;
}
public void Rfid_identificated(EventArgs e) {
webview1.NavigateToLocalStreamUri(webview1.BuildLocalStreamUri("buttonURL", "/myDownloads/de-DE/47430155.html"), new Classes.StreamUriWinRTResolver());
popup1.IsOpen = false;
}