From 18b93d511dc764b469d7c4a7e755f7274f89cdb4 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 27 四月 2020 17:55:14 +0800 Subject: [PATCH] 2020-4-27-1 --- ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs | 192 ++++++++++++++++++++++++++++------------------- 1 files changed, 113 insertions(+), 79 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs index 30cd414..b36ff40 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs @@ -16,9 +16,13 @@ /// </summary> private FrameLayout frameTable = null; /// <summary> - /// 鍒楄〃鎺т欢 + /// 鍒楄〃鎺т欢(鐧借壊鑳屾櫙) /// </summary> - private VerticalListControl listView = null; + private FrameListControl listView = null; + /// <summary> + /// 鏁翠釜鐣岄潰鐨勪笂涓嬫粦鍔ㄦ帶浠� + /// </summary> + private VerticalFrameControl listBackContr = null; /// <summary> /// 妤煎眰椤哄簭 /// </summary> @@ -64,10 +68,16 @@ //娓呯┖bodyFrame this.ClearBodyFrame(); + //鏁翠釜鐣岄潰鐨勪笂涓嬫粦鍔ㄦ帶浠� + this.listBackContr = new VerticalFrameControl(); + listBackContr.Height = bodyFrameLayout.Height; + bodyFrameLayout.AddChidren(listBackContr); + + //浣忓畢琛� var rowHome = new RowLayoutControl(); rowHome.Height = Application.GetRealHeight(173); rowHome.BackgroundColor = UserCenterColor.Current.White; - bodyFrameLayout.AddChidren(rowHome); + listBackContr.frameTable.AddChidren(rowHome); rowHome.frameTable.UseClickStatu = false; var btnAdreeIcon = rowHome.frameTable.AddLeftIcon(81); @@ -92,7 +102,7 @@ } //缁忕含搴� var btnLocation = rowHome.frameTable.AddMostRightView(string.Empty, 500); - btnLocation.Text = this.GetLatitudeAndLongitudeText(Common.Config.Instance.Home.Longitude, Common.Config.Instance.Home.Latitude); + btnLocation.Text = Common.Config.Instance.Home.ResidenceAddressName; //涓讳汉鎴栬�呯鐞嗗憳鎵嶄細鍑虹幇杩欎釜鑿滃崟 if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2) @@ -109,9 +119,12 @@ HdlThreadLogic.Current.RunThread(() => { //淇濆瓨浣忓畢鍦板潃 - this.SaveResidenceAdrress(btnLocation, mLatitude, mLongitude); + this.SaveResidenceAdrress(btnLocation, mLatitude, mLongitude, name); }); - }, Language.StringByID(R.MyInternationalizationString.uSelectAdrress), true, latitude, longitude, 100); + }, + Language.StringByID(R.MyInternationalizationString.uSelectAdrress), + Language.StringByID(R.MyInternationalizationString.uSave), + true, latitude, longitude, 100); }; } @@ -141,8 +154,8 @@ //鍒濆鍖栨甯� this.frameTable = new FrameLayout(); frameTable.Y = rowHome.Bottom + Application.GetRealHeight(23); - frameTable.Height = bodyFrameLayout.Height - rowHome.Bottom - Application.GetRealHeight(23); - bodyFrameLayout.AddChidren(frameTable); + frameTable.Height = listBackContr.frameTable.Height - rowHome.Bottom - Application.GetRealHeight(23); + listBackContr.frameTable.AddChidren(frameTable); //鏍规嵁鎸囧畾妯″紡,鍒濆鍖栨甯冩帶浠� this.InitFrameTableByMode(); @@ -241,7 +254,7 @@ frameFloor.UseClickStatu = false; frameFloor.Height = Application.GetRealHeight(115); frameFloor.BackgroundColor = UserCenterColor.Current.White; - frameTable.AddChidren(frameFloor); + this.frameTable.AddChidren(frameFloor); //妤煎眰 var btnFloor = frameFloor.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uFloor), 200, 60); @@ -250,11 +263,11 @@ btnFloor.TextSize = 15; frameFloor.AddChidren(btnFloor, ChidrenBindMode.NotBind); - listView = new VerticalListControl(29); + listView = new FrameListControl(29); listView.BackgroundColor = UserCenterColor.Current.White; listView.Y = frameFloor.Bottom; listView.Height = frameTable.Height - frameFloor.Bottom; - frameTable.AddChidren(listView); + this.frameTable.AddChidren(listView); //鍒濆鍖栨ゼ灞傝 this.InitFloorRow(); @@ -286,7 +299,7 @@ this.AddFloorRow(keys, dicFloor[keys], i != count); } //璋冩暣鎺т欢楂樺害 - listView.AdjustRealHeight(Application.GetRealHeight(23)); + this.AdjustContrlTableHeight(); }); } @@ -303,6 +316,7 @@ private void AddFloorRow(string keys, string floorName, bool addLine) { var frameRow = new RowLayoutControl(listView.rowSpace / 2); + frameRow.MainKeys = keys; this.listView.AddChidren(frameRow); //鍥炬爣 var btnIcon = frameRow.frameTable.AddLeftIcon(81); @@ -325,13 +339,8 @@ if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2) { //鏇存敼 - var btnChanged = new NormalViewControl(Application.GetRealWidth(184), frameRow.Height, false); - btnChanged.BackgroundColor = 0xff4a4a4a; - btnChanged.TextSize = 12; - btnChanged.TextColor = UserCenterColor.Current.White; - btnChanged.TextAlignment = TextAlignment.Center; + var btnChanged = frameRow.AddEditorControl(); btnChanged.TextID = R.MyInternationalizationString.uChanged1; - frameRow.AddRightView(btnChanged); btnChanged.ButtonClickEvent += (sender, e) => { //鍒涘缓鎴栬�呯紪杈戞ゼ灞� @@ -363,6 +372,8 @@ Common.Config.Instance.Home.CurrentFloorId = floorId; break; } + //鍒犻櫎褰撳墠妤煎眰鐨勮瘽,闇�瑕佸幓鍒锋柊涓婚〉宸﹁竟鐨勬埧闂村垪琛� + HdlRoomLogic.Current.RefreshRoomListView(); } var listDeleteId = new List<string>(); var listAllRoom = HdlRoomLogic.Current.GetAllListRooms(); @@ -395,8 +406,24 @@ } else { + bool canMove = false; + for (int i = 0; i < listView.ChildrenCount; i++) + { + var myRow = listView.GetChildren(i) as RowLayoutControl; + if (myRow != null && myRow.MainKeys == keys) + { + canMove = true; + continue; + } + if (canMove == true) + { + //瀹冧箣鍚庣殑琛岋紝鍏ㄩ儴寰�涓婄Щ + myRow.Y -= frameRow.Height; + } + } frameRow.RemoveFromParent(); - listView.AdjustRealHeight(Application.GetRealHeight(23)); + //璋冩暣妗屽竷楂樺害 + this.AdjustContrlTableHeight(); } }); }; @@ -434,6 +461,9 @@ //鎸変笅纭鎸夐挳 dialogForm.ComfirmClickEvent += ((textValue) => { + //杩樺師宸﹀彸鑿滃崟 + frameRow?.HideMenu(); + if (this.CheckFloorName(keys, textValue) == false) { //妤煎眰鍚嶇О妫�娴� @@ -441,8 +471,6 @@ } //鐢婚潰鍏抽棴 dialogForm.CloseDialog(); - //杩樺師宸﹀彸鑿滃崟 - frameRow?.HideMenu(); if (floorName != textValue) { //缂栬緫鎴栬�呭垱寤烘ゼ灞傚悕绉� @@ -455,6 +483,8 @@ if (Common.Config.Instance.Home.CurrentFloorId == string.Empty) { Common.Config.Instance.Home.CurrentFloorId = keys; + //鍒涘缓绗竴涓柊鐨勬ゼ灞傜殑璇�,闇�瑕佸幓鍒锋柊涓婚〉宸﹁竟鐨勬埧闂村垪琛� + HdlRoomLogic.Current.RefreshRoomListView(); } if (btnFloor != null) { @@ -492,7 +522,7 @@ btnRoomList.TextSize = 15; frameRoom.AddChidren(btnRoomList, ChidrenBindMode.NotBind); - listView = new VerticalListControl(29); + listView = new FrameListControl(29); listView.BackgroundColor = UserCenterColor.Current.White; listView.Y = frameRoom.Bottom; listView.Height = frameTable.Height - frameRoom.Bottom; @@ -520,8 +550,8 @@ //娣诲姞鎴块棿琛� this.AddRoomRow(listRoom[i], i != listRoom.Count - 1); } - //璋冩暣鎺т欢鐪熷疄楂樺害 - listView.AdjustRealHeight(Application.GetRealHeight(23)); + //璋冩暣妗屽竷楂樺害 + this.AdjustContrlTableHeight(); } #endregion @@ -536,6 +566,7 @@ private void AddRoomRow(Common.Room room, bool addLine) { var frameRow = new RowLayoutControl(listView.rowSpace / 2); + frameRow.MainKeys = room.Id; listView.AddChidren(frameRow); //鍥炬爣 var btnIcon = frameRow.frameTable.AddLeftIcon(81); @@ -566,8 +597,6 @@ var btnEditor = frameRow.AddEditorControl(); btnEditor.ButtonClickEvent += (sender, e) => { - //鍏抽棴宸﹀彸鑿滃崟 - frameRow.HideMenu(); var form = new EditorRoomInforForm(); form.AddForm(room); form.FinishEditorEvent += (roomName) => @@ -601,8 +630,24 @@ } else { + bool canMove = false; + for (int i = 0; i < listView.ChildrenCount; i++) + { + var myRow = listView.GetChildren(i) as RowLayoutControl; + if (myRow != null && myRow.MainKeys == room.Id) + { + canMove = true; + continue; + } + if (canMove == true) + { + //瀹冧箣鍚庣殑琛岋紝鍏ㄩ儴寰�涓婄Щ + myRow.Y -= frameRow.Height; + } + } frameRow.RemoveFromParent(); - listView.AdjustRealHeight(Application.GetRealHeight(23)); + //璋冩暣妗屽竷楂樺害 + this.AdjustContrlTableHeight(); } }); }; @@ -620,16 +665,36 @@ //寮�鍚繘搴︽潯 this.ShowProgressBar(); - var Pra = new DeleteResidencePra(); - Pra.HomeId = Common.Config.Instance.Home.Id; - Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); - - bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra); - if (result == false) + if (Common.Config.Instance.Home.IsOthreShare == false) { - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - return; + //鍒犻櫎涓讳汉鑷繁鐨勪綇瀹� + var Pra = new DeleteResidencePra(); + Pra.HomeId = Common.Config.Instance.Home.Id; + Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); + + bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra); + if (result == false) + { + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); + return; + } + } + else + { + //鍒犻櫎鍒嗕韩鐨勪綇瀹� + var Pra2 = new + { + HomeId = Common.Config.Instance.Home.Id, + PrimaryUserId = Common.Config.Instance.Home.MainUserDistributedMark + }; + bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/SubAccountDelShareHome", false, Pra2); + if (result == false) + { + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); + return; + } } //鍥犱负鍒犻櫎鐨勬槸褰撳墠鐨勪綇瀹�,鎵�浠ラ渶瑕佸厛鍒囨崲鍒板埆鐨勪綇瀹� @@ -685,7 +750,8 @@ /// <param name="btnLocation">鏄剧ず鎺т欢</param> /// <param name="latitude">绾害</param> /// <param name="longitude">缁忓害</param> - private async void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude) + /// <param name="addresName">浣嶇疆鍚嶇О</param> + private async void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude, string addresName) { //寮�鍚繘搴︽潯 this.ShowProgressBar(); @@ -729,10 +795,11 @@ //淇濆瓨缂撳瓨 Common.Config.Instance.Home.Longitude = longitude; Common.Config.Instance.Home.Latitude = latitude; + Common.Config.Instance.Home.ResidenceAddressName = addresName; Common.Config.Instance.Home.Save(); HdlThreadLogic.Current.RunMain(() => { - btnLocation.Text = this.GetLatitudeAndLongitudeText(longitude, latitude); + btnLocation.Text = addresName; }); } @@ -773,7 +840,7 @@ { //璇疯緭鍏ヤ綇瀹呭悕绉� string msg = Language.StringByID(R.MyInternationalizationString.uPleaseInputFloorName); - this.ShowMassage(ShowMsgType.Error, msg); + this.ShowMassage(ShowMsgType.Tip, msg); return false; } foreach (string floorKeys in Common.Config.Instance.Home.FloorDics.Keys) @@ -782,7 +849,7 @@ { //妤煎眰鍚嶇О宸茬粡瀛樺湪 string msg = Language.StringByID(R.MyInternationalizationString.uFloorNameIsExist); - this.ShowMassage(ShowMsgType.Error, msg); + this.ShowMassage(ShowMsgType.Tip, msg); return false; } } @@ -790,47 +857,14 @@ } /// <summary> - /// 鑾峰彇缁忕含搴︾殑缈昏瘧鍚嶅瓧 + /// 璋冩暣鎺т欢妗屽竷楂樺害 /// </summary> - /// <param name="Longitude">缁忓害</param> - /// <param name="Latitude">绾害</param> - /// <returns></returns> - private string GetLatitudeAndLongitudeText(double Longitude, double Latitude) + private void AdjustContrlTableHeight() { - string value1 = string.Empty; - string value2 = string.Empty; - if (Longitude == 0) - { - //榛樿涓滅粡 - value1 = "0掳00'E"; - } - else if (Longitude > 0) - { - //涓滅粡 - value1 = Math.Round(Longitude, 2).ToString().Replace(".", "掳") + "'E"; - } - else if (Longitude < 0) - { - //瑗跨粡 - value1 = Math.Round(-Longitude, 2).ToString().Replace(".", "掳") + "'W"; - } - - if (Latitude == 0) - { - //榛樿鍖楃含 - value2 = "0掳00'N"; - } - else if (Latitude > 0) - { - //鍖楃含 - value2 = Math.Round(Latitude, 2).ToString().Replace(".", "掳") + "'N"; - } - else if (Latitude < 0) - { - //鍗楃含 - value2 = Math.Round(-Latitude, 2).ToString().Replace(".", "掳") + "'S"; - } - return value1 + " " + value2; + //璋冩暣妗屽竷楂樺害 + listView.AdjustRealHeight(Application.GetRealHeight(23)); + this.frameTable.Height = listView.Bottom; + this.listBackContr.AdjustTableHeight(); } #endregion -- Gitblit v1.8.0