From 404cdc88627f942df7944af04ee05b9d527752d6 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 30 九月 2019 13:22:40 +0800 Subject: [PATCH] 合并了徐梅的按键面板绑定 --- ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs | 216 +++++++++++++++++++++++++++-------------------------- 1 files changed, 111 insertions(+), 105 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs index dae9d48..deaf1b7 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs @@ -4,7 +4,7 @@ /// <summary> /// 鎴愬憳淇℃伅绠$悊 /// </summary> - public class MemberManagementForm : UserCenterCommonForm + public class MemberManagementForm : EditorCommonForm { #region 鈻� 鍙橀噺澹版槑___________________________ @@ -13,17 +13,13 @@ /// </summary> private MemberInfoRes memberInfo = null; /// <summary> - /// TopFrameLayout - /// </summary> - private SpecialFrameLayout specialTopFrame = null; - /// <summary> /// 绠$悊鍛樻潈闄愬浘鏍囨帶浠� /// </summary> - private TopLayoutMostRightView btnTopIcon = null; + private MostRightIconControl btnTopIcon = null; /// <summary> /// 鏉冮檺鐨勭炕璇戝悕鎺т欢 /// </summary> - private ViewNormalControl btnAuthority = null; + private NormalViewControl btnAuthority = null; #endregion @@ -38,10 +34,8 @@ this.memberInfo = info; //璁剧疆鏍囬淇℃伅 - base.SetTitleText(Language.StringByID(R.MyInternationalizationString.MenberManagement)); - - //涓轰簡鑳藉鏄剧ず妯″潡鍥炬牱 - bodyFrameLayout.BackgroundColor = UserCenterColor.Current.TopFrameLayout; + string title = string.IsNullOrEmpty(info.UserName) == true ? info.Account : info.UserName; + base.SetTitleText(title); //鍒濆鍖栧彸涓婅鐨勫浘鏍� this.InitTopRightIcon(); @@ -60,7 +54,7 @@ return; } //绠$悊鍛樻潈闄愬浘鏍� - btnTopIcon = new TopLayoutMostRightView(); + btnTopIcon = new MostRightIconControl(69, 69); if (memberInfo.AccountType == 1) { btnTopIcon.UnSelectedImagePath = "Account/HadAuthority.png"; @@ -70,15 +64,18 @@ btnTopIcon.UnSelectedImagePath = "Account/NotAuthority.png"; } topFrameLayout.AddChidren(btnTopIcon); - - btnTopIcon.MouseUpEventHandler += (sender, e) => + btnTopIcon.InitControl(); + btnTopIcon.ButtonClickEvent += (sender, e) => { string msg = Language.StringByID(R.MyInternationalizationString.uDownSubAccountLevel); if (memberInfo.AccountType != 1) { msg = Language.StringByID(R.MyInternationalizationString.uUpSubAccountLevel); } - this.ShowConfirmMsg(msg, "UpOrDownSubAccountLevel"); + this.ShowMassage(ShowMsgType.Confirm, msg, () => + { + this.UpOrDownSubAccountLevel(); + }); }; } @@ -87,6 +84,9 @@ /// </summary> private void InitMiddleFrame() { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + //鍒濆鍖栫敤鎴峰浘鏍� this.InitMenberIconControl(); @@ -99,21 +99,23 @@ /// </summary> private void InitMenberIconControl() { - this.specialTopFrame = new SpecialFrameLayout(400, 10); - specialTopFrame.BackgroundColor = UserCenterColor.Current.BodyFrameLayout; - bodyFrameLayout.AddChidren(specialTopFrame); + var frame = new FrameLayout(); + frame.Height = Application.GetRealHeight(372); + frame.BackgroundColor = UserCenterColor.Current.White; + bodyFrameLayout.AddChidren(frame); //鐢ㄦ埛鍥炬爣 - var btnUserIcon = new ProfilePhotoControl(); - btnUserIcon.Y = Application.GetRealHeight(40); + var btnUserIcon = new PicViewControl(207, 207); + btnUserIcon.Y = Application.GetRealHeight(45); btnUserIcon.Gravity = Gravity.CenterHorizontal; - btnUserIcon.UnSelectedImagePath = "Account/Admin.png"; - this.specialTopFrame.AddChidren(btnUserIcon); + btnUserIcon.UnSelectedImagePath = "Center/Admin.png"; + frame.AddChidren(btnUserIcon); //鏉冮檺 - btnAuthority = new ViewNormalControl(800, true); + btnAuthority = new NormalViewControl(800, 50, true); btnAuthority.TextAlignment = TextAlignment.Center; - btnAuthority.Y = btnUserIcon.Bottom + Application.GetRealHeight(10); + btnAuthority.TextSize = 12; + btnAuthority.Y = btnUserIcon.Bottom + Application.GetRealHeight(23); btnAuthority.Gravity = Gravity.CenterHorizontal; btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor; btnAuthority.TextID = R.MyInternationalizationString.uMember; @@ -122,19 +124,7 @@ //鎷ユ湁绠$悊鍛樻潈闄� btnAuthority.TextID = R.MyInternationalizationString.uMemberHadActionAuthority; } - this.specialTopFrame.AddChidren(btnAuthority); - - //鏄电О - var btnName = new ViewNormalControl(800, true); - btnName.TextAlignment = TextAlignment.Center; - btnName.Y = btnAuthority.Bottom + Application.GetRealHeight(10); - btnName.Text = memberInfo.UserName; - btnName.Gravity = Gravity.CenterHorizontal; - this.specialTopFrame.AddChidren(btnName, HeightAutoMode.IncreaseOnly); - if (string.IsNullOrEmpty(memberInfo.UserName) == true) - { - btnName.Text = memberInfo.Account; - } + frame.AddChidren(btnAuthority); } #endregion @@ -146,65 +136,69 @@ /// </summary> private void InitInfoList() { - //鍒涘缓涓�涓狥rameLayout - var frameLayout = new FrameLayout(); - frameLayout.Height = bodyFrameLayout.Height - specialTopFrame.Height - Application.GetRealHeight(50); - frameLayout.BackgroundColor = UserCenterColor.Current.BodyFrameLayout; - frameLayout.Y = specialTopFrame.Bottom + Application.GetRealHeight(50); - bodyFrameLayout.AddChidren(frameLayout); - //鏍囬:鎴愬憳鏉冮檺 - var btnMenberTile = new ViewNormalControl(800, true); + var btnMenberTile = new DetailTitleControl(800, 60, true); btnMenberTile.X = ControlCommonResourse.XXLeft; - btnMenberTile.Y = Application.GetRealHeight(20); + btnMenberTile.Y = Application.GetRealHeight(418); + btnMenberTile.TextColor = UserCenterColor.Current.TextColor2; btnMenberTile.TextID = R.MyInternationalizationString.MenberAuthority; - frameLayout.AddChidren(btnMenberTile); + btnMenberTile.TextSize = 15; + bodyFrameLayout.AddChidren(btnMenberTile); + + var frame = new FrameListControl(); + frame.Height = Application.GetRealHeight(311); + frame.BackgroundColor = UserCenterColor.Current.White; + frame.Y = Application.GetRealHeight(501); + bodyFrameLayout.AddChidren(frame); + + //濉炰竴涓┖鐧界殑杩涘幓鍗犵┖闂� + var rowTemp = new FrameRowControl(); + rowTemp.UseClickStatu = false; + rowTemp.Height = Application.GetRealHeight(23) - frame.rowSpace; + frame.AddChidren(rowTemp); //娣诲姞杩滅▼鎿嶄綔琛� - var rowLayout = new RowLayout(); - rowLayout.Y = btnMenberTile.Bottom + Application.GetRealHeight(10); - rowLayout.Height = ControlCommonResourse.ListViewRowHeight; - frameLayout.AddChidren(rowLayout); - this.AddRemoteRow(rowLayout); + var rowRemote = new FrameRowControl(frame.rowSpace / 2); + rowRemote.UseClickStatu = false; + frame.AddChidren(rowRemote); + this.AddRemoteRow(rowRemote); //娣诲姞宸插叡浜唴瀹硅 - var rowDevice = new StatuRowLayout(); - rowDevice.Y = rowLayout.Bottom; - frameLayout.AddChidren(rowDevice); - this.AddShardContentRow(rowDevice); - - //娣诲姞鐢婚潰搴曢儴鐨勮鏄� - var frameNote = new FrameLayout(); - frameNote.Height = ControlCommonResourse.NormalControlHeight * 2; - frameNote.Y = Application.GetRealHeight(680); - frameLayout.AddChidren(frameNote); + var rowShard = new FrameRowControl(frame.rowSpace / 2); + frame.AddChidren(rowShard); + this.AddShardContentRow(rowShard); //涓�鏃︾Щ闄よ瀹跺涵鎴愬憳锛屼粬/濂瑰皢鏃犳硶浣跨敤璇ョ綉鍏充笅鎵�缁戝畾鐨勮澶� - Button btnNote1 = new ViewNormalControl(Application.GetRealWidth(800), ControlCommonResourse.NormalControlHeight * 2, false); + var btnNote1 = new NormalViewControl(613, 98, true); + btnNote1.X = Application.GetRealWidth(246); + btnNote1.Y = Application.GetRealHeight(1328); + btnNote1.TextSize = 12; btnNote1.TextID = R.MyInternationalizationString.RemoveMenberAndDonotUserBindGatewayDevice; btnNote1.IsMoreLines = true; - btnNote1.TextColor = UserCenterColor.Current.Gray; - btnNote1.Gravity = Gravity.CenterHorizontal; + btnNote1.TextColor = UserCenterColor.Current.TextGrayColor1; btnNote1.TextAlignment = TextAlignment.Center; - frameNote.AddChidren(btnNote1); + bodyFrameLayout.AddChidren(btnNote1); - var btnIcon = new IconViewControl(80); - btnIcon.X = btnNote1.X - Application.GetRealWidth(80); + var btnIcon = new IconViewControl(58); + btnIcon.X = Application.GetRealWidth(167); + btnIcon.Y = Application.GetRealHeight(1328); btnIcon.UnSelectedImagePath = "Item/Tips.png"; - btnIcon.Gravity = Gravity.CenterVertical; - frameNote.AddChidren(btnIcon); + bodyFrameLayout.AddChidren(btnIcon); //娣诲姞绉婚櫎鎸夐挳 var btnDelete = new BottomClickButton(); btnDelete.TextID = R.MyInternationalizationString.RemoveBotton; - btnDelete.Y = frameNote.Bottom + Application.GetRealHeight(100); - btnDelete.BackgroundColor = UserCenterColor.Current.Red; - frameLayout.AddChidren(btnDelete); - btnDelete.MouseUpEventHandler += (sender, e) => + btnDelete.BackgroundColor = 0xfff75858; + bodyFrameLayout.AddChidren(btnDelete); + btnDelete.ButtonClickEvent += (sender, e) => { //纭畾瑕佺Щ闄よ瀹跺涵鎴愬憳鍚楋紵 string msg = Language.StringByID(R.MyInternationalizationString.uConfirmRemoveMember); - this.ShowConfirmMsg(msg, "DeleteSubAccount"); + this.ShowMassage(ShowMsgType.Confirm, msg, () => + { + //鍒犻櫎瀛愯处鍙� + this.DeleteSubAccount(); + }); }; } @@ -216,26 +210,28 @@ /// 娣诲姞杩滅▼鎿嶄綔琛� /// </summary> /// <param name="row">Row.</param> - private void AddRemoteRow(RowLayout row) + private void AddRemoteRow(FrameRowControl row) { //鍥炬爣 - var btnIcon = new RowLeftIconView(); + var btnIcon = row.AddLeftIcon(81); btnIcon.UnSelectedImagePath = "Item/Remote.png"; - btnIcon.SelectedImagePath = "Item/RemoteSelected.png"; - row.AddChidren(btnIcon); //鏂囧瓧:杩滅▼鎿嶄綔 - var btnName = new RowCenterView(true); + var btnName = row.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.RemoteManipulation), 500); btnName.TextID = R.MyInternationalizationString.RemoteManipulation; - row.AddChidren(btnName); + btnName.TextSize = 15; //寮�鍏� - var btnSwitch = new SwichControl(); - row.AddChidren(btnSwitch); - btnSwitch.MouseUpEventHandler += (sender, e) => + var btnSwitch = row.AddMostRightEmptyIcon(104, 63); + row.ChangedChidrenBindMode(btnSwitch, ChidrenBindMode.NotBind); + btnSwitch.UnSelectedImagePath = "Item/Switch.png"; + btnSwitch.SelectedImagePath = "Item/SwitchSelected.png"; + btnSwitch.ButtonClickEvent += (sender, e) => { btnSwitch.IsSelected = !btnSwitch.IsSelected; }; + //搴曠嚎 + row.AddBottomLine(); } #endregion @@ -246,27 +242,25 @@ /// 娣诲姞宸插叡浜唴瀹硅 /// </summary> /// <param name="row">Row.</param> - private void AddShardContentRow(StatuRowLayout row) + private void AddShardContentRow(FrameRowControl row) { //鍥炬爣 - var btnIcon = new RowLeftIconView(); - btnIcon.UnSelectedImagePath = "Item/ShardDevice.png"; - btnIcon.SelectedImagePath = "Item/ShardDeviceSelected.png"; - row.AddChidren(btnIcon); + var btnIcon = row.AddLeftIcon(81); + btnIcon.UnSelectedImagePath = "Item/ShardMenu.png"; - //鏂囧瓧:宸插叡浜唴瀹硅 - var btnName = new RowCenterView(true); - btnName.TextID = R.MyInternationalizationString.uHadSharedContent; - row.AddChidren(btnName); + //鍏变韩 + var btnName = row.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uShared2), 500); + btnName.TextID = R.MyInternationalizationString.uShared2; + btnName.TextSize = 15; //鍙冲浘鏍� - row.AddRightIconControl(); + row.AddRightArrow(); var memberShardInfo = new MemberShardInfoData(); - row.MouseUpEvent += (sender, e) => + row.ButtonClickEvent += (sender, e) => { var form = new SharedContent.SearchConfigureSharedListRoomForm(); - this.AddForm(form, memberInfo, memberShardInfo); + form.AddForm(memberInfo, memberShardInfo); }; } @@ -285,7 +279,7 @@ var pra = new UpOrDownLevelPra(); pra.DistributedMark = memberInfo.DistributedMark; - bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpSubAccount", pra); + bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpSubAccount", false, pra); if (result == false) { this.CloseProgressBar(); @@ -298,6 +292,10 @@ Application.RunOnMainThread(() => { + if (this.Parent == null) + { + return; + } //鍙樻洿鏉冮檺鍥炬爣 if (memberInfo.AccountType == 1) { @@ -314,7 +312,7 @@ if (memberInfo.AccountType == 1) { var form = new SubAccountLevelUpSuccessForm(); - this.AddForm(form, memberInfo); + form.AddForm(memberInfo); } }); } @@ -326,7 +324,7 @@ /// <summary> /// 鍒犻櫎瀛愯处鍙� /// </summary> - public async void DeleteSubAccount() + private async void DeleteSubAccount() { //寮�鍚繘搴︽潯 this.ShowProgressBar(); @@ -334,7 +332,7 @@ var pra = new DeleteSubAccountPra(); pra.SubAccount = memberInfo.SubAccountDistributedMark; - bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/DeletedSubAccount", pra); + bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/DeletedSubAccount", false, pra); //鍏抽棴杩涘害鏉� this.CloseProgressBar(); @@ -343,13 +341,21 @@ return; } - Application.RunOnMainThread(() => + //绉婚櫎缂撳瓨 + UserCenterResourse.ListMemberInfo.RemoveAll((obj) => { - //浠庢垚鍛樹竴瑙堢敾闈㈢Щ闄� - this.LoadFormMethodByName("MemberListForm", "DeleteRowByAccount", memberInfo.Account); - //鑷韩鍏抽棴 - this.CloseForm(); + if (obj.SubAccountDistributedMark == memberInfo.SubAccountDistributedMark) + { + return true; + } + return false; }); + UserCenterLogic.SaveLocalMemberListInfo(); + + //浠庢垚鍛樹竴瑙堢敾闈㈢Щ闄� + this.LoadFormMethodByName("MemberListForm", "DeleteRowByAccount", memberInfo.Account); + //鑷韩鍏抽棴 + this.CloseForm(); } #endregion -- Gitblit v1.8.0