xm
2020-07-21 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d
ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
@@ -24,14 +24,6 @@
        /// </summary>
        private VerticalFrameControl listBackContr = null;
        /// <summary>
        /// 楼层顺序
        /// </summary>
        private List<string> listFloorSort = new List<string>();
        /// <summary>
        /// 房间顺序
        /// </summary>
        private List<string> listRoomSort = new List<string>();
        /// <summary>
        /// 当前APP的住宅模式 0:还没有设置有模式 1:楼层模式 2:没有楼层模式
        /// </summary>
        private int AppResidenceMode = 0;
@@ -282,23 +274,17 @@
        {
            //获取楼层
            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
            this.listFloorSort.Clear();
            foreach (string keys in dicFloor.Keys)
            {
                listFloorSort.Add(keys);
            }
            if (Common.Config.Instance.Home.FloorDics.Count == 0)
            if (dicFloor.Count == 0)
            {
                return;
            }
            HdlThreadLogic.Current.RunMainInThread(() =>
            {
                int count = listFloorSort.Count - 1;
                for (int i = 0; i < listFloorSort.Count; i++)
                int count = dicFloor.Count;
                foreach (var keys in dicFloor.Keys)
                {
                    string keys = listFloorSort[i];
                    this.AddFloorRow(keys, dicFloor[keys], i != count);
                    count--;
                    this.AddFloorRow(keys, dicFloor[keys], count != 0);
                }
                //调整控件高度
                this.AdjustContrlTableHeight();
@@ -366,11 +352,11 @@
                        Common.Config.Instance.Home.FloorDics.Remove(keys);
                        if (Common.Config.Instance.Home.CurrentFloorId == keys)
                        {
                            //如果删除的是当前楼层的话
                            Common.Config.Instance.Home.CurrentFloorId = string.Empty;
                            foreach (string floorId in Common.Config.Instance.Home.FloorDics.Keys)
                            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
                            foreach (var floorId in dicFloor.Keys)
                            {
                                //把第一个楼层ID给它
                                //把第一个楼层赋值给当前楼层
                                Common.Config.Instance.Home.CurrentFloorId = floorId;
                                break;
                            }
@@ -392,9 +378,6 @@
                            HdlRoomLogic.Current.RemoveRoom(roomId);
                        }
                        Common.Config.Instance.Home.Save();
                        //保存顺序
                        listFloorSort.Remove(keys);
                        HdlRoomLogic.Current.SaveFloorSort(listFloorSort);
                        if (Common.Config.Instance.Home.FloorDics.Count == 0)
                        {
@@ -423,7 +406,7 @@
                            this.AdjustContrlTableHeight();
                        }
                        //删除楼层的话,主页需要重新刷新
                        UserView.UserPage.Instance.RefreshForm = true;
                        UserView.UserPage.Instance.RefreshAllForm = true;
                    });
                };
            }
@@ -481,7 +464,6 @@
                    Common.Config.Instance.Home.Save();
                    if (Common.Config.Instance.Home.CurrentFloorId == string.Empty)
                    {
                        Common.Config.Instance.Home.CurrentFloorId = keys;
                        //创建第一个新的楼层的话,需要去刷新主页左边的房间列表
                        HdlRoomLogic.Current.RefreshRoomListView();
                    }
@@ -495,7 +477,7 @@
                        this.InitFrameTableByMode();
                    }
                    //创建或者修改楼层的话,主页需要重新刷新
                    UserView.UserPage.Instance.RefreshForm = true;
                    UserView.UserPage.Instance.RefreshAllForm = true;
                }
            });
        }
@@ -540,12 +522,6 @@
        {
            //获取楼层的房间
            var listRoom = HdlRoomLogic.Current.GetFloorSortRoom(string.Empty);
            this.listRoomSort.Clear();
            for (int i = 0; i < listRoom.Count; i++)
            {
                this.listRoomSort.Add(listRoom[i].Id);
            }
            for (int i = 0; i < listRoom.Count; i++)
            {
                //添加房间行
@@ -593,7 +569,6 @@
                //如果是分享的房间,不能编辑和修改
                return;
            }
            //编辑
            var btnEditor = frameRow.AddEditorControl();
            btnEditor.ButtonClickEvent += (sender, e) =>
@@ -614,9 +589,6 @@
                this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uDeleteRoomMsg), () =>
                {
                    HdlRoomLogic.Current.RemoveRoom(room.Id);
                    //保存顺序
                    this.listRoomSort.Remove(room.Id);
                    HdlRoomLogic.Current.SaveRoomSort(string.Empty, this.listRoomSort);
                    var listAllRoom = HdlRoomLogic.Current.GetAllListRooms();
                    if (listAllRoom.Count <= 1)
@@ -646,7 +618,7 @@
                        this.AdjustContrlTableHeight();
                    }
                    //删除房间的话,主页需要重新刷新
                    UserView.UserPage.Instance.RefreshForm = true;
                    UserView.UserPage.Instance.RefreshAllForm = true;
                });
            };
        }
@@ -658,7 +630,7 @@
        /// <summary>
        /// 删除住宅
        /// </summary>
        public async void DeleteResidence()
        private void DeleteResidence()
        {
            //开启进度条
            this.ShowProgressBar();
@@ -670,7 +642,7 @@
                Pra.HomeId = Common.Config.Instance.Home.Id;
                Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
                bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra);
                bool result = UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra);
                if (result == false)
                {
                    //关闭进度条
@@ -686,7 +658,7 @@
                    HomeId = Common.Config.Instance.Home.Id,
                    PrimaryUserId = Common.Config.Instance.Home.MainUserDistributedMark
                };
                bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/SubAccountDelShareHome", false, Pra2);
                bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/SubAccountDelShareHome", false, Pra2);
                if (result == false)
                {
                    //关闭进度条
@@ -725,7 +697,7 @@
            Common.Config.Instance.Save();
            //刷新个人中心的内存及线程
            await UserCenterLogic.InitUserCenterMenmoryAndThread(false);
            UserCenterLogic.InitUserCenterMenmoryAndThread(false);
            //删除住宅
            HdlResidenceLogic.Current.DeleteHouseMemmory(deleteId);
@@ -748,7 +720,7 @@
        /// <param name="latitude">纬度</param>
        /// <param name="longitude">经度</param>
        /// <param name="addresName">位置名称</param>
        private async void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude, string addresName)
        private void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude, string addresName)
        {
            //如果不是虚拟住宅,才更新云端
            if (Common.Config.Instance.Home.IsVirtually == false)
@@ -764,7 +736,7 @@
                Pra.Longitude = longitude;
                //编辑住宅
                bool flage = await UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", true, Pra);
                bool flage = UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", true, Pra);
                if (flage == false)
                {
                    //关闭进度条