From dce6c3481a37216292724013ff9d2b75ceb82f86 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期三, 10 六月 2020 15:47:28 +0800 Subject: [PATCH] 添加小度的代码 --- ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs | 64 +++++-------------------------- 1 files changed, 11 insertions(+), 53 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs index f50091f..2ac9c0a 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs @@ -23,10 +23,6 @@ /// 浣忓畢鏁版嵁(鏃犵綉鏃朵娇鐢�) /// </summary> private List<House> listLocalHouse = null; - /// <summary> - /// 浣忓畢椤哄簭 - /// </summary> - private List<string> listResidenceSort = new List<string>(); #endregion @@ -66,13 +62,6 @@ { //娓呯┖bodyFrame this.ClearBodyFrame(); - - //璇诲彇浣忓畢椤哄簭 - var strData = UserCenterLogic.LoadFileContent(UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ResidenceSortFile)); - if (strData != null) - { - listResidenceSort = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(strData); - } listView = new VerticalListControl(29); listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6); @@ -145,27 +134,12 @@ //鏆傛椂瀛樺偍鏁版嵁 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); } - for (int i = 0; i < listResidenceSort.Count; i++) - { - //绉婚櫎鎺変笉瀛樺湪浜嗙殑椤哄簭 - if (dicData.ContainsKey(listResidenceSort[i]) == false) - { - listResidenceSort.RemoveAt(i); - i--; - } - } - //淇濆瓨椤哄簭 - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ResidenceSortFile); - UserCenterLogic.SaveFileContent(fullName, listResidenceSort); HdlThreadLogic.Current.RunMain(() => { @@ -215,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 { @@ -258,12 +232,7 @@ //妫�娴嬫湰鍦版湁娌℃湁杩欎釜浣忓畢 this.CheckIsExsitResidence(info); - Config.Instance.HomeId = info.Id; - //閲嶆柊鍒濆鍖栦綇瀹呭璞� - Config.Instance.Home = House.GetHouseByHouseId(info.Id); - Config.Instance.Save(); - //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ - await UserCenterLogic.InitUserCenterMenmoryAndThread(false); + await HdlResidenceLogic.Current.SwitchResidence(info.Id); HdlThreadLogic.Current.RunMain(() => { @@ -350,14 +319,14 @@ 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.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 { @@ -387,14 +356,7 @@ { HdlThreadLogic.Current.RunThread(async () => { - this.ShowProgressBar(); - - Config.Instance.HomeId = i_home.Id; - //閲嶆柊鍒濆鍖栦綇瀹呭璞� - Config.Instance.Home = House.GetHouseByHouseId(i_home.Id); - Config.Instance.Save(); - //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ - await UserCenterLogic.InitUserCenterMenmoryAndThread(false); + await HdlResidenceLogic.Current.SwitchResidence(i_home.Id); HdlThreadLogic.Current.RunMain(() => { @@ -472,7 +434,7 @@ return; } //鍒锋柊鍐呭瓨鐨勪綇瀹呭悕 - House.EditorHouseByHouseId(i_house.Id, textValue); + HdlResidenceLogic.Current.EditorHouseByHouseId(i_house.Id, textValue); //鏇存敼鏄剧ず鐨勫悕瀛� btnHome.Text = textValue; } @@ -510,7 +472,7 @@ if (flage == true) { //鍒锋柊鍐呭瓨鐨勪綇瀹呭悕 - House.EditorHouseByHouseId(info.Id, ResidenceName); + HdlResidenceLogic.Current.EditorHouseByHouseId(info.Id, ResidenceName); //鏇存敼鏄剧ず鐨勫悕瀛� btnHome.Text = ResidenceName; info.Name = ResidenceName; @@ -578,7 +540,7 @@ 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(2); @@ -740,10 +702,6 @@ { if (Config.Instance.HomeFilePathList.Contains($"House_{keys}.json") == false) { - //淇濆瓨椤哄簭 - listResidenceSort.Remove(keys); - HdlRoomLogic.Current.SaveFloorSort(listResidenceSort); - this.listView.RemoveAll(); //鏁版嵁宸茬粡鍙樻洿 閲嶆柊璁剧疆浣忓畢淇℃伅 this.SetResidenceInfo(2); -- Gitblit v1.8.0