陈嘉乐
2020-07-10 48ba446936b51fffafa7c3600c0dadc6ac0e8c20
ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs
@@ -16,13 +16,13 @@
        /// </summary>
        private VerticalListControl listView = null;
        /// <summary>
        /// 住宅数据
        /// 住宅数据(有网时使用)
        /// </summary>
        private Dictionary<string, Common.ResponseEntity.ResidenceObj> dicResidenceData = null;
        /// <summary>
        /// 住宅顺序
        /// 住宅数据(无网时使用)
        /// </summary>
        private List<string> listResidenceSort = new List<string>();
        private List<House> listLocalHouse = null;
        #endregion
@@ -36,16 +36,20 @@
            //设置标题信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.ResidenceManagement));
            //右上添加按钮
            var btnTopIcon = new MostRightIconControl(69, 69);
            btnTopIcon.UnSelectedImagePath = "Item/Add.png";
            topFrameLayout.AddChidren(btnTopIcon);
            btnTopIcon.InitControl();
            btnTopIcon.ButtonClickEvent += (sender, e) =>
            //虚拟住宅无法新建住宅
            if (Common.Config.Instance.Home.IsVirtually == false)
            {
                //显示添加住宅名称的画面
                this.ShowAddNameForm();
            };
                //右上添加按钮
                var btnTopIcon = new MostRightIconControl(69, 69);
                btnTopIcon.UnSelectedImagePath = "Item/Add.png";
                topFrameLayout.AddChidren(btnTopIcon);
                btnTopIcon.InitControl();
                btnTopIcon.ButtonClickEvent += (sender, e) =>
                {
                    //显示添加住宅名称的画面
                    this.ShowAddNameForm();
                };
            }
            //初始化中部控件
            this.InitMiddleFrame();
