黄学彪
2020-08-07 ec34983e291d1c85284472a27109d55891f9a6b5
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -151,7 +151,7 @@
            listView.BeginHeaderRefreshingAction += () =>
            {
                //刷新设备的话,主页需要重新刷新
                UserView.UserPage.Instance.RefreshForm = true;
                UserView.UserPage.Instance.RefreshAllForm = true;
                HdlThreadLogic.Current.RunThread(() =>
                {
@@ -269,7 +269,8 @@
            btnRight.ButtonClickEvent += (sender, e) =>
            {
                //回路数大于1才展开
                if (Common.LocalDevice.Current.GetDevicesCountByMac(deviceMac) > 1)
                var listMacDevice = LocalDevice.Current.GetDevicesByMac(deviceMac, false);
                if (listMacDevice.Count > 1)
                {
                    btnRight.IsSelected = !btnRight.IsSelected;
                    //展开或者折叠明细列表
@@ -277,9 +278,20 @@
                }
                else
                {
                    if (LocalDevice.Current.IsMiniLight(listMacDevice[0]) == true)
                    {
                        //mini夜灯的功能设置界面
                        var room = HdlRoomLogic.Current.GetRoomByDevice(listMacDevice[0]);
                        var form = new MainPage.DeviceDetailInfoForm();
                        form.AddForm(listMacDevice[0], room);
                    }
                    else
                    {
                        //设备信息界面
                        var form = new DeviceMacInfoEditorForm();
                        form.AddForm(deviceMac);
                    }
                    btnNew.Visible = false;
                    var form = new DeviceMacInfoEditorForm();
                    form.AddForm(deviceMac);
                    //界面跳转,记录当前的正在操作的设备的Mac地址
                    this.nowActionDeviceMac = deviceMac;
                }
@@ -296,9 +308,22 @@
                    form2.AddForm(deviceMac);
                    return;
                }
                var listMacDevice = LocalDevice.Current.GetDevicesByMac(deviceMac, false);
                if (LocalDevice.Current.IsMiniLight(listMacDevice[0]) == true)
                {
                    //mini夜灯的功能设置界面
                    var room = HdlRoomLogic.Current.GetRoomByDevice(listMacDevice[0]);
                    var form = new MainPage.DeviceDetailInfoForm();
                    form.AddForm(listMacDevice[0], room);
                }
                else
                {
                    //设备信息界面
                    var form = new DeviceMacInfoEditorForm();
                    form.AddForm(deviceMac);
                }
                btnNew.Visible = false;
                var form = new DeviceMacInfoEditorForm();
                form.AddForm(deviceMac);
                //界面跳转,记录当前的正在操作的设备的Mac地址
                this.nowActionDeviceMac = deviceMac;
            };
@@ -625,7 +650,7 @@
        {
            lock (dicRowInfo)
            {
                Application.RunOnMainThread(() =>
                HdlThreadLogic.Current.RunMain(() =>
                {
                    if (this.listView == null)
                    {
@@ -674,7 +699,7 @@
        /// <summary>
        /// 滑动控件下拉刷新
        /// </summary>
        private async void ListViewBeginHeaderRefreshing()
        private void ListViewBeginHeaderRefreshing()
        {
            //如果当前住宅是虚拟的
            if (Common.Config.Instance.Home.IsVirtually == true)
@@ -701,7 +726,7 @@
                    {
                        //显示进度条
                        ProgressBar.Show();
                        int result2 = await HdlGatewayLogic.Current.ReBindNewGateway(realWay);
                        int result2 = HdlGatewayLogic.Current.ReBindNewGateway(realWay);
                        //关闭进度条
                        ProgressBar.Close();
                        if (result2 == -1)
@@ -717,7 +742,7 @@
            }
            //获取全部设备
            int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(nowGateway);
            int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(nowGateway, false);
            if (this.Parent == null)
            {
                return;
@@ -754,7 +779,7 @@
                //刷新网关在线状态
                HdlGatewayLogic.Current.RefreshGatewayOnlineStatu(new List<ZbGateway>() { zbGateway });
                Application.RunOnMainThread(() =>
                HdlThreadLogic.Current.RunMain(() =>
                {
                    if (this.gatewayViewRow != null && this.gatewayViewRow.zbGatewayId == selectGwId)
                    {
@@ -782,7 +807,7 @@
            }
            if (gateWay.GwId == this.gatewayViewRow.zbGatewayId)
            {
                Application.RunOnMainThread(() =>
                HdlThreadLogic.Current.RunMain(() =>
                {
                    //相同的状态,不需要再次刷新
                    if (this.gatewayViewRow.isOnline != online)
@@ -848,7 +873,7 @@
                                this.ReceiveDeviceStatu(device);
                            }, ShowErrorMode.NO);
                        }
                        System.Threading.Thread.Sleep(30);
                        System.Threading.Thread.Sleep(50);
                    }
                }
            });
@@ -1034,14 +1059,27 @@
        {
            if (this.dicRowInfo.ContainsKey(deviceAddr) == true)
            {
                var row = this.dicRowInfo[deviceAddr];
                row.MenuRow?.RefreshControlInfo(true);
                //明细
                if (row.dicDetailRow != null)
                var rowInfo = this.dicRowInfo[deviceAddr];
                //检测这个设备是否被删除 2020.01.13变更:追加Ota设备的判断
                if (LocalDevice.Current.GetDevicesByMac(deviceAddr).Count == 0
                    && LocalDevice.Current.GetOTADevice(deviceAddr) == null)
                {
                    foreach (var detailRow in row.dicDetailRow.Values)
                    //移除控件
                    rowInfo.dicDetailRow = null;
                    rowInfo.frameTable.RemoveFromParent();
                    this.dicRowInfo.Remove(deviceAddr);
                }
                else
                {
                    //刷新设备信息
                    rowInfo.MenuRow?.RefreshControlInfo(true);
                    if (rowInfo.dicDetailRow != null)
                    {
                        detailRow.RefreshControlInfo();
                        foreach (var contr in rowInfo.dicDetailRow.Values)
                        {
                            contr?.RefreshControlInfo();
                        }
                    }
                }
            }
@@ -1107,30 +1145,8 @@
        {
            if (this.nowActionDeviceMac != null)
            {
                var rowInfo = this.dicRowInfo[nowActionDeviceMac];
                //检测这个设备是否被删除 2020.01.13变更:追加Ota设备的判断
                if (Common.LocalDevice.Current.GetDevicesByMac(nowActionDeviceMac).Count == 0
                    && Common.LocalDevice.Current.GetOTADevice(nowActionDeviceMac) == null)
                {
                    //移除控件
                    rowInfo.dicDetailRow = null;
                    rowInfo.frameTable.RemoveFromParent();
                    this.dicRowInfo.Remove(nowActionDeviceMac);
                    rowInfo = null;
                }
                else
                {
                    //刷新设备信息
                    rowInfo.MenuRow?.RefreshControlInfo(true);
                    if (rowInfo.dicDetailRow != null)
                    {
                        foreach (var contr in rowInfo.dicDetailRow.Values)
                        {
                            contr?.RefreshControlInfo();
                        }
                    }
                }
                //刷新指定设备行的信息
                this.RefreshDeviceRow(this.nowActionDeviceMac);
            }
            //清空记录
            this.nowActionDeviceMac = null;