黄学彪
2020-07-29 8ce0f9b1e568dd9125e74421cd02fbc29381c1f1
ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs
@@ -78,6 +78,8 @@
            this.AddNormalDeviceReportEvent();
            //添加传感器状态上报事件
            this.AddSensorDeviceReportEvent();
            //开启传感器状态还原的线程
            this.StartRecoverSenorStatuThread();
        }
        /// <summary>
@@ -460,6 +462,7 @@
        {
            //先清空
            listView.RemoveAll();
            this.dicDeviceRowControl = new Dictionary<string, Controls.DeviceRowCommon>();
            var listDevice = new List<CommonDevice>();
            for (int i = 0; i < rowInfo.listDeviceKeys.Count; i++)
@@ -888,6 +891,44 @@
        #endregion
        #region ■ 传感器状态还原_____________________
        /// <summary>
        /// 开启传感器状态还原的线程
        /// </summary>
        private void StartRecoverSenorStatuThread()
        {
            HdlThreadLogic.Current.RunThread(() =>
            {
                while (this.Parent != null)
                {
                    try
                    {
                        var dicControl = this.dicDeviceRowControl;
                        foreach (var contr in dicControl.Values)
                        {
                            //如果是传感器,则刷新状态
                            if (contr.device.Type == DeviceType.IASZone && contr.Parent != null
                              && ((IASZone)contr.device).iASInfo == null)
                            {
                                HdlThreadLogic.Current.RunMain(() =>
                                {
                                    //设备状态必须刷新
                                    string statuText = HdlDeviceOtherLogic.Current.GetDeviceStatu(contr.device);
                                    contr.SetDeviceStatuText(statuText);
                                }, ShowErrorMode.NO);
                            }
                        }
                        System.Threading.Thread.Sleep(8000);
                    }
                    catch { System.Threading.Thread.Sleep(3000); }
                }
            });
        }
        #endregion
        #region ■ 整合设备___________________________
        /// <summary>