陈嘉乐
2020-12-03 0f2e0147e8990e913d16d99bc1b94fb6bc53abd7
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
@@ -1,7 +1,6 @@
using System;
using Shared;
using Shared;
using HDL_ON.UI.CSS;
using HDL_ON.UI;
using HDL_ON.Entity;
namespace HDL_ON.UI
{
@@ -32,7 +31,11 @@
        /// <summary>
        /// 用户头像
        /// </summary>
        Button btnUserHeadPortrait;
        ImageView userHeadImageView;
        /// <summary>
        /// 滚动部分
        /// </summary>
        VerticalScrolViewLayout contentView;
        /// <summary>
        /// 住宅信息区域
        /// </summary>
@@ -54,7 +57,7 @@
        /// </summary>
        Button btnUserTypeIcon;
        /// <summary>
        /// 用户类型图标
        /// 用户类型名称
        /// </summary>
        Button btnUserTypeName;
        /// <summary>
@@ -93,18 +96,18 @@
        /// 区域安放小区域文本
        /// </summary>
        Button btnResidenceArmText;
        /// <summary>
        /// 区域数据备份小区域
        /// </summary>
        FrameLayout residenceDataBackupView;
        /// <summary>
        /// 区域数据备份小区域图标
        /// </summary>
        Button btnResidenceDataBackupIcon;
        /// <summary>
        /// 区域数据备份小区域文本
        /// </summary>
        Button btnResidenceDataBackupText;
        ///// <summary>
        ///// 区域数据备份小区域
        ///// </summary>
        //FrameLayout residenceDataBackupView;
        ///// <summary>
        ///// 区域数据备份小区域图标
        ///// </summary>
        //Button btnResidenceDataBackupIcon;
        ///// <summary>
        ///// 区域数据备份小区域文本
        ///// </summary>
        //Button btnResidenceDataBackupText;
        /// <summary>
        /// 区域辅助功能小区域
        /// </summary>
@@ -129,42 +132,34 @@
        /// 区域添加功能小区域文本
        /// </summary>
        Button btnResidenceAddFunctionText;
        /// <summary>
        /// 软件设置区域
        /// </summary>
        FrameLayout softSettingView;
        /// <summary>
        /// 软件夜览模式图标
        /// </summary>
        Button btnNightViewModeIcon;
        /// <summary>
        /// 软件夜览模式文本
        /// </summary>
        Button btnNightViewModeText;
        /// <summary>
        /// 软件夜览模式按钮
        /// </summary>
        Button btnNightViewModeSwitch;
        /// <summary>
        /// 通用设置图标
        /// </summary>
        Button btnGeneralSettingsIcon;
        /// <summary>
        /// 通用设置文本
        /// </summary>
        Button btnGeneralSettingsText;
        /// <summary>
        /// 获取支持小区域
        /// </summary>
        FrameLayout supportView;
        /// <summary>
        /// 获取支持图标
        /// </summary>
        Button btnSupportIcon;
        /// <summary>
        /// 获取支持文本
        /// </summary>
        Button btnSupportText;
        /// <summary>
        /// 关于On文本
        /// </summary>
        Button btnAboutOnText;
        #endregion
        public PersonalCenterPage()
@@ -193,7 +188,7 @@
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(94),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealHeight(5),
                Radius = (uint)Application.GetRealHeight(12),
                BorderColor = 0x00FFFFFF,
                BorderWidth = 0,
            };
