diff --git a/SlnMesnac.WPF/ViewModel/IndexPage/ProductionLineViewModel.cs b/SlnMesnac.WPF/ViewModel/IndexPage/ProductionLineViewModel.cs index c54957d..8c29704 100644 --- a/SlnMesnac.WPF/ViewModel/IndexPage/ProductionLineViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/IndexPage/ProductionLineViewModel.cs @@ -94,6 +94,23 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage } } + /// + /// RFID连接状态 + /// + private string _rfidConnectState; + public string RFIDConnectState + { + get => _rfidConnectState; + set + { + if (_rfidConnectState != value) + { + _rfidConnectState = value; + RaisePropertyChanged(() => RFIDConnectState); + } + } + } + public ProductionLineViewModel() { GetOrderInfoCommand = new RelayCommand(t => RefreshData(t)); @@ -492,13 +509,13 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage if (value.AddSeconds(15) < DateTime.Now) { await Reconnect(device); - Deviceinfo.FirstOrDefault(x => x.Deviceid == device.deviceid).IsOnline = "已连接"; + RFIDConnectState = "已连接"; } } else { await Reconnect(device); - Deviceinfo.FirstOrDefault(x => x.Deviceid == device.deviceid).IsOnline = "已连接"; + RFIDConnectState = "已连接"; var res = false; //无限获取心跳返回报文 Log.Information($"准备第一次获取心跳"); @@ -521,7 +538,7 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage var res = false; do { - Deviceinfo.FirstOrDefault(x => x.Deviceid == device.deviceid).IsOnline = "未连接"; + RFIDConnectState = "未连接"; Log.Information($"[{device.deviceid}]:[{device.ip}:{device.port}]连接中..."); res = await device.ConnectAsync(device.ip, device.port, device.deviceid); }