From 9904031f5291daaf56985146bb671f25e18ebbdf Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 02 四月 2020 19:51:31 +0800 Subject: [PATCH] 最新代码 --- ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs | 67 ++++++++++++++++++++++++++------- 1 files changed, 52 insertions(+), 15 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs index a20b2b5..076ba16 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs @@ -146,11 +146,9 @@ continue; } var info = dicData[listResidenceSort[i]]; - if (info.IsOthreShare == false) - { - //鏀堕泦璇ヨ处鍙锋墍鎷ユ湁鐨勮嚜宸辩殑浣忓畢鐨勬暟鎹� - this.dicResidenceData[info.Id] = info; - } + + //鏀堕泦璇ヨ处鍙蜂綇瀹呯殑鏁版嵁 + this.dicResidenceData[info.Id] = info; this.AddRowLayout(info, i != listResidenceSort.Count - 1); } //璋冩暣鍒楄〃鎺т欢鐨勯珮搴� @@ -221,8 +219,10 @@ { this.ShowProgressBar(); + //妫�娴嬫湰鍦版湁娌℃湁杩欎釜浣忓畢 + this.CheckIsExsitResidence(info); + Config.Instance.HomeId = info.Id; - Global.CreateHomeDirectory(info.Id); //閲嶆柊鍒濆鍖栦綇瀹呭璞� Config.Instance.Home = House.GetHouseByHouseId(info.Id); Config.Instance.Save(); @@ -418,25 +418,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; } @@ -453,6 +485,11 @@ //浣忓畢鍚嶅瓧閲嶅妫�娴� foreach (string strId in this.dicResidenceData.Keys) { + if (this.dicResidenceData[strId].IsOthreShare == true) + { + //鍒嗕韩鐨勪綇瀹呬笉鑰冭檻 + continue; + } if (residenceId != strId && residenceName == this.dicResidenceData[strId].Name) { //浣忓畢鍚嶅瓧宸茬粡瀛樺湪 -- Gitblit v1.8.0