@@ -59,67 +63,83 @@
            //清空bodyFrame
            this.ClearBodyFrame();
            //读取住宅顺序
            var strData = UserCenterLogic.LoadFileContent(UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ResidenceSortFile));
            if (strData != null)
            {
                listResidenceSort = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(strData);
                strData = null;
            }
            listView = new VerticalListControl(29);
            listView.Y = Application.GetRealHeight(-6);
            listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6);
            listView.BackgroundColor = UserCenterColor.Current.White;
            bodyFrameLayout.AddChidren(listView);
            HdlThreadLogic.Current.RunThread(() =>
            //设置住宅信息
            this.SetResidenceInfo(1);
        }
        /// <summary>
        /// 设置住宅信息(1:先读取云端,无法联网,再读取本地  2:只读云端  3:只读本地)
        /// </summary>
        /// <param name="div">1:先读取云端,无法联网,再读取本地  2:只读云端  3:只读本地</param>
        private void SetResidenceInfo(int div)
        {
            HdlThreadLogic.Current.RunThread(async () =>
            {
                //设置住宅信息
                this.SetResidenceInfo();
                //虚拟住宅的话,只读本地
                if (div == 3 || Config.Instance.Home.IsVirtually == true)
                {
                    //只读本地
                    this.SetResidenceInfoByOffline();
                }
                else
                {
                    //开启进度条
                    this.ShowProgressBar();
                    //设置住宅信息(有网情况)
                    var result = await this.SetResidenceInfoByOnline();
                    if (result == true)
                    {
                        //云端读取成功
                        this.CloseProgressBar();
                        return;
                    }
                    if (div == 2)
                    {
                        //如果只读云端 关闭进度条
                        this.CloseProgressBar(ShowReLoadMode.YES);
                        return;
                    }
                    //如果在没网的情况下,从文件夹路径中获取全部住宅,然后显示
                    this.SetResidenceInfoByOffline();
                    //关闭进度条
                    this.CloseProgressBar();
                }
            });
        }
        #endregion
        #region ■ 设置住宅信息_______________________
        #region ■ 设置住宅信息(有网情况)_____________
        /// <summary>
        /// 设置住宅信息
        /// 设置住宅信息(有网情况)
        /// </summary>
        private async void SetResidenceInfo()
        private async System.Threading.Tasks.Task<bool> SetResidenceInfoByOnline()
        {
            //开启进度条
            this.ShowProgressBar();
            //获取住宅信息
            var Pra = new GetResidenceInfoPra();
            string resultData = await UserCenterLogic.GetResponseDataByRequestHttps("App/GetHomePager", false, Pra);
            var listNotCheck = new List<string>() { "NotSetAgain" };
            string resultData = await UserCenterLogic.GetResponseDataByRequestHttps("App/GetHomePager", false, Pra, listNotCheck);
            if (resultData == null)
            {
                //关闭进度条
                this.CloseProgressBar(ShowReLoadMode.YES);
                return;
                return false;
            }
            //关闭进度条
            this.CloseProgressBar();
            var pageData = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.ResidenceRes>(resultData);
            //暂时存储数据
            var dicData = new Dictionary<string, Common.ResponseEntity.ResidenceObj>();
            var listResidenceSort = new List<string>();
            for (int i = 0; i < pageData.PageData.Count; i++)
            {
                dicData[pageData.PageData[i].Id] = pageData.PageData[i];
                if (listResidenceSort.Contains(pageData.PageData[i].Id) == false)
                {
                    //新添加的住宅
                    listResidenceSort.Add(pageData.PageData[i].Id);
                }
                listResidenceSort.Add(pageData.PageData[i].Id);
            }
            //保存顺序
            string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ResidenceSortFile);
            UserCenterLogic.SaveFileContent(fullName, listResidenceSort);
            HdlThreadLogic.Current.RunMain(() =>
            {
@@ -127,33 +147,33 @@
                {
                    return;
                }
                listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6);
                listView.Height = bodyFrameLayout.Height;
                this.dicResidenceData = new Dictionary<string, Common.ResponseEntity.ResidenceObj>();
                for (int i = 0; i < listResidenceSort.Count; i++)
                {
                    var info = dicData[listResidenceSort[i]];
                    if (info.IsOthreShare == false)
                    if (dicData.ContainsKey(listResidenceSort[i]) == false)
                    {
                        //收集该账号所拥有的自己的住宅的数据
                        this.dicResidenceData[info.Id] = info;
                        continue;
                    }
                    this.AddRowLayout(info, i != listResidenceSort.Count - 1);
                    var info = dicData[listResidenceSort[i]];
                    //收集该账号住宅的数据
                    this.dicResidenceData[info.Id] = info;
                    //添加住宅的行(有网情况)
                    this.AddRowLayoutByOnline(info, i != listResidenceSort.Count - 1);
                }
                //调整列表控件的高度
                this.listView.AdjustRealHeight(Application.GetRealHeight(23));
            });
            return true;
        }
        #endregion
        #region ■ 添加住宅的行_______________________
        /// <summary>
        /// 添加住宅的行
        /// 添加住宅的行(有网情况)
        /// </summary>
        /// <param name="info"></param>
        private void AddRowLayout(Common.ResponseEntity.ResidenceObj info, bool addLine)
        private void AddRowLayoutByOnline(Common.ResponseEntity.ResidenceObj info, bool addLine)
        {
            var rowLayout = new RowLayoutControl(listView.rowSpace / 2);
            this.listView.AddChidren(rowLayout);
@@ -169,14 +189,14 @@
                btnHome = rowLayout.frameTable.AddLeftCaption(info.Name, 800, 60, true);
                btnHome.TextSize = 15;
                btnHome.Y = Application.GetRealHeight(12) + rowLayout.chidrenYaxis;
                rowLayout.frameTable.AddChidren(btnHome, ChidrenBindMode.BindEventOnly);
                rowLayout.frameTable.AddChidren(btnHome, ChidrenBindMode.BindEvent);
                //当前住宅
                var btnNowView = rowLayout.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNowResidence), 800, 49, true);
                btnNowView.Y = Application.GetRealHeight(72) + rowLayout.chidrenYaxis;
                btnNowView.TextSize = 12;
                btnNowView.TextColor = UserCenterColor.Current.TextGrayColor1;
                rowLayout.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEventOnly);
                rowLayout.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEvent);
            }
            else
            {
@@ -206,20 +226,21 @@
                    {
                        HdlThreadLogic.Current.RunThread(async () =>
                        {
                            ProgressBar.Show();
                            Config.Instance.HomeId = info.Id;
                            Global.CreateHomeDirectory(info.Id);
                            Config.Instance.Save();
                            //刷新个人中心的内存及线程
                            await UserCenterLogic.InitUserCenterMenmoryAndThread();
                            //开启进度条
                            this.ShowProgressBar();
                            Room.InitAllRoom();
                            //检测本地有没有这个住宅
                            this.CheckIsExsitResidence(info);
                            await HdlResidenceLogic.Current.SwitchResidence(info.Id);
                            HdlThreadLogic.Current.RunMain(() =>
                            {
                                //重新刷新列表
                                this.listView.RemoveAll();
                                this.SetResidenceInfo();
                                this.SetResidenceInfo(2);
                                //关闭进度条
                                this.CloseProgressBar();
                            });
                        });
                    });
@@ -239,17 +260,130 @@
                return;
            }
            //更改
            var btnChanged = new NormalViewControl(Application.GetRealWidth(184), rowLayout.Height, false);
            btnChanged.BackgroundColor = 0xff4a4a4a;
            btnChanged.TextSize = 12;
            btnChanged.TextColor = UserCenterColor.Current.White;
            btnChanged.TextAlignment = TextAlignment.Center;
            var btnChanged = rowLayout.AddEditorControl();
            btnChanged.TextID = R.MyInternationalizationString.uChanged1;
            rowLayout.AddRightView(btnChanged);
            btnChanged.ButtonClickEvent += (sender, e) =>
            {
                //显示编辑名称界面
                this.ShowEditorNameForm(info, btnHome);
                this.ShowEditorNameForm(info, null, btnHome);
            };
        }
        #endregion
        #region ■ 设置住宅信息(无网情况)_____________
        /// <summary>
        /// 设置住宅信息(无网情况)
        /// </summary>
        private void SetResidenceInfoByOffline()
        {
            //从文件夹中获取全部的住宅对象
            this.listLocalHouse = HdlResidenceLogic.Current.GetAllLocalResidenceListByDirectory();
            if (listLocalHouse.Count == 0)
            {
                return;
            }
            HdlThreadLogic.Current.RunMain(() =>
            {
                listView.Height = bodyFrameLayout.Height;
                for (int i = 0; i < listLocalHouse.Count; i++)
                {
                    //添加住宅的行(无网情况)
                    this.AddRowLayoutByOffline(listLocalHouse[i], i != listLocalHouse.Count - 1);
                }
                //调整列表控件的高度
                this.listView.AdjustRealHeight(Application.GetRealHeight(23));
            });
        }
        /// <summary>
        /// 添加住宅的行(无网情况)
        /// </summary>
        /// <param name="i_home"></param>
        private void AddRowLayoutByOffline(House i_home, bool addLine)
        {
            var rowLayout = new RowLayoutControl(listView.rowSpace / 2);
            this.listView.AddChidren(rowLayout);
            //图标
            var btnIcon = rowLayout.frameTable.AddLeftIcon(81);
            btnIcon.UnSelectedImagePath = "Item/ResidenceIcon.png";
            //当前住宅
            NormalViewControl btnHome = null;
            if (i_home.Id == Config.Instance.Home.Id)
            {
                //住宅名称
                btnHome = rowLayout.frameTable.AddLeftCaption(i_home.Name, 800, 60, true);
                btnHome.TextSize = 15;
                btnHome.Y = Application.GetRealHeight(12) + rowLayout.chidrenYaxis;
                rowLayout.frameTable.AddChidren(btnHome, ChidrenBindMode.BindEvent);
                //当前住宅
                var btnNowView = rowLayout.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNowResidence), 800, 49, true);
                btnNowView.Y = Application.GetRealHeight(72) + rowLayout.chidrenYaxis;
                btnNowView.TextSize = 12;
                btnNowView.TextColor = UserCenterColor.Current.TextGrayColor1;
                rowLayout.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEvent);
            }
            else
            {
                //住宅名称
                btnHome = rowLayout.frameTable.AddLeftCaption(i_home.Name, 800, true);
                btnHome.TextSize = 15;
            }
            //右箭头
            rowLayout.frameTable.AddRightArrow();
            if (addLine == true)
            {
                //底线
                rowLayout.frameTable.AddBottomLine();
            }
            rowLayout.frameTable.ButtonClickEvent += (sender, e) =>
            {
                if (i_home.Id != Config.Instance.Home.Id)
                {
                    //确认切换当前住宅到「」?
                    string msg = Language.StringByID(R.MyInternationalizationString.uSwitchResidenceMsg);
                    if (msg.Contains("{0}") == true)
                    {
                        msg = string.Format(msg, i_home.Name);
                    }
                    this.ShowMassage(ShowMsgType.Confirm, msg, () =>
                    {
                        HdlThreadLogic.Current.RunThread(async () =>
                        {
                            await HdlResidenceLogic.Current.SwitchResidence(i_home.Id);
                            HdlThreadLogic.Current.RunMain(() =>
                            {
                                //重新刷新列表
                                this.listView.RemoveAll();
                                this.SetResidenceInfo(3);
                                //关闭进度条
                                this.CloseProgressBar();
                            });
                        });
                    });
                }
                else
                {
                    //检测能否删除住宅
                    bool flage = this.CheckIsCanDeleteResidence(i_home);
                    var form = new ResidenceManagementForm();
                    form.AddForm(flage);
                }
            };
            //更改
            var btnChanged = rowLayout.AddEditorControl();
            btnChanged.TextID = R.MyInternationalizationString.uChanged1;
            btnChanged.ButtonClickEvent += (sender, e) =>
            {
                //显示编辑名称界面
                this.ShowEditorNameForm(null, i_home, btnHome);
            };
        }
@@ -260,16 +394,18 @@
        /// <summary>
        /// 显示编辑住宅名称界面
        /// </summary>
        /// <param name="info"></param>
        private void ShowEditorNameForm(Common.ResponseEntity.ResidenceObj info, NormalViewControl btnHome)
        /// <param name="info">有网时使用</param>
        /// <param name="i_house">无网时适用</param>
        private void ShowEditorNameForm(Common.ResponseEntity.ResidenceObj info, House i_house, NormalViewControl btnHome)
        {
            string oldName = info != null ? info.Name : i_house.Name;
            //生成一个弹窗画面
            var dialogForm = new DialogInputFrameControl(this, DialogFrameMode.OnlyInput);
            var dialogForm = new DialogInputControl();
            //编辑住宅
            dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uChangedName));
            //请输入住宅名称
            dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInputResidenceName));
            dialogForm.Text = info.Name;
            dialogForm.Text = oldName;
            //按下确认按钮
            dialogForm.ComfirmClickEvent += ((textValue) =>
@@ -283,11 +419,25 @@
                }
                //画面关闭
                dialogForm.CloseDialog();
                if (info.Name != textValue)
                if (oldName != textValue)
                {
                    //编辑云端的住宅名称
                    this.EditorResidenceName(textValue, info);
                    if (info != null)
                    {
                        //编辑云端的住宅名称
                        this.EditorResidenceName(textValue, info, btnHome);
                    }
                    else
                    {
                        //直接编辑住宅缓存
                        if (this.CheckIsCanSaveResidence(i_house.Id, textValue, true) == false)
                        {
                            return;
                        }
                        //刷新内存的住宅名
                        HdlResidenceLogic.Current.EditorHouseByHouseId(i_house.Id, textValue);
                        //更改显示的名字
                        btnHome.Text = textValue;
                    }
                }
            });
        }
@@ -298,7 +448,7 @@
        /// <param name="ResidenceName"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        private async void EditorResidenceName(string ResidenceName, Common.ResponseEntity.ResidenceObj info)
        private async void EditorResidenceName(string ResidenceName, Common.ResponseEntity.ResidenceObj info, NormalViewControl btnHome)
        {
            //检测能否保存住宅
            if (this.CheckIsCanSaveResidence(info.Id, ResidenceName, true) == false)
@@ -311,23 +461,22 @@
            var Pra = new EditorResidencePra();
            Pra.HomeId = info.Id;
            Pra.Name = ResidenceName;
            if (info.IsOthreShare == true)
            {
                Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
            }
            Pra.IsOtherAccountCtrl = false;
            Pra.LoginAccessToken = Config.Instance.Token;
            //编辑住宅
            bool flage = await UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", info.IsOthreShare, Pra);
            if (flage == false)
            bool flage = await UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", false, Pra);
            //关闭进度条
            this.CloseProgressBar();
            if (flage == true)
            {
                //关闭进度条
                this.CloseProgressBar();
                return;
                //刷新内存的住宅名
                HdlResidenceLogic.Current.EditorHouseByHouseId(info.Id, ResidenceName);
                //更改显示的名字
                btnHome.Text = ResidenceName;
                info.Name = ResidenceName;
            }
            //刷新内存的住宅名
            House.EditorHouseByHouseId(info.Id, ResidenceName);
            //重新刷新列表
            this.listView.RemoveAll();
            this.SetResidenceInfo();
        }
        #endregion
@@ -340,7 +489,7 @@
        private void ShowAddNameForm()
        {
            //生成一个弹窗画面
            var dialogForm = new DialogInputFrameControl(this, DialogFrameMode.OnlyInput);
            var dialogForm = new DialogInputControl();
            //创建住宅
            dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uCreatResidence));
            //请输入住宅名称
@@ -391,10 +540,10 @@
            var newInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<NewResidenceInfo>>(resultData);
            House.AddHouse(newInfo[0].Id, ResidenceName, 0);
            HdlResidenceLogic.Current.AddHouseToMemmory(newInfo[0].Id, ResidenceName);
            //重新刷新列表
            this.listView.RemoveAll();
            this.SetResidenceInfo();
            this.SetResidenceInfo(2);
        }
        #endregion
@@ -402,26 +551,88 @@
        #region ■ 一般方法___________________________
        /// <summary>
        /// 检测能否删除住宅
        /// 检测本地有没有这个住宅
        /// </summary>
        /// <param name="info"></param>
        private void CheckIsExsitResidence(Common.ResponseEntity.ResidenceObj info)
        {
            var path = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, info.Id);
            bool isExsit = System.IO.Directory.Exists(path);
            if (isExsit == true) { return; }
            //创建文件夹
            Global.CreateHomeDirectory(info.Id);
            //创建新的住宅
            var house = new House();
            house.Id = info.Id;
            house.Name = info.Name;
            house.IsOthreShare = info.IsOthreShare;
            house.AccountType = info.AccountType;
            house.MainUserDistributedMark = info.MainUserDistributedMark;
            house.Longitude = info.Longitude;
            house.Latitude = info.Latitude;
            house.Save(false);
            string fileName = house.FileName;
            if (Config.Instance.HomeFilePathList.Contains(fileName) == false)
            {
                //添加列表
                Config.Instance.HomeFilePathList.Add(fileName);
            }
        }
        /// <summary>
        /// 检测能否删除住宅(有网使用)
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        private bool CheckIsCanDeleteResidence(Common.ResponseEntity.ResidenceObj info)
        {
            if (this.dicResidenceData.Count == 1)
            if (info.IsOthreShare == false)
            {
                //如果此账号下只剩下唯一一个自己的住宅,当删除这个住宅时,提示不能删除
                //因为最少要有一个住宅
                if (this.dicResidenceData.ContainsKey(info.Id) == true)
                int myCount = 0;
                foreach (var data in this.dicResidenceData.Values)
                {
                    if (data.IsOthreShare == false)
                    {
                        myCount++;
                    }
                }
                //如果此账号下只剩下唯一一个自己的住宅,则不能再删除
                if (myCount == 1)
                {
                    return false;
                }
            }
            if (info.IsOthreShare == true)
            return true;
        }
        /// <summary>
        /// 检测能否删除住宅(无网使用)
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        private bool CheckIsCanDeleteResidence(House i_house)
        {
            if (i_house.IsVirtually == false)
            {
                //分享过来的住宅不能删除
                //非虚拟住宅都不允许删除,只有在能联网的时候,才能删除
                return false;
            }
            int myCount = 0;
            foreach (var data in this.listLocalHouse)
            {
                if (data.IsVirtually == true)
                {
                    myCount++;
                }
            }
            //如果此账号下只剩下唯一一个虚拟的住宅,则不能再删除
            if (myCount == 1)
            {
                return false;
            }
            return true;
        }
@@ -434,16 +645,43 @@
        /// <returns></returns>
        private bool CheckIsCanSaveResidence(string residenceId, string residenceName, bool isEditor)
        {
            //住宅名字重复检测
            foreach (string strId in this.dicResidenceData.Keys)
            if (this.dicResidenceData != null)
            {
                if (residenceId != strId && residenceName == this.dicResidenceData[strId].Name)
                //住宅名字重复检测
                foreach (string strId in this.dicResidenceData.Keys)
                {
                    //住宅名字已经存在
                    int msgId = isEditor == true ? R.MyInternationalizationString.EditZigbeeHome_Exist : R.MyInternationalizationString.AddZigbeeHome_Exist;
                    string msg = Language.StringByID(msgId);
                    this.ShowMassage(ShowMsgType.Error, msg);
                    return false;
                    if (this.dicResidenceData[strId].IsOthreShare == true)
                    {
                        //分享的住宅不考虑
                        continue;
                    }
                    if (residenceId != strId && residenceName == this.dicResidenceData[strId].Name)
                    {
                        //住宅名字已经存在
                        int msgId = isEditor == true ? R.MyInternationalizationString.EditZigbeeHome_Exist : R.MyInternationalizationString.AddZigbeeHome_Exist;
                        string msg = Language.StringByID(msgId);
                        this.ShowMassage(ShowMsgType.Error, msg);
                        return false;
                    }
                }
            }
            else
            {
                foreach (var myHouse in this.listLocalHouse)
                {
                    if (myHouse.IsOthreShare == true)
                    {
                        //分享的住宅不考虑
                        continue;
                    }
                    if (residenceId != myHouse.Id && residenceName == myHouse.Name)
                    {
                        //住宅名字已经存在
                        int msgId = isEditor == true ? R.MyInternationalizationString.EditZigbeeHome_Exist : R.MyInternationalizationString.AddZigbeeHome_Exist;
                        string msg = Language.StringByID(msgId);
                        this.ShowMassage(ShowMsgType.Error, msg);
                        return false;
                    }
                }
            }
            return true;
@@ -458,22 +696,34 @@
        /// </summary>
        public override int FormActionAgainEvent()
        {
            foreach (string keys in dicResidenceData.Keys)
            if (dicResidenceData != null)
            {
                if (Config.Instance.HomeFilePathList.Contains($"House_{keys}.json") == false)
                foreach (string keys in dicResidenceData.Keys)
                {
                    //保存顺序
                    listResidenceSort.Remove(keys);
                    Room.CurrentRoom.SaveFloorSort(listResidenceSort);
                    this.listView.RemoveAll();
                    //数据已经变更
                    HdlThreadLogic.Current.RunThread(() =>
                    if (Config.Instance.HomeFilePathList.Contains($"House_{keys}.json") == false)
                    {
                        //重新设置住宅信息
                        this.SetResidenceInfo();
                    });
                    break;
                        this.listView.RemoveAll();
                        //数据已经变更 重新设置住宅信息
                        this.SetResidenceInfo(2);
                        break;
                    }
                }
            }
            else
            {
                //检测还有这个住宅文件吗
                var strPath = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid);
                foreach (var myHouse in this.listLocalHouse)
                {
                    string fullName = System.IO.Path.Combine(strPath, myHouse.FileName);
                    //如果不存在了的话
                    if (System.IO.File.Exists(fullName) == false)
                    {
                        //数据已经变更 重新设置住宅信息
                        this.listView.RemoveAll();
                        this.SetResidenceInfo(3);
                        return 1;
                    }
                }
            }
            return 1;
@@ -513,7 +763,7 @@
            public PageSettingInfo PageSetting = new PageSettingInfo()
            {
                Page = 1,
                PageSize = 500
                PageSize = 5000
            };
        }
@@ -545,29 +795,6 @@
            /// ZigbeeHomeGuid
            /// </summary>
            public string Id = string.Empty;
        }
        /// <summary>
        ///  编辑住宅的启动参数
        /// </summary>
        public class EditorResidencePra : IfacePraCommon
        {
            /// <summary>
            /// RequestVersion
            /// </summary>
            public string RequestVersion = Common.CommonPage.RequestVersion;
            /// <summary>
            /// LoginAccessToken
            /// </summary>
            public string LoginAccessToken = Common.Config.Instance.Token;
            /// <summary>
            /// ZigbeeHomeId
            /// </summary>
            public string HomeId = "";
            /// <summary>
            /// Name
            /// </summary>
            public string Name = string.Empty;
        }
        #endregion