diff --git a/SlnMesnac.Business/TagScanBusiness.cs b/SlnMesnac.Business/TagScanBusiness.cs index 28b7ad9..d118f37 100644 --- a/SlnMesnac.Business/TagScanBusiness.cs +++ b/SlnMesnac.Business/TagScanBusiness.cs @@ -2,6 +2,7 @@ using SlnMesnac.TouchSocket; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Text; #region << 版 本 注 释 >> @@ -38,6 +39,9 @@ namespace SlnMesnac.Business public delegate void RefreshDeviceAlarmMessage(string message); public event RefreshDeviceAlarmMessage? RefreshDeviceAlarmMessageEvent; + public delegate void RefreshDeviceStatus(bool rfidFlag,bool camFlag); + public event RefreshDeviceStatus? RefreshDeviceStatusEvent; + public TagScanBusiness(ApiServer apiServer) { @@ -65,8 +69,33 @@ namespace SlnMesnac.Business { RefreshDeviceAlarmMessageEvent?.Invoke(item); } + + List rfidList = new List(); + List camList = new List(); + + foreach (string str in info.device_status) + { + if (str.Length == 2) + { + int number; + bool isNumber = int.TryParse(str, out number); + if (isNumber && str[0] == '1') + { + camList.Add(str); + continue; + } + rfidList.Add(str); + } + } + + RefreshDeviceStatusEvent?.Invoke(rfidList.Count > 0 ? true : false, camList.Count > 0 ? true : false); + } } + else + { + RefreshDeviceStatusEvent?.Invoke(false, false); + } }; } diff --git a/SlnMesnac.WPF/MainWindow.xaml b/SlnMesnac.WPF/MainWindow.xaml index c173496..b8ae1c9 100644 --- a/SlnMesnac.WPF/MainWindow.xaml +++ b/SlnMesnac.WPF/MainWindow.xaml @@ -67,13 +67,13 @@