From c1de48884fa145a16a0f8bcee93274dcfaa0ff82 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期四, 07 五月 2020 10:40:28 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into dev-2020xm --- ZigbeeApp/Shared/Phone/UserView/UserPage.cs | 346 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 346 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs new file mode 100755 index 0000000..f391d26 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs @@ -0,0 +1,346 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared.Common; +using System.Text; + +namespace Shared.Phone.UserView +{ + /// <summary> + /// User page. + /// </summary> + public class UserPage : FrameLayout + { + #region 鈼� 鍙橀噺_______________________ + /// <summary> + /// The user menu page. + /// </summary> + static UserPage userMenuPage; + /// <summary> + /// 搴曢儴鍗曠嫭鑿滃崟鐨勫搴�-360 + /// </summary> + private static readonly int tabBarEnum_Width = CommonPage.AppRealWidth / 3; + /// <summary> + /// 搴曢儴鎸夐挳鍥剧墖鐨勯珮搴� + /// </summary> + private static readonly int tabBarEnumIMG_Height = 98; + /// <summary> + /// 搴曢儴鎸夐挳鍥剧墖鐨勫搴� + /// </summary> + private static readonly int tabBarEnumIMG_Width = 138; + /// <summary> + /// 搴曢儴鎸夐挳鍥剧墖鐨刌鍊� + /// </summary> + private static readonly int tabBarEnumIMG_Y = 3; + /// <summary> + /// 搴曢儴鎸夐挳鏂囧瓧鐨勯珮搴� + /// </summary> + private static readonly int tabBarEnumName_Height = 40; + /// <summary> + /// 搴曢儴鎸夐挳鏂囧瓧鐨刌鍊� + /// </summary> + private static readonly int tabBarEnumName_Y = 98; + #endregion + + /// <summary> + /// 鐢ㄦ埛鐣岄潰 + /// </summary> + /// <value>The instance.</value> + public static UserPage Instance + { + get + { + if (userMenuPage == null) + { + userMenuPage = new UserPage { }; + } + return userMenuPage; + } + } + + /// <summary> + /// Initializes a new instance of the <see cref="T:Shared.Phone.UserView.UserPage"/> class. + /// </summary> + public UserPage() + { + BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor; + Shared.Application.LocationAction += (lon, lat) => + { + Login.AccountLogic.Instance.ReceiveAppLatAndLon(lon.ToString(), lat.ToString()); + }; + } + + /// <summary> + /// 鐢ㄦ埛涓讳綋鐣岄潰锛堜腑闂撮儴鍒嗭級 + /// </summary> + public FrameLayout BodyView = new FrameLayout + { + Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.TabbarHeight), + BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor, + }; + /// <summary> + /// 鐢ㄦ埛鑿滃崟鐣岄潰锛堝簳閮ㄩ儴鍒嗭級 + /// </summary> + public FrameLayout BottomMenuView = new FrameLayout + { + Y = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.TabbarHeight), + Height = Application.GetRealHeight(CommonPage.TabbarHeight), + BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCBottomColor, + }; + + #region 鍒嗗壊绾� + + private Button bottomLine = new Button + { + Height = 1, + BackgroundColor = ZigbeeColor.Current.GXCBottomLineColor + }; + + #endregion + + #region 搴曢儴-涓婚〉鎸夐挳 + /// <summary> + /// 搴曢儴-涓婚〉鎸夐挳 + /// </summary> + public FrameLayout homePageFL = new FrameLayout + { + Width = Application.GetRealWidth(tabBarEnum_Width), + Height = Application.GetRealHeight(CommonPage.TabbarHeight), + + }; + /// <summary> + /// The home page image. + /// </summary> + public Button homePageIMG = new Button + { + Y = Application.GetRealHeight(tabBarEnumIMG_Y), + Height = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(tabBarEnumIMG_Height), + Width = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(tabBarEnumIMG_Width), + UnSelectedImagePath = "Navigation/Home.png", + SelectedImagePath = "Navigation/HomeSelected.png", + Gravity = Gravity.CenterHorizontal + }; + /// <summary> + /// The name of the home page. + /// </summary> + public Button homePageName = new Button + { + Y = Application.GetRealHeight(tabBarEnumName_Y), + Height = Application.GetRealHeight(tabBarEnumName_Height), + TextID = R.MyInternationalizationString.HomePage, + TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor, + SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2, + Gravity = Gravity.CenterHorizontal, + TextSize = 10 + }; + #endregion + + #region 鍒嗙被-搴曢儴鎸夐挳 + /// <summary> + /// 鍒嗙被-搴曢儴鎸夐挳 + /// </summary> + public FrameLayout categoryFL = new FrameLayout + { + X = Application.GetRealWidth(tabBarEnum_Width), + Width = Application.GetRealWidth(tabBarEnum_Width), + Height = Application.GetRealHeight(CommonPage.TabbarHeight) + }; + /// <summary> + /// The category image. + /// </summary> + public Button categoryIMG = new Button + { + Y = Application.GetRealHeight(tabBarEnumIMG_Y), + Height = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(tabBarEnumIMG_Height), + Width = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(tabBarEnumIMG_Width), + UnSelectedImagePath = "Navigation/Category.png", + SelectedImagePath = "Navigation/CategorySelected.png", + Gravity = Gravity.CenterHorizontal + }; + /// <summary> + /// The name of the category. + /// </summary> + public Button categoryName = new Button + { + Y = Application.GetRealHeight(tabBarEnumName_Y), + Height = Application.GetRealHeight(tabBarEnumName_Height), + TextID = R.MyInternationalizationString.Category, + TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor, + SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2, + Gravity = Gravity.CenterHorizontal, + TextSize = 10 + }; + #endregion + + #region 涓汉涓績-搴曢儴鎸夐挳 + /// <summary> + /// 涓汉涓績-搴曢儴鎸夐挳 + /// </summary> + public FrameLayout settingFL = new FrameLayout + { + X = Application.GetRealWidth(tabBarEnum_Width * 2), + Width = Application.GetRealWidth(tabBarEnum_Width), + Height = Application.GetRealHeight(CommonPage.TabbarHeight) + }; + /// <summary> + /// The setting image. + /// </summary> + public Button settingIMG = new Button + { + Y = Application.GetRealHeight(tabBarEnumIMG_Y), + Height = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(tabBarEnumIMG_Height), + Width = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(tabBarEnumIMG_Width), + UnSelectedImagePath = "Navigation/Setting.png", + SelectedImagePath = "Navigation/SettingSelected.png", + Gravity = Gravity.CenterHorizontal + }; + /// <summary> + /// 涓汉涓績 + /// </summary> + public Button settingName = new Button + { + Y = Application.GetRealHeight(tabBarEnumName_Y), + Height = Application.GetRealHeight(tabBarEnumName_Height), + TextID = R.MyInternationalizationString.Me, + TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor, + SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2, + Gravity = Gravity.CenterHorizontal, + TextSize = 10 + }; + #endregion + + #region 寮哄埗鏄剧ず鑷姩鍖栫晫闈� + + /// <summary> + /// 寮哄埗鏄剧ず鑷姩鍖栧垪琛ㄧ晫闈� + /// </summary> + public void ShowCategoryAutoListForm() + { + //鍏抽棴鍏ㄩ儴鐣岄潰,鐩村埌涓婚〉涓烘 + UserCenter.UserCenterLogic.CloseAllOpenForm(); + //寮哄埗鏄剧ず鑷姩鍖栧垪琛ㄧ晫闈� + UserCenter.UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = 2; + BottomEventHandler(Instance.categoryIMG, null); + } + + #endregion + + EventHandler<MouseEventArgs> BottomEventHandler = (sender, e) => + { + if (sender == Instance.homePageIMG || sender == Instance.homePageName) + { + if (Instance.homePageName.IsSelected == true && e != null) + { + //鍙湁鏄墜鍔ㄧ偣鍑荤殑鏃跺�欐墠澶勭悊 + return; + } + Instance.BodyView.RemoveAll(); + //涓婚〉 + CommonPage.Instance.IsDrawerLockMode = false; + Instance.homePageName.IsSelected = true; + Instance.homePageIMG.IsSelected = true; + + Instance.categoryName.IsSelected = false; + Instance.categoryIMG.IsSelected = false; + + Instance.settingName.IsSelected = false; + Instance.settingIMG.IsSelected = false; + + var home = new MainPage.HomeMainPageForm(); + Instance.BodyView.AddChidren(home); + home.ShowForm(); + + } + else if (sender == Instance.categoryIMG || sender == Instance.categoryName) + { + if (Instance.categoryName.IsSelected == true && e != null) + { + //鍙湁鏄墜鍔ㄧ偣鍑荤殑鏃跺�欐墠澶勭悊 + return; + } + + Instance.BodyView.RemoveAll(); + //鍒嗙被 + CommonPage.Instance.IsDrawerLockMode = true; + Instance.categoryName.IsSelected = true; + Instance.categoryIMG.IsSelected = true; + + Instance.homePageName.IsSelected = false; + Instance.homePageIMG.IsSelected = false; + + Instance.settingName.IsSelected = false; + Instance.settingIMG.IsSelected = false; + + var category = new Category.CategoryMainForm { }; + Instance.BodyView.AddChidren(category); + category.ShowForm(); + } + else if (sender == Instance.settingIMG || sender == Instance.settingName) + { + if (Instance.settingName.IsSelected == true && e != null) + { + return; + } + Instance.BodyView.RemoveAll(); + //涓汉涓績 + CommonPage.Instance.IsDrawerLockMode = true; + Instance.settingName.IsSelected = true; + Instance.settingIMG.IsSelected = true; + + Instance.homePageName.IsSelected = false; + Instance.homePageIMG.IsSelected = false; + + Instance.categoryName.IsSelected = false; + Instance.categoryIMG.IsSelected = false; + + var form = new UserCenter.UserMain.UserMainForm(); + Instance.BodyView.AddChidren(form); + form.ShowForm(); + } + }; + + /// <summary> + /// Fresh this instance. + /// </summary> + public void Fresh() + { + BottomEventHandler(Instance.homePageIMG, null); + } + + /// <summary> + /// Inits the page. + /// </summary> + public void InitPage() + { + if (0 < ChildrenCount) + { + return; + } + + AddChidren(BodyView); + AddChidren(BottomMenuView); + + BottomMenuView.AddChidren(Instance.bottomLine); + + Instance.homePageFL.AddChidren(Instance.homePageIMG); + Instance.homePageFL.AddChidren(Instance.homePageName); + BottomMenuView.AddChidren(Instance.homePageFL); + + Instance.categoryFL.AddChidren(Instance.categoryIMG); + Instance.categoryFL.AddChidren(Instance.categoryName); + BottomMenuView.AddChidren(Instance.categoryFL); + + Instance.settingFL.AddChidren(Instance.settingIMG); + Instance.settingFL.AddChidren(Instance.settingName); + BottomMenuView.AddChidren(Instance.settingFL); + + homePageIMG.MouseUpEventHandler += BottomEventHandler; + homePageName.MouseUpEventHandler += BottomEventHandler; + + categoryIMG.MouseUpEventHandler += BottomEventHandler; + categoryName.MouseUpEventHandler += BottomEventHandler; + + settingIMG.MouseUpEventHandler += BottomEventHandler; + settingName.MouseUpEventHandler += BottomEventHandler; + } + } +} -- Gitblit v1.8.0