mirror of
https://github.com/dotMorten/NmeaParser.git
synced 2026-04-21 06:13:58 +00:00
parent
db04b280e4
commit
2ed285ee75
2 changed files with 33 additions and 2 deletions
|
|
@ -84,6 +84,7 @@ namespace SampleApp.WinDesktop
|
|||
if (currentDevice != null)
|
||||
{
|
||||
currentDevice.MessageReceived -= device_MessageReceived;
|
||||
currentDevice.DeviceDisconnected -= device_DeviceDisconnected;
|
||||
if (currentDevice.IsOpen)
|
||||
await currentDevice.CloseAsync();
|
||||
currentDevice.Dispose();
|
||||
|
|
@ -110,7 +111,7 @@ namespace SampleApp.WinDesktop
|
|||
MessagePanel.Children.Remove(child);
|
||||
}
|
||||
currentDevice.MessageReceived += device_MessageReceived;
|
||||
|
||||
currentDevice.DeviceDisconnected += device_DeviceDisconnected;
|
||||
if (device is NmeaParser.NmeaFileDevice)
|
||||
currentDeviceInfo.Text = string.Format("NmeaFileDevice( file={0} )", ((NmeaParser.NmeaFileDevice)device).FileName);
|
||||
else if (device is NmeaParser.SerialPortDevice)
|
||||
|
|
@ -130,6 +131,11 @@ namespace SampleApp.WinDesktop
|
|||
view3d.GnssMonitor = monitor;
|
||||
}
|
||||
|
||||
private void device_DeviceDisconnected(object sender, Exception e)
|
||||
{
|
||||
MessageBox.Show("Device disconnected: " + e.Message);
|
||||
}
|
||||
|
||||
private void Monitor_LocationChanged(object sender, EventArgs e)
|
||||
{
|
||||
var mon = sender as GnssMonitor;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue