From 3272ca5b51e19f7f8a827b0f68400570a547fe60 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 28 四月 2020 15:02:44 +0800 Subject: [PATCH] 2020-04-28-1 --- ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs | 134 ++++++++++++++++++++++++++------------------ 1 files changed, 79 insertions(+), 55 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs index 9ff8a6a..393b9e2 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs @@ -68,7 +68,6 @@ } listView = new VerticalListControl(29); - listView.Y = Application.GetRealHeight(-6); listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6); listView.BackgroundColor = UserCenterColor.Current.White; bodyFrameLayout.AddChidren(listView); @@ -117,11 +116,20 @@ 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); - Application.RunOnMainThread(() => + HdlThreadLogic.Current.RunMain(() => { if (this.Parent == null) { @@ -132,12 +140,14 @@ 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; } + var info = dicData[listResidenceSort[i]]; + + //鏀堕泦璇ヨ处鍙蜂綇瀹呯殑鏁版嵁 + this.dicResidenceData[info.Id] = info; this.AddRowLayout(info, i != listResidenceSort.Count - 1); } //璋冩暣鍒楄〃鎺т欢鐨勯珮搴� @@ -206,16 +216,21 @@ { HdlThreadLogic.Current.RunThread(async () => { - ProgressBar.Show(); + this.ShowProgressBar(); + + //妫�娴嬫湰鍦版湁娌℃湁杩欎釜浣忓畢 + this.CheckIsExsitResidence(info); + Config.Instance.HomeId = info.Id; - Global.CreateHomeDirectory(info.Id); + //閲嶆柊鍒濆鍖栦綇瀹呭璞� + Config.Instance.Home = House.GetHouseByHouseId(info.Id); Config.Instance.Save(); //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ - await UserCenterLogic.InitUserCenterMenmoryAndThread(); + await UserCenterLogic.InitUserCenterMenmoryAndThread(false); - Room.InitAllRoom(); + HdlRoomLogic.Current.InitAllRoom(); - Application.RunOnMainThread(() => + HdlThreadLogic.Current.RunMain(() => { //閲嶆柊鍒锋柊鍒楄〃 this.listView.RemoveAll(); @@ -233,19 +248,14 @@ } }; - if (info.IsOthreShare == true && info.AccountType != 1) + if (info.IsOthreShare == true) { - //鍒嗕韩鐨勶紝鍙堜笉鎷ユ湁绠$悊鍛樻潈闄愮殑,涓嶈兘鏇存敼 + //鍒嗕韩鐨�,涓嶈兘鏇存敼 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) => { //鏄剧ず缂栬緫鍚嶇О鐣岄潰 @@ -264,7 +274,7 @@ private void ShowEditorNameForm(Common.ResponseEntity.ResidenceObj info, NormalViewControl btnHome) { //鐢熸垚涓�涓脊绐楃敾闈� - var dialogForm = new DialogInputFrameControl(this, DialogFrameMode.OnlyInput); + var dialogForm = new DialogInputControl(); //缂栬緫浣忓畢 dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uChangedName)); //璇疯緭鍏ヤ綇瀹呭悕绉� @@ -340,7 +350,7 @@ private void ShowAddNameForm() { //鐢熸垚涓�涓脊绐楃敾闈� - var dialogForm = new DialogInputFrameControl(this, DialogFrameMode.OnlyInput); + var dialogForm = new DialogInputControl(); //鍒涘缓浣忓畢 dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uCreatResidence)); //璇疯緭鍏ヤ綇瀹呭悕绉� @@ -402,25 +412,57 @@ #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 false; } return true; } @@ -437,6 +479,11 @@ //浣忓畢鍚嶅瓧閲嶅妫�娴� foreach (string strId in this.dicResidenceData.Keys) { + if (this.dicResidenceData[strId].IsOthreShare == true) + { + //鍒嗕韩鐨勪綇瀹呬笉鑰冭檻 + continue; + } if (residenceId != strId && residenceName == this.dicResidenceData[strId].Name) { //浣忓畢鍚嶅瓧宸茬粡瀛樺湪 @@ -464,7 +511,7 @@ { //淇濆瓨椤哄簭 listResidenceSort.Remove(keys); - Room.CurrentRoom.SaveFloorSort(listResidenceSort); + HdlRoomLogic.Current.SaveFloorSort(listResidenceSort); this.listView.RemoveAll(); //鏁版嵁宸茬粡鍙樻洿 @@ -513,7 +560,7 @@ public PageSettingInfo PageSetting = new PageSettingInfo() { Page = 1, - PageSize = 500 + PageSize = 5000 }; } @@ -545,29 +592,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 -- Gitblit v1.8.0