@@ -206,12 +201,13 @@
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                Text = string.IsNullOrEmpty(MainPage.LoginUser.UserName) ? "不愿意透露姓名的用户" : MainPage.LoginUser.UserName
                Text = string.IsNullOrEmpty( UserInfo.Current.userName) ? Language.StringByID(StringId.UsersWhoNameIsEmpty) :  UserInfo.Current.userName
            };
            personalInfoView.AddChidren(btnUserName);
            if (!string.IsNullOrEmpty(MainPage.LoginUser.UserName))
            if (!string.IsNullOrEmpty( UserInfo.Current.userName))
            {
                btnUserName.Text = MainPage.LoginUser.UserName;
                btnUserName.Text =  UserInfo.Current.userName; ;
            }
            btnEmail = new Button()
            {
@@ -220,53 +216,71 @@
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Text = MainPage.LoginUser.AccountString
                Text =  UserInfo.Current.AccountString
            };
            personalInfoView.AddChidren(btnEmail);
            btnUserHeadPortrait = new Button()
            userHeadImageView = new ImageView()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(51),
                Width = Application.GetMinRealAverage(84),
                Height = Application.GetMinRealAverage(84),
                Radius = (uint)Application.GetMinRealAverage(42),
                UnSelectedImagePath = "LoginIcon/2.png"
                ImagePath =  UserInfo.Current.headImagePagePath
            };
            bodyView.AddChidren(btnUserHeadPortrait);
            bodyView.AddChidren(userHeadImageView);
            //if (  UserInfo.Current.headImagePageBytes==null)
            //{
            //    userHeadImageView.ImagePath =  UserInfo.Current.headImagePagePath;
            //}else
            //{
            //    userHeadImageView.ImageBytes =  UserInfo.Current.headImagePageBytes;
            //}
            #endregion
            contentView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(8) + personalInfoView.Bottom,
                Height = Application.GetRealHeight(400),
            };
            bodyView.AddChidren(contentView);
            LoadContentView();
        }
        public void LoadContentView()
        {
            contentView.RemoveAll();
            #region 住宅信息区域
            if (MainPage.LoginUser.AccountType == 0)
            if (!DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
            {
                residenceInfoView = new FrameLayout()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealHeight(8) + personalInfoView.Bottom,
                    Width = Application.GetRealWidth(343),
                    Height = Application.GetRealHeight(213),
                    BackgroundColor = CSS_Color.MainBackgroundColor,
                    Radius = (uint)Application.GetRealHeight(5),
                    Radius = (uint)Application.GetRealHeight(12),
                    BorderColor = 0x00FFFFFF,
                    BorderWidth = 0,
                };
                bodyView.AddChidren(residenceInfoView);
                contentView.AddChidren(residenceInfoView);
            }
            else
            {
                residenceInfoView = new FrameLayout()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealHeight(8) + personalInfoView.Bottom,
                    Width = Application.GetRealWidth(343),
                    Height = Application.GetRealHeight(144),
                    BackgroundColor = CSS_Color.MainBackgroundColor,
                    Radius = (uint)Application.GetRealHeight(5),
                    Radius = (uint)Application.GetRealHeight(12),
                    BorderColor = 0x00FFFFFF,
                    BorderWidth = 0,
                };
                bodyView.AddChidren(residenceInfoView);
                contentView.AddChidren(residenceInfoView);
            }
            #region 顶部信息区域
@@ -289,10 +303,9 @@
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
                Text = UserConfig.Instance.CurrentRegion.Name,
                Text = DB_ResidenceData.residenceData.residecenInfo.Name,
            };
            residenceInfoView.AddChidren(btnCurResidenceName);
            userTypeView = new FrameLayout()
            {
@@ -310,7 +323,8 @@
                Y = Application.GetRealHeight(15),
                Width = Application.GetMinRealAverage(20),
                Height = Application.GetMinRealAverage(20),
                UnSelectedImagePath = MainPage.LoginUser.AccountType == 0 ? "PersonalCenter/AdminTypeIcon.png" : "PersonalCenter/MemberTypeIcon.png",
                UnSelectedImagePath = DB_ResidenceData.residenceData.residecenInfo.IsOthreShare
                                    == false ? "PersonalCenter/AdminTypeIcon.png" : "PersonalCenter/MemberTypeIcon.png",
            };
            userTypeView.AddChidren(btnUserTypeIcon);
