wxr
2020-04-14 06696e6f225733a60b03eea4a7c6374053d92c1d
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs
@@ -1,4 +1,5 @@
using System;
using HDL_ON.Entity;
using Shared;
namespace HDL_ON.UI
@@ -12,11 +13,11 @@
        {
            LoadEvent_SwitchHome();
            LoadEvent_GoPersonalDataPage();
            LoadEvent_SkipResdentialManagePage();
            if (MainPage.LoginUser.accountType == 0)
            {
                LoadEvent_SkipResdentialManagePage();
            }
        }
        #region 切换住宅
        /// <summary>
@@ -24,6 +25,79 @@
        /// </summary>
        void LoadEvent_SwitchHome()
        {
#if DEBUG
            btnUserTypeName.MouseUpEventHandler = (sender, e) =>
            {
                var pm = new HDL_ON.DAL.Server.HttpServerRequest();
                var iddd = pm.GetRegionLastBackupId();
                Dialog dialog = new Dialog();
                FrameLayout bodyView = new FrameLayout();
                dialog.AddChidren(bodyView);
                bodyView.MouseUpEventHandler = (sender3, e3) => {
                    dialog.Close();
                };
                FrameLayout frame = new FrameLayout()
                {
                    Gravity = Gravity.Center,
                    Width = Application.GetRealWidth(280),
                    Height =Application.GetRealHeight(300),
                    BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
                    Radius = (uint)Application.GetRealWidth(16),
                };
                dialog.AddChidren(frame);
                Button btnTitleDialog = new Button()
                {
                    Height = Application.GetRealHeight(60),
                    TextAlignment = TextAlignment.Center,
                    Text = "数据恢复",
                    TextSize = CSS.CSS_FontSize.SubheadingFontSize,
                    TextColor = CSS.CSS_Color.SecondLevelTitleColor,
                    BackgroundColor = CSS.CSS_Color.PromptingColor2,
                };
                frame.AddChidren(btnTitleDialog);
                VerticalScrolViewLayout view = new VerticalScrolViewLayout()
                {
                    Y = Application.GetRealHeight(60),
                    Height = Application.GetRealHeight(290),
                };
                frame.AddChidren(view);
                foreach(var dd in iddd)
                {
                    Button btn = new Button()
                    {
                        Height = Application.GetRealHeight(50),
                        TextAlignment = TextAlignment.Center,
                        TextSize = CSS.CSS_FontSize.TextFontSize,
                        TextColor = CSS.CSS_Color.TextualColor,
                        Text = dd.Value,
                    };
                    view.AddChidren(btn);
                    btn.MouseUpEventHandler = (sender1, e1) =>
                    {
                        dialog.Close();
                        pm.GetBackupFileList(dd.Key);
                    };
                    view.AddChidren(new Button()
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Height = Application.GetRealHeight(1),
                        BackgroundColor = CSS.CSS_Color.BackgroundColor
                    });
                }
                dialog.Show();
            };
#endif
            btnCurResidenceName.MouseUpEventHandler += (sender, e) => {
                var dialog = new Dialog();
                var dialogBody = new FrameLayout();
@@ -37,20 +111,20 @@
                    X = Application.GetRealWidth(22),
                    Y = Application.GetRealHeight(268),
                    Width = Application.GetRealWidth(160),
                    Height = Application.GetRealHeight(190),
                    Height = Application.GetRealHeight(198),
                    BackgroundImagePath = "PersonalCenter/HomeListbg.png",
                };
                dialogBody.AddChidren(dispalyView);
                var contentView = new VerticalScrolViewLayout() {
                    X = Application.GetRealWidth(8),
                    Y = Application.GetRealHeight(10),
                    Y = Application.GetRealHeight(15),
                    Width = Application.GetRealWidth(150),
                    Height = Application.GetRealHeight(44*4),
                    Height = Application.GetRealHeight(45*4),
                };
                dispalyView.AddChidren(contentView);
                foreach(var home in MainPage.LoginUser.HomeLists)
                foreach(var home in MainPage.LoginUser.regionList)
                {
                    var btnHomeName = new Button()
                    {
@@ -61,14 +135,15 @@
                        TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                        SelectedTextColor = CSS.CSS_Color.MainColor,
                        Text = home.Name,
                        TextSize = CSS.CSS_FontSize.SubheadingFontSize,
                        IsSelected = UserConfig.Instance.CurrentRegion.RegionID == home.RegionID,
                        TextSize = home.Name.Length > 14 ? CSS.CSS_FontSize.TextFontSize : CSS.CSS_FontSize.SubheadingFontSize,
                        IsSelected = DB_ResidenceData.residenceData.residecenInfo.RegionID == home.RegionID,
                        IsMoreLines = true,
                        Tag = home
                    };
                    contentView.AddChidren(btnHomeName);
                    //if(btnHomeName)
                    if (MainPage.LoginUser.HomeLists.IndexOf(home) < MainPage.LoginUser.HomeLists.Count - 1)
                    if (MainPage.LoginUser.regionList.IndexOf(home) < MainPage.LoginUser.regionList.Count - 1)
                    {
                        contentView.AddChidren(new Button()
                        {
@@ -84,9 +159,9 @@
                        var regionInfo = btnHomeName.Tag as RegionInfoRes;
                        dialog.Close();
                        UserConfig.Instance.CurrentRegion = regionInfo;
                        DB_ResidenceData.residenceData.residecenInfo = regionInfo;
                        btnCurResidenceName.Text = regionInfo.Name;
                        UserConfig.Instance.SaveUserConfig();
                        OnAppConfig.Instance.SaveUserConfig();
                    };
                }
@@ -99,23 +174,31 @@
        #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 (MainPage.LoginUser.accountType == 0)
            {
                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;
            }
        }
        #endregion
        #region 个人中心
        void LoadEvent_GoPersonalDataPage()
        {
            btnUserHeadPortrait.MouseUpEventHandler += (sender, e) => {
                var personalDataView = new PersonalDataPage();
            userHeadImageView.MouseUpEventHandler += (sender, e) => {
                Action updataHeadImage = () => {
                    userHeadImageView.ImagePath = MainPage.LoginUser.headImagePagePath;
                };
                var personalDataView = new PersonalDataPage(updataHeadImage);
                MainPage.BasePageView.AddChidren(personalDataView);
                personalDataView.LoadView();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;