From d29abbcceb9da3e3f0222863e1826cae43321410 Mon Sep 17 00:00:00 2001 From: SoulStar Date: Tue, 28 Apr 2026 10:56:42 +0800 Subject: [PATCH] =?UTF-8?q?refactor=20-=20=E8=BD=AC=E6=8D=A2=E5=88=86?= =?UTF-8?q?=E6=94=AF=EF=BC=8C=E8=AF=BB=E5=8D=A1=E5=99=A8=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E5=88=B0=E4=B8=80=E5=8D=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IndexPage/ProductionLineViewModel.cs | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) 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); }