wxr
2020-01-18 4cc04639fbadde3a7f3b9875353df0d90fc09043
HDL_ON/UI/UI2/4-PersonalCenter/BLL/PersonalCenterPageBLL.cs
@@ -1,7 +1,106 @@
using System;
namespace HDL_ON.UI2
using Shared;
namespace HDL_ON.UI
{
    public partial class PersonalCenterPage
    {
        /// <summary>
        /// 加载事件列表
        /// </summary>
        void LoadEventList()
        {
            LoadEvent_SwitchHome();
            LoadEvent_GoPersonalDataPage();
        }
        #region 切换住宅
        /// <summary>
        /// 住宅列表点击事件
        /// </summary>
        void LoadEvent_SwitchHome()
        {
            btnCurResidenceName.MouseUpEventHandler += (sender, e) => {
                var dialog = new Dialog();
                var dialogBody = new FrameLayout();
                dialog.AddChidren(dialogBody);
                dialogBody.MouseUpEventHandler += (sender1, e1) => {
                    dialog.Close();
                };
                var dispalyView = new FrameLayout()
                {
                    X = Application.GetRealWidth(22),
                    Y = Application.GetRealHeight(268),
                    Width = Application.GetRealWidth(160),
                    Height = Application.GetRealHeight(190),
                    BackgroundImagePath = "PersonalCenter/HomeListbg.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),
                };
                dispalyView.AddChidren(contentView);
                foreach(var home in MainPage.LoginUser.HomeLists)
                {
                    var btnHomeName = new Button()
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(112),
                        Height = Application.GetRealHeight(44),
                        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,
                        IsMoreLines = true,
                        Tag = home
                    };
                    contentView.AddChidren(btnHomeName);
                    var btnContentLine = new Button()
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(112),
                        Height = Application.GetRealHeight(1),
                        BackgroundColor = UI.CSS.CSS_Color.SecondLevelTitleColor
                    };
                    contentView.AddChidren(btnContentLine);
                    btnHomeName.MouseUpEventHandler += (senderH, en) =>
                    {
                        var regionInfo = btnHomeName.Tag as RegionInfoRes;
                        dialog.Close();
                        UserConfig.Instance.CurrentRegion = regionInfo;
                        btnCurResidenceName.Text = regionInfo.Name;
                        UserConfig.Instance.SaveUserConfig();
                    };
                }
                dialog.Show();
            };
        }
        #endregion
        #region 个人中心
        void LoadEvent_GoPersonalDataPage()
        {
            btnUserHeadPortrait.MouseUpEventHandler += (sender, e) => {
                var personalDataView = new PersonalDataPage();
                MainPage.BasePageView.AddChidren(personalDataView);
                personalDataView.LoadView();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
        }
        #endregion
    }
}