@@ -322,12 +336,13 @@
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.MainBackgroundColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Text = MainPage.LoginUser.AccountType == 0 ? "管理员" : "成员"
                TextID = DB_ResidenceData.residenceData.residecenInfo.IsOthreShare
                        == false ? StringId.Administrators : StringId.Member
            };
            userTypeView.AddChidren(btnUserTypeName);
            #endregion
            #region 住宅管理
            if (MainPage.LoginUser.AccountType == 0)
            if (!DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
            {
                #region ---住宅管理区域
                residenceManageView = new FrameLayout()
@@ -360,6 +375,7 @@
                };
                residenceManageView.AddChidren(btnResidenceManageText);
                #endregion
                #region ---成员区域
                residenceMemberView = new FrameLayout()
                {
@@ -420,39 +436,40 @@
                residenceArmView.AddChidren(btnResidenceArmText);
                #endregion
                #region ---数据备份区域
                residenceDataBackupView = new FrameLayout()
                {
                    X = Application.GetRealWidth(28 - 24),
                    Y = residenceManageView.Bottom,
                    Width = Application.GetRealWidth(64 + 48),
                    Height = Application.GetRealWidth(64),
                };
                residenceInfoView.AddChidren(residenceDataBackupView);
                btnResidenceDataBackupIcon = new Button
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealHeight(5),
                    Width = Application.GetMinRealAverage(30),
                    Height = Application.GetMinRealAverage(30),
                    UnSelectedImagePath = "PersonalCenter/ResidenceDataBackupIcon.png",
                };
                residenceDataBackupView.AddChidren(btnResidenceDataBackupIcon);
                btnResidenceDataBackupText = new Button()
                {
                    Y = btnResidenceManageIcon.Bottom,
                    Height = Application.GetRealHeight(29),
                    TextID = StringId.DataBackup,
                    TextAlignment = TextAlignment.Center,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel
                };
                residenceDataBackupView.AddChidren(btnResidenceDataBackupText);
                //residenceDataBackupView = new FrameLayout()
                //{
                //    X = Application.GetRealWidth(28 - 24),
                //    Y = residenceManageView.Bottom,
                //    Width = Application.GetRealWidth(64 + 48),
                //    Height = Application.GetRealWidth(64),
                //};
                //residenceInfoView.AddChidren(residenceDataBackupView);
                //btnResidenceDataBackupIcon = new Button
                //{
                //    Gravity = Gravity.CenterHorizontal,
                //    Y = Application.GetRealHeight(5),
                //    Width = Application.GetMinRealAverage(30),
                //    Height = Application.GetMinRealAverage(30),
                //    UnSelectedImagePath = "PersonalCenter/ResidenceDataBackupIcon.png",
                //};
                //residenceDataBackupView.AddChidren(btnResidenceDataBackupIcon);
                //btnResidenceDataBackupText = new Button()
                //{
                //    Y = btnResidenceManageIcon.Bottom,
                //    Height = Application.GetRealHeight(29),
                //    TextID = StringId.DataBackup,
                //    TextAlignment = TextAlignment.Center,
                //    TextColor = CSS_Color.FirstLevelTitleColor,
                //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel
                //};
                //residenceDataBackupView.AddChidren(btnResidenceDataBackupText);
                #endregion
                #region ---辅助功能区域
                residenceAuxiliaryFunctionView = new FrameLayout()
                {
                    X = residenceDataBackupView.Right,
                    X = Application.GetRealWidth(28 - 24),
                    //X = residenceDataBackupView.Right,
                    Y = residenceManageView.Bottom,
                    Width = Application.GetRealWidth(64 + 48),
                    Height = Application.GetRealWidth(64),
@@ -541,39 +558,39 @@
                residenceArmView.AddChidren(btnResidenceArmText);
                #endregion
                #region ---数据备份区域
                residenceDataBackupView = new FrameLayout()
                {
                    X = residenceArmView.Right,
                    Y = Application.GetRealHeight(68),
                    Width = Application.GetRealWidth(64 + 48),
                    Height = Application.GetRealWidth(64),
                };
                residenceInfoView.AddChidren(residenceDataBackupView);
                btnResidenceDataBackupIcon = new Button
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealHeight(5),
                    Width = Application.GetMinRealAverage(30),
                    Height = Application.GetMinRealAverage(30),
                    UnSelectedImagePath = "PersonalCenter/ResidenceDataBackupIcon.png",
                };
                residenceDataBackupView.AddChidren(btnResidenceDataBackupIcon);
                btnResidenceDataBackupText = new Button()
                {
                    Y = btnResidenceDataBackupIcon.Bottom,
                    Height = Application.GetRealHeight(29),
                    TextID = StringId.DataBackup,
                    TextAlignment = TextAlignment.Center,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel
                };
                residenceDataBackupView.AddChidren(btnResidenceDataBackupText);
                //residenceDataBackupView = new FrameLayout()
                //{
                //    X = residenceArmView.Right,
                //    Y = Application.GetRealHeight(68),
                //    Width = Application.GetRealWidth(64 + 48),
                //    Height = Application.GetRealWidth(64),
                //};
                //residenceInfoView.AddChidren(residenceDataBackupView);
                //btnResidenceDataBackupIcon = new Button
                //{
                //    Gravity = Gravity.CenterHorizontal,
                //    Y = Application.GetRealHeight(5),
                //    Width = Application.GetMinRealAverage(30),
                //    Height = Application.GetMinRealAverage(30),
                //    UnSelectedImagePath = "PersonalCenter/ResidenceDataBackupIcon.png",
                //};
                //residenceDataBackupView.AddChidren(btnResidenceDataBackupIcon);
                //btnResidenceDataBackupText = new Button()
                //{
                //    Y = btnResidenceDataBackupIcon.Bottom,
                //    Height = Application.GetRealHeight(29),
                //    TextID = StringId.DataBackup,
                //    TextAlignment = TextAlignment.Center,
                //    TextColor = CSS_Color.FirstLevelTitleColor,
                //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel
                //};
                //residenceDataBackupView.AddChidren(btnResidenceDataBackupText);
                #endregion
                #region ---辅助功能区域
                residenceAuxiliaryFunctionView = new FrameLayout()
                {
                    X = residenceDataBackupView.Right,
                    X = residenceArmView.Right,
                    Y = Application.GetRealHeight(68),
                    Width = Application.GetRealWidth(64 + 48),
                    Height = Application.GetRealWidth(64),
@@ -605,21 +622,21 @@
            #endregion
            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) });
            #region 软件设置区域
            softSettingView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(8) + residenceInfoView.Bottom,
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(88),
                Height = Application.GetRealWidth(88),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealHeight(5),
                Radius = (uint)Application.GetRealHeight(12),
                BorderColor = 0x00FFFFFF,
                BorderWidth = 0,
            };
            bodyView.AddChidren(softSettingView);
            contentView.AddChidren(softSettingView);
            btnNightViewModeIcon = new Button()
            Button btnNightViewModeIcon = new Button()
            {
                X = Application.GetRealWidth(12),
                Y = Application.GetRealHeight(10),
@@ -632,8 +649,8 @@
            btnNightViewModeText = new Button()
            {
                X = Application.GetRealWidth(48),
                Width = Application.GetRealWidth(180),
                Height = Application.GetRealHeight(44),
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealWidth(44),
                TextID = StringId.NightView,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
@@ -641,16 +658,15 @@
            };
            softSettingView.AddChidren(btnNightViewModeText);
            btnNightViewModeSwitch = new Button()
            Button btnNightViewModeRight = new Button()
            {
                X = Application.GetRealWidth(283),
                Y = Application.GetRealHeight(4),
                Width = Application.GetMinRealAverage(48),
                Height = Application.GetMinRealAverage(36),
                UnSelectedImagePath = "Public/Switch.png",
                SelectedImagePath = "Public/SwitchOn.png",
                X = Application.GetRealWidth(315),
                Y = Application.GetRealWidth(14),
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
            };
            softSettingView.AddChidren(btnNightViewModeSwitch);
            softSettingView.AddChidren(btnNightViewModeRight);
            var btnSoftSettingViewLine = new Button()
            {
@@ -661,10 +677,10 @@
            };
            softSettingView.AddChidren(btnSoftSettingViewLine);
            btnGeneralSettingsIcon = new Button()
            Button btnGeneralSettingsIcon = new Button()
            {
                X = Application.GetRealWidth(12),
                Y = Application.GetRealHeight(54),
                Y = Application.GetRealWidth(54),
                Width = Application.GetMinRealAverage(24),
                Height = Application.GetMinRealAverage(24),
                UnSelectedImagePath = "PersonalCenter/GeneralSettingsIcon.png",
@@ -675,8 +691,8 @@
            {
                X = Application.GetRealWidth(48),
                Y = btnSoftSettingViewLine.Bottom,
                Width = Application.GetRealWidth(180),
                Height = Application.GetRealHeight(44),
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealWidth(44),
                TextID = StringId.GeneralSettings,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.CenterLeft,
@@ -684,24 +700,31 @@
            };
            softSettingView.AddChidren(btnGeneralSettingsText);
            Button btnGeneralSettingsRight = new Button()
            {
                X = Application.GetRealWidth(315),
                Y = Application.GetRealWidth(58),
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
            };
            softSettingView.AddChidren(btnGeneralSettingsRight);
            #endregion
            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) });
            #region 获取支持
            supportView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(8) + softSettingView.Bottom,
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(44),
                Height = Application.GetRealWidth(88),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealHeight(5),
                Radius = (uint)Application.GetRealHeight(12),
                BorderColor = 0x00FFFFFF,
                BorderWidth = 0,
            };
            bodyView.AddChidren(supportView);
            contentView.AddChidren(supportView);
            btnSupportIcon = new Button()
            Button btnSupportIcon = new Button()
            {
                X = Application.GetRealWidth(12),
                Y = Application.GetRealHeight(10),
@@ -714,19 +737,74 @@
            btnSupportText = new Button()
            {
                X = Application.GetRealWidth(48),
                Width = Application.GetRealWidth(180),
                Height = Application.GetRealHeight(44),
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealWidth(44),
                TextID = StringId.GetSupport,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.TextFontSize
            };
            supportView.AddChidren(btnSupportText);
            Button btnSupportRight = new Button()
            {
                X = Application.GetRealWidth(315),
                Y = Application.GetRealWidth(14),
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
            };
            supportView.AddChidren(btnSupportRight);
            var btnSupportViewLine = new Button()
            {
                X = Application.GetRealWidth(48),
                Y = btnSupportText.Bottom,
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.DividingLineColor
            };
            supportView.AddChidren(btnSupportViewLine);
            Button btnAboutOnIcon = new Button()
            {
                X = Application.GetRealWidth(12),
                Y = Application.GetRealWidth(54),
                Width = Application.GetMinRealAverage(24),
                Height = Application.GetMinRealAverage(24),
                UnSelectedImagePath = "PersonalCenter/InfoOnIcon.png",
            };
            supportView.AddChidren(btnAboutOnIcon);
            btnAboutOnText = new Button()
            {
                X = Application.GetRealWidth(48),
                Y = btnSupportViewLine.Bottom,
                Width = Application.GetRealWidth(370),
                Height = Application.GetRealWidth(44),
                TextID = StringId.AboutOn,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.TextFontSize
            };
            supportView.AddChidren(btnAboutOnText);
            Button btnAboutOnRight = new Button()
            {
                X = Application.GetRealWidth(315),
                Y = Application.GetRealWidth(58),
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
            };
            supportView.AddChidren(btnAboutOnRight);
            #endregion
            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(28) });
            LoadEventList();
        }
    }
}
}