WJC
2019-11-04 e5f993f52e09eb46878baced83bb8492f147d41c
ZigbeeApp/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs
@@ -175,7 +175,7 @@
            btnIcon.ButtonClickEvent += (sender, e) =>
            {
                //菜单控件
                var frameMenu = new TopRightMenuControl(this, 2);
                var frameMenu = new TopRightMenuControl(2);
                //防区列表
                string menu1 = Language.StringByID(R.MyInternationalizationString.uGarrisonAreaList);
                frameMenu.AddRowMenu(menu1, "Item/GarrisonList.png", "Item/GarrisonListSelected.png", () =>
@@ -320,13 +320,13 @@
            this.dicSensorStatuView.Clear();
            //添加列表控件
            //添加列表控件
            frameLayoutDraw.RemoveAll();
            var listView = new VerticalFrameControl(35);
            listView.Height = frameLayoutDraw.Height;
            frameLayoutDraw.AddChidren(listView);
            new System.Threading.Thread(() =>
            HdlThreadLogic.Current.RunThread(() =>
            {
                //获取安防的全部传感器设备的信息
                var dicDevice = HdlSafeguardLogic.Current.GetAllSensorDeviceInfo();
@@ -363,8 +363,7 @@
                        }
                    });
                }
            })
            { IsBackground = true }.Start();
            });
        }
        /// <summary>
@@ -445,16 +444,19 @@
            {
                return;
            }
            var timeValue = (DateTime.Now - oldGetOnlineTime).Milliseconds;
            if (timeValue <= 10000)
            if (oldGetOnlineTime.Year != 1900)
            {
                //最少要间隔十秒,才去重新获取
                return;
                var timeValue = (DateTime.Now - oldGetOnlineTime).TotalSeconds;
                if (timeValue < 10)
                {
                    //最少要间隔十秒,才去重新获取
                    return;
                }
            }
            oldGetOnlineTime = DateTime.Now;
            //从设备列表中获取在线状态
            new System.Threading.Thread(async () =>
            HdlThreadLogic.Current.RunThread(() =>
            {
                //首先获取这些传感器所在的网关
                var listWay = new List<ZbGateway>();
@@ -475,19 +477,18 @@
                        //界面关闭
                        return;
                    }
                    await Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, this.ReceiveDeviceStatuPush, ShowErrorMode.NO);
                    Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatuPush, ShowErrorMode.NO);
                }
            })
            { IsBackground = true }.Start();
            });
        }
        /// <summary>
        /// 接受设备在线推送(不要忘记最后它会推送一个Null的东西过来)
        /// 接受设备在线推送
        /// </summary>
        /// <param name="device"></param>
        private void ReceiveDeviceStatuPush(CommonDevice device)
        {
            if (this.Parent == null || device == null)
            if (this.Parent == null)
            {
                //界面关闭
                return;
@@ -557,7 +558,7 @@
            listView.Height = frameLayoutDraw.Height;
            frameLayoutDraw.AddChidren(listView);
            new System.Threading.Thread(() =>
            HdlThreadLogic.Current.RunThread(() =>
            {
                var dicAlarm = HdlAlarmsLogic.Current.GetSafeguardAlarmInfo();
                var dicInfo = new Dictionary<string, Dictionary<int, List<SafeguardAlarmInfo>>>();
@@ -630,8 +631,7 @@
                    //开启传感器报警监视
                    this.StartCheckDeviceAlarm();
                });
            })
            { IsBackground = true }.Start();
            });
        }
        /// <summary>
@@ -711,7 +711,7 @@
        /// <summary>
        /// 自身的上层界面关闭后,它自身处于最上层时,触发的事件
        /// </summary>
        public override void FormActionAgainEvent()
        public override int FormActionAgainEvent()
        {
            //设置布防按钮的可视状态
            garrisonControl?.SetButtonVisible();
@@ -726,6 +726,7 @@
                //设置传感器数据到画面
                this.SetSensorDataToForm();
            }
            return 1;
        }
        #endregion