黄学彪
2020-01-09 fa6bcb2e9907772480f99205f36ec2a1ce735a22
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -132,21 +132,10 @@
            frame.AddChidren(listView);
            listView.BeginHeaderRefreshingAction += () =>
            {
                //下拉刷新
                HdlThreadLogic.Current.RunThread(() =>
                {
                    //获取全部设备
                    bool result = LocalDevice.Current.SetDeviceToMemmoryByGateway(GatewayResourse.NowSelectGateway);
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        //隐藏下拉刷新特效
                        listView.EndHeaderRefreshing();
                        if (result == true)
                        {
                            //重新刷新界面
                            this.InitMiddleFrame(false);
                        }
                    });
                    //下拉刷新
                    this.ListViewBeginHeaderRefreshing();
                });
            };
        }
@@ -175,6 +164,10 @@
            //根据MAC合并设备列表
            this.MargeAllDeviceByMac(listDevice);
            if (this.Parent == null)
            {
                return;
            }
            HdlThreadLogic.Current.RunMain(() =>
            {
                var listOta = new List<OTADevice>();
@@ -528,6 +521,60 @@
        #endregion
        #region ■ 下拉刷新___________________________
        /// <summary>
        /// 滑动控件下拉刷新
        /// </summary>
        private async void ListViewBeginHeaderRefreshing()
        {
            //如果是在线的
            if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(GatewayResourse.NowSelectGateway) == true)
            {
                //检测广播到的这个网关是否拥有住宅ID
                ZbGateway realWay = null;
                if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, GatewayResourse.NowSelectGateway) == true)
                {
                    //重新设置住宅ID(这个应该是不经过APP,直接把网关恢复了出厂设置)
                    if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true)
                    {
                        //显示进度条
                        ProgressBar.Show();
                        int result2 = await HdlGatewayLogic.Current.ReBindNewGateway(realWay);
                        //关闭进度条
                        ProgressBar.Close();
                        if (result2 == -1)
                        {
                            return;
                        }
                    }
                }
            }
            if (this.Parent == null)
            {
                return;
            }
            //获取全部设备
            int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(GatewayResourse.NowSelectGateway);
            if (this.Parent == null)
            {
                return;
            }
            HdlThreadLogic.Current.RunMain(() =>
            {
                //隐藏下拉刷新特效
                listView.EndHeaderRefreshing();
                if (result != -1)
                {
                    //重新刷新界面
                    this.InitMiddleFrame(false);
                }
            });
        }
        #endregion
        #region ■ 网关在线检测_______________________
        /// <summary>
@@ -625,7 +672,16 @@
            {
                //这里主要只是获取在线状态
                var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId);
                var result = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatu, ShowErrorMode.NO);
                int statu = 0;
                var list = LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
                if (statu != -1)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        //设置设备在线状态
                        this.ReceiveDeviceStatu(list[i]);
                    }
                }
            });
        }