From eda3fb873e59544ff36301b51e05aef64f87b0f9 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期五, 27 八月 2021 13:21:21 +0800 Subject: [PATCH] Merge branch 'newBranch1' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into newBranch1 --- HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs | 359 +++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 311 insertions(+), 48 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs index daabf42..8bd3b10 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs @@ -1,10 +1,15 @@ 锘縰sing System; +using System.Collections.Generic; +using HDL_ON.DAL.Server; +using HDL_ON.Entity; using Shared; namespace HDL_ON.UI { public partial class PersonalCenterPage { + + /// <summary> /// 鍔犺浇浜嬩欢鍒楄〃 /// </summary> @@ -12,11 +17,76 @@ { LoadEvent_SwitchHome(); LoadEvent_GoPersonalDataPage(); - LoadEvent_SkipResdentialManagePage(); - - + LoadEvent_SkipAboutOnPage(); + LoadEvent_SkipGetSupportPage(); + if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare) + { + LoadEvent_SkipResdentialManagePage(); + LoadEvent_GoMemberManagement(); + LoadEvent_SkipbtnAddFunctionPage(); + LoadEvent_SkipSmartSpeakerPage(); + } + if(DB_ResidenceData.Instance.GatewayType == 1) + { + LoadEvent_SecurityEvent(); + } } + /// <summary> + /// 瀹夐槻閮ㄥ垎浜嬩欢 + /// </summary> + void LoadEvent_SecurityEvent() + { + if (btnResidenceArmIcon != null) + { + btnResidenceArmIcon.IsSelected = false; + lock (FunctionList.List.securities) + { + foreach (var temp in FunctionList.List.securities) + { + if (temp.status == "enable") + { + if (temp.alarm) + { + btnResidenceArmIcon.SelectedImagePath = "PersonalCenter/ResidenceInAlarmIcon.png"; + } + else + { + btnResidenceArmIcon.SelectedImagePath = "PersonalCenter/ResidenceDefenseIcon.png"; + } + btnResidenceArmIcon.IsSelected = true; + break; + } + } + } + btnResidenceArmIcon.MouseUpEventHandler = (sender, e) => + { + var page = new ArmCenterPage(); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + } + if (btnResidenceArmText != null) + { + btnResidenceArmText.TextID = StringId.Undefense; + foreach (var temp in FunctionList.List.securities) + { + if (temp.status == "enable") + { + btnResidenceArmText.TextID = StringId.Defense; + break; + } + } + btnResidenceArmText.MouseUpEventHandler = (sender, e) => + { + var page = new ArmCenterPage(); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + } + } #region 鍒囨崲浣忓畢 /// <summary> @@ -24,100 +94,293 @@ /// </summary> void LoadEvent_SwitchHome() { - btnCurResidenceName.MouseUpEventHandler += (sender, e) => { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { var dialog = new Dialog(); var dialogBody = new FrameLayout(); dialog.AddChidren(dialogBody); - dialogBody.MouseUpEventHandler += (sender1, e1) => { + dialogBody.MouseUpEventHandler = (sender1, e1) => + { dialog.Close(); }; var dispalyView = new FrameLayout() { - X = Application.GetRealWidth(22), + X = Application.GetRealWidth(10), Y = Application.GetRealHeight(268), Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(190), - BackgroundImagePath = "PersonalCenter/HomeListbg.png", + Height = Application.GetRealHeight(110), + BackgroundImagePath = "PersonalCenter/HomeList1bg.png", }; dialogBody.AddChidren(dispalyView); - var contentView = new VerticalScrolViewLayout() { - X = Application.GetRealWidth(8), - Y = Application.GetRealHeight(16), - Width = Application.GetRealWidth(144), - Height = Application.GetRealHeight(45*4), + var contentView = new VerticalScrolViewLayout() + { + X = Application.GetRealWidth(22), + Y = Application.GetRealHeight(15), + Width = Application.GetRealWidth(150), + Height = Application.GetRealHeight(45), + ScrollEnabled = false }; dispalyView.AddChidren(contentView); - foreach(var home in MainPage.LoginUser.HomeLists) + if (UserInfo.Current.regionList.Count < 2) + { + + } + else if (UserInfo.Current.regionList.Count < 3) + { + dispalyView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(268), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(105), + BackgroundImagePath = "PersonalCenter/HomeList1bg.png", + }; + dialogBody.AddChidren(dispalyView); + + contentView.Height = Application.GetRealHeight(45 * 2); + dispalyView.AddChidren(contentView); + } + else if (UserInfo.Current.regionList.Count < 4) + { + dispalyView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(268), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(155), + BackgroundImagePath = "PersonalCenter/HomeList2bg.png", + }; + dialogBody.AddChidren(dispalyView); + + contentView.Height = Application.GetRealHeight(45 * 3); + dispalyView.AddChidren(contentView); + } + else if (UserInfo.Current.regionList.Count < 5) + { + dispalyView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(268), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(200), + BackgroundImagePath = "PersonalCenter/HomeList3bg.png", + }; + dialogBody.AddChidren(dispalyView); + + contentView.Height = Application.GetRealHeight(45 * 4); + dispalyView.AddChidren(contentView); + } + else + { + dispalyView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(268), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(245), + BackgroundImagePath = "PersonalCenter/HomeList4bg.png", + }; + dialogBody.AddChidren(dispalyView); + + contentView.Height = Application.GetRealHeight(45 * 5); + contentView.ScrollEnabled = true; + dispalyView.AddChidren(contentView); + } + + + + foreach (var home in UserInfo.Current.regionList) { var btnHomeName = new Button() { - Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(44), + Height = Application.GetRealHeight(40), TextAlignment = TextAlignment.CenterLeft, - TextColor = UI.CSS.CSS_Color.MainBackgroundColor, - SelectedTextColor = UI.CSS.CSS_Color.MainColor, - Text = home.Name, - TextSize = UI.CSS.CSS_FontSize.SubheadingFontSize, - IsSelected = UserConfig.Instance.CurrentRegion.RegionID == home.RegionID, + TextColor = CSS.CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS.CSS_Color.MainColor, + Text = home.homeName, + TextSize = home.homeName.Length > 14 ? CSS.CSS_FontSize.TextFontSize : CSS.CSS_FontSize.SubheadingFontSize, + IsSelected = DB_ResidenceData.Instance.CurrentRegion.id == home.id, IsMoreLines = true, - Tag = home + Tag = home.id }; contentView.AddChidren(btnHomeName); - var btnContentLine = new Button() + + if (UserInfo.Current.regionList.IndexOf(home) < UserInfo.Current.regionList.Count - 1) { - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(1), - BackgroundColor = UI.CSS.CSS_Color.SecondLevelTitleColor - }; - contentView.AddChidren(btnContentLine); + contentView.AddChidren(new Button() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS.CSS_Color.BackgroundColor + }); + } btnHomeName.MouseUpEventHandler += (senderH, en) => { - var regionInfo = btnHomeName.Tag as RegionInfoRes; + var regionId = (string)btnHomeName.Tag; dialog.Close(); - - UserConfig.Instance.CurrentRegion = regionInfo; - btnCurResidenceName.Text = regionInfo.Name; - UserConfig.Instance.SaveUserConfig(); + LoadEvent_ChangeCurHome(home); + LoadContentView(); }; } - dialog.Show(); }; - } + btnResidenceDownIcon.MouseUpEventHandler = eventHandler; + btnCurResidenceName.MouseUpEventHandler = eventHandler; + } + /// <summary> + /// 鏇存崲褰撳墠閫変腑浣忓畢 + /// </summary> + /// <param name="homeTemp"></param> + void LoadEvent_ChangeCurHome(RegionInfoRes homeTemp) + { + if (DB_ResidenceData.Instance.CurrentRegion.id == homeTemp.id) + { + return; + } + DB_ResidenceData.Instance.CurrentRegion = homeTemp; + DB_ResidenceData.Instance.SaveResidenceData(); + btnCurResidenceName.Text = DB_ResidenceData.Instance.CurrentRegion.homeName; + DB_ResidenceData.Instance.EixtAccount(); + //鍒锋柊浣忓畢鏁版嵁 + Common.ApiUtlis.Ins.DownloadData(); + } #endregion #region 浣忓畢绠$悊 void LoadEvent_SkipResdentialManagePage() { - EventHandler<MouseEventArgs> eventHandler = (sender, e) => { - var residentialManagePage = new ResidentialManagePage(); - MainPage.BasePageView.AddChidren(residentialManagePage); - residentialManagePage.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; - btnResidenceManageIcon.MouseUpEventHandler = eventHandler; - btnResidenceManageText.MouseUpEventHandler = eventHandler; + if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare) + { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + Action updateResidenceName = () => + { + btnCurResidenceName.Text = DB_ResidenceData.Instance.CurrentRegion.homeName; + }; + var residentialManagePage = new ResidentialManagePage(updateResidenceName); + MainPage.BasePageView.AddChidren(residentialManagePage); + residentialManagePage.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + btnResidenceManageIcon.MouseUpEventHandler = eventHandler; + btnResidenceManageText.MouseUpEventHandler = eventHandler; + } } - #endregion #region 涓汉涓績 void LoadEvent_GoPersonalDataPage() { - btnUserHeadPortrait.MouseUpEventHandler += (sender, e) => { - var personalDataView = new PersonalDataPage(); + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + Action updataHeadImage = () => + { + userHeadImageView.ImagePath = UserInfo.Current.headImagePagePath; + }; + Action updataUserName = () => + { + btnUserName.Text = UserInfo.Current.userName; + }; + + var personalDataView = new PersonalDataPage(updataHeadImage, updataUserName); MainPage.BasePageView.AddChidren(personalDataView); personalDataView.LoadView(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; + userHeadImageView.MouseUpEventHandler = eventHandler; + btnUserName.MouseUpEventHandler = eventHandler; + btnEmail.MouseUpEventHandler = eventHandler; + } #endregion + + #region 鎴愬憳绠$悊 + void LoadEvent_GoMemberManagement() + { + EventHandler<MouseEventArgs> eHandler = (sender, e) => + { + var mmp = new MemberManagementPage(); + MainPage.BasePageView.AddChidren(mmp); + mmp.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + btnResidenceMemberIcon.MouseUpEventHandler = eHandler; + btnResidenceMemberText.MouseUpEventHandler = eHandler; + } + + #endregion + + #region 娣诲姞璁惧 + void LoadEvent_SkipbtnAddFunctionPage() + { + if (DB_ResidenceData.Instance.GatewayType == 1) + { + try + { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + var page = new BrandListPage(); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + btnResidenceAddFunctionIcon.MouseUpEventHandler = eventHandler; + btnResidenceAddFunctionText.MouseUpEventHandler = eventHandler; + } + catch { } + } + } + #endregion + + #region 鍏充簬On銆佽幏鍙栨敮鎸� + /// <summary> + /// 璺宠浆鑷冲叧浜嶰n椤甸潰 + /// </summary> + void LoadEvent_SkipAboutOnPage() + { + btnAboutOnText.MouseUpEventHandler = (sender, e) => + { + var aboutOnPage = new AboutOnPage(); + MainPage.BasePageView.AddChidren(aboutOnPage); + aboutOnPage.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + } + /// <summary> + /// 璺宠浆鑷宠幏鍙栨敮鎸侀〉闈� + /// </summary> + void LoadEvent_SkipGetSupportPage() + { + btnSupportText.MouseUpEventHandler = (sender, e) => + { + var getsupportPage = new FAQHelpPage(); + MainPage.BasePageView.AddChidren(getsupportPage); + getsupportPage.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + } + + /// <summary> + /// 璺宠浆鏅鸿兘闊崇椤甸潰 + /// </summary> + void LoadEvent_SkipSmartSpeakerPage() + { + btnSmartSpeakerText.MouseUpEventHandler = (sender, e) => + { + var page = new SmartSpeakerListPage(); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + } + #endregion + + } -} +} \ No newline at end of file -- Gitblit v1.8.0