调整scan
This commit is contained in:
parent
6646e6b5e5
commit
c02845ddc3
@ -111,11 +111,11 @@ namespace RIZO_Application.Modules.ModuleName.ViewModels
|
|||||||
throw new ObjectDisposedException(nameof(ScanControlViewModel));
|
throw new ObjectDisposedException(nameof(ScanControlViewModel));
|
||||||
|
|
||||||
|
|
||||||
//if (SerialConfigs.Current != null)
|
if (SerialConfigs.Current != null)
|
||||||
//{
|
{
|
||||||
// comName = SerialConfigs.Current.ComName ?? string.Empty;
|
comName = SerialConfigs.Current.ComName ?? string.Empty;
|
||||||
// baudRate = SerialConfigs.Current.BaudRate ?? 9600;
|
baudRate = SerialConfigs.Current.BaudRate ?? 9600;
|
||||||
//}
|
}
|
||||||
|
|
||||||
_eventAggregator.GetEvent<SystemLogEvent>().Publish($"串口扫码枪初始化……串口:{comName} 波特率:{baudRate}");
|
_eventAggregator.GetEvent<SystemLogEvent>().Publish($"串口扫码枪初始化……串口:{comName} 波特率:{baudRate}");
|
||||||
|
|
||||||
|
|||||||
@ -63,6 +63,11 @@ namespace RIZO_Helper.Tools
|
|||||||
_serialPort.DataReceived += OnSerialDataReceived;
|
_serialPort.DataReceived += OnSerialDataReceived;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
catch (InvalidOperationException ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine($"打开串口 {_serialPort.PortName} 失败: {ex.Message}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
catch (OperationCanceledException) when (_disposeCts.IsCancellationRequested)
|
catch (OperationCanceledException) when (_disposeCts.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user