From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期二, 30 八月 2022 09:37:38 +0800 Subject: [PATCH] 合并了IOS的代码 --- ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserMainForm.cs | 279 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 220 insertions(+), 59 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserMainForm.cs old mode 100755 new mode 100644 index 5ef06a0..88c4e99 --- a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserMainForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserMainForm.cs @@ -11,9 +11,13 @@ #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> - /// 鐧借壊鑳屾櫙妗� + /// 涓昏彍鍗曡儗鏅 /// </summary> - private FrameLayout frameWhiteBack = null; + private NormalFrameLayout frameMainMenuBack = null; + /// <summary> + /// 鍏朵粬鑿滃崟鐨勫鍣ㄦ帶浠� + /// </summary> + private FrameListControl frameOtherMenuContr = null; /// <summary> /// 鐢ㄦ埛鍚嶅瓧 /// </summary> @@ -30,6 +34,10 @@ /// 鐨囧啝 /// </summary> private IconViewControl btnImperialCrown = null; + /// <summary> + /// 淇℃伅鎻愮ず鎺т欢 + /// </summary> + private MessageManagementControl msgControl = null; #endregion @@ -42,17 +50,20 @@ /// </summary> public void ShowForm() { + this.FormID = "UserMainForm"; + //鐗规畩澶勭悊锛氭仮澶嶅彲鍏抽棴杩涘害鏉★紝鍒棶涓轰粈涔堬紝鎴戜篃涓嶇煡閬撲负浠�涔堬紝浠ラ槻涓囦竴鑰屽凡 ProgressBar.SetCloseBarFlag(false); - //鍒濆鍖栨鏋� - this.InitForm(); + //鍒濆鍖栧ご閮ㄦ帶浠� + this.InitTopFrameLayout(); + //鍒濆鍖栦腑閮ㄦ帶浠� + this.InitBodyFrameLayout(); //绉婚櫎杩斿洖閿� base.RemoveBackButton(); //body鍗犲畬鏁翠釜灞忓箷,闄や簡搴曢儴鑿滃崟 bodyFrameLayout.Y = 0; - bodyFrameLayout.Height = ControlCommonResourse.TopMenuFrameHeight + ControlCommonResourse.TopFrameHeight - + ControlCommonResourse.BodyFrameHeight - ControlCommonResourse.BottomFrameHeight; + bodyFrameLayout.Height = this.Height; bodyFrameLayout.BackgroundColor = UserCenterColor.Current.BlackBackGround; //鍒濆鍖栦腑閮ㄦ帶浠� @@ -68,20 +79,36 @@ this.ClearBodyFrame(); //涓汉涓績 - var btnTitle = new NormalViewControl(350, 100, true); + var btnTitle = new NormalViewControl(450, 100, true); btnTitle.X = ControlCommonResourse.XXLeft; btnTitle.Y = Application.GetRealHeight(112); btnTitle.TextColor = UserCenterColor.Current.White; btnTitle.TextSize = 24; + btnTitle.IsBold = true; btnTitle.TextID = R.MyInternationalizationString.UserCenter; bodyFrameLayout.AddChidren(btnTitle); + + var btnBack1 = new PicViewControl(1031, 942); + btnBack1.Y = btnTitle.Bottom - Application.GetRealHeight(10); + btnBack1.UnSelectedImagePath = "Center/MainBack1.png"; + bodyFrameLayout.AddChidren(btnBack1); + var btnBack2 = new PicViewControl(392, 172); + btnBack2.X = Application.GetRealWidth(688); + btnBack2.UnSelectedImagePath = "Center/MainBack2.png"; + bodyFrameLayout.AddChidren(btnBack2); + + //淇℃伅鎻愮ず鎺т欢 + this.msgControl = new MessageManagementControl(); + msgControl.Y = Application.GetRealHeight(127); + msgControl.X = Application.GetRealWidth(953); + bodyFrameLayout.AddChidren(this.msgControl); //鐧芥 var frameBack = new FrameLayout(); frameBack.BackgroundColor = UserCenterColor.Current.BodyFrameLayout; frameBack.Y = Application.GetRealHeight(380); frameBack.Gravity = Gravity.CenterHorizontal; - frameBack.Radius = 12; + frameBack.Radius = (uint)Application.GetRealHeight(29); frameBack.Width = bodyFrameLayout.Width - Application.GetRealWidth(29 * 2); frameBack.Height = bodyFrameLayout.Height - Application.GetRealHeight(380) + Application.GetRealHeight(100); bodyFrameLayout.AddChidren(frameBack); @@ -108,31 +135,51 @@ { //鐢ㄦ埛澶村儚 this.btnUserIcon = new ImageView(); - btnUserIcon.Height = Application.GetMinRealAverage(280); - btnUserIcon.Width = Application.GetMinRealAverage(280); - btnUserIcon.Radius = (uint)Application.GetMinRealAverage(280) / 2; + btnUserIcon.Height = this.GetPictrueRealSize(280); + btnUserIcon.Width = this.GetPictrueRealSize(280); + btnUserIcon.Radius = (uint)this.GetPictrueRealSize(280) / 2; btnUserIcon.X = Application.GetRealWidth(121); - btnUserIcon.ImagePath = UserCenterResourse.UserInfo.UserIconFile; + if (Common.Config.Instance.Home.IsVirtually == false) + { + btnUserIcon.ImageBytes = Shared.IO.FileUtils.ReadFile(UserCenterResourse.UserInfo.UserIconFile); + } + else + { + btnUserIcon.ImagePath = "Account/Cat.png"; + } bodyFrameLayout.AddChidren(btnUserIcon); btnUserIcon.Y = frameWhite.Y - Application.GetRealHeight(109); btnUserIcon.MouseUpEventHandler += (sender, e) => { + if (Common.Config.Instance.Home.IsVirtually == true) + { + //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欑洿鎺ユ彁绀�:纭畾閫�鍑哄綋鍓嶈处鍙凤紵 + string msg = Language.StringByID(R.MyInternationalizationString.uLogoutAccountMsg); + this.ShowMassage(ShowMsgType.Confirm, msg, () => + { + //閫�鍑鸿处鍙� + UserCenterLogic.ReLoginAgain(Common.Config.Instance.Account); + }); + return; + } var form = new UserInformationForm(); form.AddForm(); }; - if (UserCenterResourse.UserInfo.AuthorityNo == 1) + //鐨囧啝 + this.btnImperialCrown = new IconViewControl(60); + btnImperialCrown.X = Application.GetRealWidth(346); + btnImperialCrown.Y = Application.GetRealHeight(475); + btnImperialCrown.UnSelectedImagePath = "Center/ImperialCrown.png"; + bodyFrameLayout.AddChidren(btnImperialCrown); + if (UserCenterResourse.UserInfo.AuthorityNo != 1) { - //鐨囧啝 - this.btnImperialCrown = new IconViewControl(60); - btnImperialCrown.X = Application.GetRealWidth(346); - btnImperialCrown.Y = Application.GetRealHeight(475); - btnImperialCrown.UnSelectedImagePath = "Center/ImperialCrown.png"; - bodyFrameLayout.AddChidren(btnImperialCrown); + btnImperialCrown.Visible = false; } //鐢ㄦ埛鏄电О this.btnUserName = new NormalViewControl(605, 60, true); + btnUserName.IsBold = true; btnUserName.X = btnUserIcon.Right + Application.GetRealWidth(5); btnUserName.Y = Application.GetRealHeight(43); if (UserCenterResourse.UserInfo != null) @@ -145,7 +192,7 @@ this.btnAuthority = new NormalViewControl(605, 60, true); btnAuthority.X = btnUserName.X; btnAuthority.Y = btnUserName.Bottom; - btnAuthority.TextColor = UserCenterColor.Current.Gray; + btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor3; btnAuthority.TextSize = 12; if (UserCenterResourse.UserInfo != null) { @@ -164,21 +211,21 @@ /// <param name="frameWhite">鑳屾櫙</param> private void InitMainMenuInfoControl(FrameLayout frameWhite) { - if (frameWhiteBack != null) + if (frameMainMenuBack != null) { - frameWhiteBack.RemoveAll(); + frameMainMenuBack.RemoveAll(); } else { //鑳屾櫙妗� - frameWhiteBack = new FrameLayout(); - frameWhiteBack.Y = Application.GetRealHeight(288); - frameWhiteBack.Gravity = Gravity.CenterHorizontal; - frameWhiteBack.Height = Application.GetRealHeight(371); - frameWhiteBack.Width = frameWhite.Width - Application.GetRealWidth(29 * 2); - frameWhiteBack.Radius = 10; - frameWhiteBack.BackgroundColor = UserCenterColor.Current.White; - frameWhite.AddChidren(frameWhiteBack); + frameMainMenuBack = new NormalFrameLayout(); + frameMainMenuBack.Y = Application.GetRealHeight(288); + frameMainMenuBack.Gravity = Gravity.CenterHorizontal; + frameMainMenuBack.Height = Application.GetRealHeight(371); + frameMainMenuBack.Width = frameWhite.Width - Application.GetRealWidth(29 * 2); + frameMainMenuBack.Radius = (uint)Application.GetRealHeight(17); + frameMainMenuBack.BackgroundColor = UserCenterColor.Current.White; + frameWhite.AddChidren(frameMainMenuBack); } //鏍囬锛氱鐞� @@ -187,7 +234,7 @@ frameTitle.Width = Application.GetRealWidth(907); frameTitle.Height = Application.GetRealHeight(121); frameTitle.Gravity = Gravity.CenterHorizontal; - frameWhiteBack.AddChidren(frameTitle); + frameMainMenuBack.AddChidren(frameTitle); var btnTitle = new NormalViewControl(500, 60, true); btnTitle.Gravity = Gravity.CenterVertical; btnTitle.TextID = R.MyInternationalizationString.uManagement; @@ -198,7 +245,7 @@ frameTitle.AddChidren(btnLine); //鍒涘缓鍏ㄩ儴鐨勪富鑿滃崟鎺т欢 - this.CreatAllMainMenuControl(frameWhiteBack); + this.CreatAllMainMenuControl(frameMainMenuBack); } /// <summary> @@ -221,6 +268,11 @@ var frame = this.CreatMainMenuControl(frameMenu, TextID, unSelectPic); frame.ButtonClickEvent += (sender, e) => { + if (Common.Config.Instance.Home.IsVirtually == true) + { + //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥 + return; + } var form = new Member.MemberListForm(); form.AddForm(); }; @@ -236,13 +288,16 @@ frame.ButtonClickEvent += (sender, e) => { HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId(); - if (string.IsNullOrEmpty(GatewayResourse.AppOldSelectGatewayId) == false) + //鎷ユ湁缃戝叧,鎴栬�呮槸铏氭嫙浣忓畢,鍒欒繘鍏ヨ澶囧垪琛ㄧ晫闈� + if (string.IsNullOrEmpty(GatewayResourse.AppOldSelectGatewayId) == false + || Common.Config.Instance.Home.IsVirtually == true) { var form = new Device.DeviceListMainForm(); form.AddForm(); } else { + //娌℃湁缃戝叧,鍒欒繘鍏ョ綉鍏冲垪琛ㄧ晫闈� var form = new GatewayManage.GatewayListForm(); form.AddForm(); } @@ -259,8 +314,32 @@ frame.ButtonClickEvent += (sender, e) => { //浣忓畢鎺ュ彛涓嶉渶瑕佺壒娈婄殑鐧婚檰Token - var form = new Residence.ResidenceListForm(); + var form = new Residence.ResidenceListMainForm(); form.AddForm(); + }; + } + + //浜鸿劯绠$悊 + unSelectPic = "Center/FaceManagement.png"; + TextID = R.MyInternationalizationString.uFace; + if (UserCenterResourse.UserInfo.AuthorityNo == 1)//鏄富璐﹀彿鎵嶅睍绀� + { + //鐢熸垚鎺т欢 + var frame = this.CreatMainMenuControl(frameMenu, TextID, unSelectPic); + frame.ButtonClickEvent += (sender, e) => + { + if (Common.Config.Instance.Home.IsVirtually == true) + { + //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥 + return; + } + //鎵撳紑浜鸿劯绠$悊椤甸潰 +#if iOS + Shared.IOS.HDLFVSDK.Video.ShowFaceManagement(); +#endif +#if Android + Com.Evoyohome.Sphonelibs.Global.Global.OpenFaceManageActivity(Application.Activity); +#endif }; } @@ -274,6 +353,11 @@ var frame = this.CreatMainMenuControl(frameMenu, TextID, unSelectPic); frame.ButtonClickEvent += (sender, e) => { + if (Common.Config.Instance.Home.IsVirtually == true) + { + //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥 + return; + } var form = new Safety.SafetyManagementMainForm(); form.AddForm(); }; @@ -330,16 +414,56 @@ /// <param name="frameWhite">鑳屾櫙</param> private void InitOtherMenuControl(FrameLayout frameWhite) { - var frameList = new FrameListControl(26); - frameList.Y = Application.GetRealHeight(698); - frameList.Height = ControlCommonResourse.ListViewRowHeight * 3 + Application.GetRealHeight(26 * 3); - frameWhite.AddChidren(frameList); + if (this.frameOtherMenuContr != null) + { + frameOtherMenuContr.RemoveAll(); + } + else + { + frameOtherMenuContr = new FrameListControl(26); + frameOtherMenuContr.Y = Application.GetRealHeight(698); + frameOtherMenuContr.Height = ControlCommonResourse.ListViewRowHeight * 4 + Application.GetRealHeight(26 * 4); + frameWhite.AddChidren(frameOtherMenuContr); + } + + //鍙瀵硅 + var rowVideo = new FrameRowControl(frameOtherMenuContr.rowSpace / 2); + frameOtherMenuContr.AddChidren(rowVideo); + //鍚戝彸鍥炬爣 + var btnBackVDRight = rowVideo.AddRightArrow(); + btnBackVDRight.X -= ControlCommonResourse.XXLeft / 2; + //鍥炬爣 + var btnBackVDIcon = rowVideo.AddLeftIcon(); + btnBackVDIcon.X -= ControlCommonResourse.XXLeft / 2; + btnBackVDIcon.UnSelectedImagePath = "Item/videoIntercom.png"; + //搴曠嚎 + var btnBackVDLine = rowVideo.AddBottomLine(); + btnBackVDLine.X -= ControlCommonResourse.XXLeft / 2; + //鏁版嵁澶囦唤View + var btnBackVDView = rowVideo.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.videoIntercom), 300); + btnBackVDView.X -= ControlCommonResourse.XXLeft / 2; + rowVideo.ButtonClickEvent += (sender, e) => + { + if (Common.Config.Instance.Home.IsVirtually == true) + { + //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥 + return; + } + +#if iOS + Shared.IOS.HDLFVSDK.Video.ShowDeviceList(); +#endif +#if Android + + Com.Evoyohome.Sphonelibs.Global.Global.OpenIntercomActivity(Application.Activity); +#endif + }; if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2) { //鏁版嵁澶囦唤 - var rowback = new FrameRowControl(frameList.rowSpace / 2); - frameList.AddChidren(rowback); + var rowback = new FrameRowControl(frameOtherMenuContr.rowSpace / 2); + frameOtherMenuContr.AddChidren(rowback); //鍚戝彸鍥炬爣 var btnBackRight = rowback.AddRightArrow(); btnBackRight.X -= ControlCommonResourse.XXLeft / 2; @@ -355,14 +479,19 @@ btnBackView.X -= ControlCommonResourse.XXLeft / 2; rowback.ButtonClickEvent += (sender, e) => { - var form = new HdlBackup.HdlBackupListForm(); - form.AddForm(); + if (Common.Config.Instance.Home.IsVirtually == true) + { + //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥 + return; + } + var form = new HdlBackup.HdlBackupListForm(); + ; form.AddForm(); }; } //鎰忚鍙嶉 - var rowSuggestion = new FrameRowControl(frameList.rowSpace / 2); - frameList.AddChidren(rowSuggestion); + var rowSuggestion = new FrameRowControl(frameOtherMenuContr.rowSpace / 2); + frameOtherMenuContr.AddChidren(rowSuggestion); //鍚戝彸鍥炬爣 var btnSuRight = rowSuggestion.AddRightArrow(); btnSuRight.X -= ControlCommonResourse.XXLeft / 2; @@ -383,8 +512,8 @@ }; //鍏充簬鎴戜滑 - var rowAbount = new FrameRowControl(frameList.rowSpace / 2); - frameList.AddChidren(rowAbount); + var rowAbount = new FrameRowControl(frameOtherMenuContr.rowSpace / 2); + frameOtherMenuContr.AddChidren(rowAbount); //鍚戝彸鍥炬爣 var btnAbountRight = rowAbount.AddRightArrow(); btnAbountRight.X -= ControlCommonResourse.XXLeft / 2; @@ -401,8 +530,33 @@ rowAbount.ButtonClickEvent += (sender, e) => { var form = new Abount.AbountForm(); - form.AddForm(); + form.AddForm(false); }; + + if (UserCenterResourse.HideOption.CenterHideMenu == 1) + { + //闅愬尶鑿滃崟 + var rowHide = new FrameRowControl(frameOtherMenuContr.rowSpace / 2); + frameOtherMenuContr.AddChidren(rowHide); + //鍚戝彸鍥炬爣 + var btnHideRight = rowHide.AddRightArrow(); + btnHideRight.X -= ControlCommonResourse.XXLeft / 2; + //鍥炬爣 + var btnHideIcon = rowHide.AddLeftIcon(); + btnHideIcon.X -= ControlCommonResourse.XXLeft / 2; + btnHideIcon.UnSelectedImagePath = "Center/Abount.png"; + //搴曠嚎 + var btnHideLine = rowHide.AddBottomLine(); + btnHideLine.X -= ControlCommonResourse.XXLeft / 2; + //闅愬尶鑿滃崟View + var btnHideView = rowHide.AddLeftCaption("闅愬尶鑿滃崟", 300); + btnHideView.X -= ControlCommonResourse.XXLeft / 2; + rowHide.ButtonClickEvent += (sender, e) => + { + var from = new HideOption.HideOptionMainForm(); + from.AddForm(); + }; + } } #endregion @@ -414,11 +568,16 @@ /// </summary> public override int FormActionAgainEvent() { + //铏氭嫙浣忓畢涓嶉渶瑕佸埛鏂� + if (Common.Config.Instance.Home.IsVirtually == true) + { + return -1; + } //鐢ㄦ埛澶村儚 if (UserCenterResourse.UserInfo.UserIconFileChanged == true) { UserCenterResourse.UserInfo.UserIconFileChanged = false; - btnUserIcon.ImagePath = UserCenterResourse.UserInfo.UserIconFile; + btnUserIcon.ImageBytes = Shared.IO.FileUtils.ReadFile(UserCenterResourse.UserInfo.UserIconFile); } //鐢ㄦ埛鍚嶅瓧 btnUserName.Text = UserCenterResourse.UserInfo.UserName; @@ -427,21 +586,23 @@ //鐢ㄦ埛韬唤 btnAuthority.Text = UserCenterResourse.UserInfo.AuthorityText; } - if (this.btnImperialCrown != null) + //鐨囧啝 + if (UserCenterResourse.UserInfo.AuthorityNo != 1) { - //鐨囧啝 - if (UserCenterResourse.UserInfo.AuthorityNo != 1) - { - this.btnImperialCrown.Visible = false; - } - else - { - this.btnImperialCrown.Visible = true; - } + this.btnImperialCrown.Visible = false; + } + else + { + this.btnImperialCrown.Visible = true; } + //鍒锋柊淇℃伅鎻愮ず鎺т欢 + this.msgControl?.RefreshStatu(); + //鍒濆鍖栦富鑿滃崟鐨勬帶浠� - this.InitMainMenuInfoControl(frameWhiteBack); + this.InitMainMenuInfoControl(null); + //鍒濆鍖栧叾浠栬彍鍗曠殑鎺т欢 + this.InitOtherMenuControl(null); return 1; } -- Gitblit v1.8.0