using System;
using Shared;
using HDL_ON.UI.CSS;
using HDL_ON.UI;
namespace HDL_ON.UI
{
public partial class PersonalCenterPage : FrameLayout
{
#region 控件列表
///
/// 当前界面
///
FrameLayout bodyView;
///
/// 顶部背景
///
FrameLayout topbg;
///
/// 个人信息区域
///
FrameLayout personalInfoView;
///
/// 用户名称
///
Button btnUserName;
///
/// 用户邮箱
///
Button btnEmail;
///
/// 用户头像
///
Button btnUserHeadPortrait;
///
/// 住宅信息区域
///
FrameLayout residenceInfoView;
///
/// 住宅下拉图标
///
Button btnResidenceDownIcon;
///
/// 当前住宅名称
///
Button btnCurResidenceName;
///
/// 用户类型区域
///
FrameLayout userTypeView;
///
/// 用户类型图标
///
Button btnUserTypeIcon;
///
/// 用户类型图标
///
Button btnUserTypeName;
///
/// 区域管理小区域
///
FrameLayout residenceManageView;
///
/// 区域管理小区域图标
///
Button residenceManageIcon;
///
/// 区域管理小区域文本
///
Button residenceManageText;
///
/// 区域成员小区域
///
FrameLayout residenceMemberView;
///
/// 区域成员小区域图标
///
Button residenceMemberIcon;
///
/// 区域成员小区域文本
///
Button residenceMemberText;
///
/// 区域安放小区域
///
FrameLayout residenceArmView;
///
/// 区域成安放小区域图标
///
Button residenceArmIcon;
///
/// 区域安放小区域文本
///
Button residenceArmText;
///
/// 区域数据备份小区域
///
FrameLayout residenceDataBackupView;
///
/// 区域数据备份小区域图标
///
Button residenceDataBackupIcon;
///
/// 区域数据备份小区域文本
///
Button residenceDataBackupText;
///
/// 区域辅助功能小区域
///
FrameLayout residenceAuxiliaryFunctionView;
///
/// 区域辅助功能小区域图标
///
Button residenceAuxiliaryFunctionIcon;
///
/// 区域辅助功能小区域文本
///
Button residenceAuxiliaryFunctionText;
///
/// 区域添加功能小区域
///
FrameLayout residenceAddFunctionView;
///
/// 区域添加功能小区域图标
///
Button residenceAddFunctionIcon;
///
/// 区域添加功能小区域文本
///
Button residenceAddFunctionText;
///
/// 软件设置区域
///
FrameLayout softSettingView;
///
/// 软件夜览模式图标
///
Button btnNightViewModeIcon;
///
/// 软件夜览模式文本
///
Button btnNightViewModeText;
///
/// 软件夜览模式按钮
///
Button btnNightViewModeSwitch;
///
/// 通用设置图标
///
Button btnGeneralSettingsIcon;
///
/// 通用设置文本
///
Button btnGeneralSettingsText;
///
/// 获取支持小区域
///
FrameLayout supportView;
///
/// 获取支持图标
///
Button btnSupportIcon;
///
/// 获取支持文本
///
Button btnSupportText;
#endregion
public PersonalCenterPage()
{
bodyView = this;
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
}
public void LoadView()
{
#region 个人信息
topbg = new FrameLayout()
{
Y = Application.GetRealHeight(-20),
Height = Application.GetRealHeight(160),
Radius = 16,
BorderColor = 0x00FFFFFF,
BorderWidth = 0,
BackgroundColor = CSS_Color.MainColor,
};
bodyView.AddChidren(topbg);
personalInfoView = new FrameLayout()
{
Width = Application.GetRealWidth(343),
Height = Application.GetRealHeight(116),
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(94),
BackgroundColor = CSS_Color.MainBackgroundColor,
Radius = (uint)Application.GetRealHeight(5),
BorderColor = 0x00FFFFFF,
BorderWidth = 0,
};
bodyView.AddChidren(personalInfoView);
btnUserName = new Button()
{
Y = Application.GetRealHeight(52),
Height = Application.GetRealHeight(30),
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.SubheadingFontSize,
Text = string.IsNullOrEmpty(MainPage.LoginUser.UserName) ? "不愿意透露姓名的用户" : MainPage.LoginUser.UserName
};
personalInfoView.AddChidren(btnUserName);
if (!string.IsNullOrEmpty(MainPage.LoginUser.UserName))
{
btnUserName.Text = MainPage.LoginUser.UserName;
}
btnEmail = new Button()
{
Y = btnUserName.Bottom,
Height = Application.GetRealHeight(22),
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.TextualColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
Text = MainPage.LoginUser.AccountString
};
personalInfoView.AddChidren(btnEmail);
btnUserHeadPortrait = new Button()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(51),
Width = Application.GetMinRealAverage(84),
Height = Application.GetMinRealAverage(84),
Radius = (uint)Application.GetMinRealAverage(42),
UnSelectedImagePath = "LoginIcon/2.png"
};
bodyView.AddChidren(btnUserHeadPortrait);
#endregion
#region 住宅信息区域
if (MainPage.LoginUser.AccountType == 0)
{
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),
BorderColor = 0x00FFFFFF,
BorderWidth = 0,
};
bodyView.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),
BorderColor = 0x00FFFFFF,
BorderWidth = 0,
};
bodyView.AddChidren(residenceInfoView);
}
#region 顶部信息区域
btnResidenceDownIcon = new Button()
{
Width = Application.GetMinRealAverage(16),
Height = Application.GetMinRealAverage(16),
X = Application.GetRealWidth(16),
Y = Application.GetRealHeight(25),
UnSelectedImagePath = "0Common/DownIcon.png",
};
residenceInfoView.AddChidren(btnResidenceDownIcon);
btnCurResidenceName = new Button()
{
X = btnResidenceDownIcon.Right + Application.GetRealWidth(1),
Y = Application.GetRealHeight(10),
Width = Application.GetRealWidth(240),
Height = Application.GetRealHeight(45),
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
Text = UserConfig.Instance.CurrentRegion.Name,
};
residenceInfoView.AddChidren(btnCurResidenceName);
userTypeView = new FrameLayout()
{
Width = Application.GetRealWidth(122),
Height = Application.GetRealHeight(58),
X = Application.GetRealWidth(237),
Y = Application.GetRealHeight(8),
BackgroundImagePath = "PersonalCenter/UserTypebg.png",
};
residenceInfoView.AddChidren(userTypeView);
btnUserTypeIcon = new Button()
{
X = Application.GetRealWidth(26),
Y = Application.GetRealHeight(15),
Width = Application.GetMinRealAverage(20),
Height = Application.GetMinRealAverage(20),
UnSelectedImagePath = MainPage.LoginUser.AccountType == 0 ? "PersonalCenter/AdminTypeIcon.png" : "PersonalCenter/MemberTypeIcon.png",
};
userTypeView.AddChidren(btnUserTypeIcon);
btnUserTypeName = new Button()
{
X = Application.GetRealWidth(8) + btnUserTypeIcon.Right,
Width = Application.GetRealWidth(80),
Height = Application.GetRealHeight(17 * 3),
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.MainBackgroundColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
Text = MainPage.LoginUser.AccountType == 0 ? "管理员" : "成员"
};
userTypeView.AddChidren(btnUserTypeName);
#endregion
#region 住宅管理
if (MainPage.LoginUser.AccountType == 0)
{
#region ---住宅管理区域
residenceManageView = new FrameLayout()
{
X = Application.GetRealWidth(28 - 24),
Y = Application.GetRealHeight(68),
Width = Application.GetMinRealAverage(64 + 48),
Height = Application.GetMinRealAverage(64),
};
residenceInfoView.AddChidren(residenceManageView);
residenceManageIcon = new Button()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(5),
Width = Application.GetMinRealAverage(30),
Height = Application.GetMinRealAverage(30),
UnSelectedImagePath = "PersonalCenter/ResidenceManageIcon.png",
};
residenceManageView.AddChidren(residenceManageIcon);
residenceManageText = new Button()
{
Y = residenceManageIcon.Bottom,
Height = Application.GetRealHeight(29),
TextID = StringId.ResidenceManage,
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel
};
residenceManageView.AddChidren(residenceManageText);
#endregion
#region ---成员区域
residenceMemberView = new FrameLayout()
{
X = residenceManageView.Right,
Y = Application.GetRealHeight(68),
Width = Application.GetMinRealAverage(64 + 48),
Height = Application.GetMinRealAverage(64),
};
residenceInfoView.AddChidren(residenceMemberView);
residenceMemberIcon = new Button
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(5),
Width = Application.GetMinRealAverage(30),
Height = Application.GetMinRealAverage(30),
UnSelectedImagePath = "PersonalCenter/ResidenceMemberIcon.png",
};
residenceMemberView.AddChidren(residenceMemberIcon);
residenceMemberText = new Button()
{
Y = residenceManageIcon.Bottom,
Height = Application.GetRealHeight(29),
TextID = StringId.ResidenceMemberManage,
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel
};
residenceMemberView.AddChidren(residenceMemberText);
#endregion
#region ---安放区域
residenceArmView = new FrameLayout()
{
X = residenceMemberView.Right,
Y = Application.GetRealHeight(68),
Width = Application.GetMinRealAverage(64 + 48),
Height = Application.GetMinRealAverage(64),
};
residenceInfoView.AddChidren(residenceArmView);
residenceArmIcon = new Button
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(5),
Width = Application.GetMinRealAverage(30),
Height = Application.GetMinRealAverage(30),
UnSelectedImagePath = "PersonalCenter/ResidenceArmIcon.png",
};
residenceArmView.AddChidren(residenceArmIcon);
residenceArmText = new Button()
{
Y = residenceManageIcon.Bottom,
Height = Application.GetRealHeight(29),
TextID = StringId.Undefense,
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel
};
residenceArmView.AddChidren(residenceArmText);
#endregion
#region ---数据备份区域
residenceDataBackupView = new FrameLayout()
{
X = Application.GetRealWidth(28 - 24),
Y = residenceManageView.Bottom,
Width = Application.GetMinRealAverage(64 + 48),
Height = Application.GetMinRealAverage(64),
};
residenceInfoView.AddChidren(residenceDataBackupView);
residenceDataBackupIcon = new Button
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(5),
Width = Application.GetMinRealAverage(30),
Height = Application.GetMinRealAverage(30),
UnSelectedImagePath = "PersonalCenter/ResidenceDataBackupIcon.png",
};
residenceDataBackupView.AddChidren(residenceDataBackupIcon);
residenceDataBackupText = new Button()
{
Y = residenceManageIcon.Bottom,
Height = Application.GetRealHeight(29),
TextID = StringId.DataBackup,
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel
};
residenceDataBackupView.AddChidren(residenceDataBackupText);
#endregion
#region ---辅助功能区域
residenceAuxiliaryFunctionView = new FrameLayout()
{
X = residenceDataBackupView.Right,
Y = residenceManageView.Bottom,
Width = Application.GetMinRealAverage(64 + 48),
Height = Application.GetMinRealAverage(64),
};
residenceInfoView.AddChidren(residenceAuxiliaryFunctionView);
residenceAuxiliaryFunctionIcon = new Button
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(5),
Width = Application.GetMinRealAverage(30),
Height = Application.GetMinRealAverage(30),
UnSelectedImagePath = "PersonalCenter/AuxiliaryFunctionIcon.png",
};
residenceAuxiliaryFunctionView.AddChidren(residenceAuxiliaryFunctionIcon);
residenceAuxiliaryFunctionText = new Button()
{
Y = residenceManageIcon.Bottom,
Height = Application.GetRealHeight(29),
TextID = StringId.AuxiliaryFunction,
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel
};
residenceAuxiliaryFunctionView.AddChidren(residenceAuxiliaryFunctionText);
#endregion
#region ---添加功能区域
residenceAddFunctionView = new FrameLayout()
{
X = residenceAuxiliaryFunctionView.Right,
Y = residenceManageView.Bottom,
Width = Application.GetMinRealAverage(64 + 48),
Height = Application.GetMinRealAverage(64),
};
residenceInfoView.AddChidren(residenceAddFunctionView);
residenceAddFunctionIcon = new Button
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(5),
Width = Application.GetMinRealAverage(30),
Height = Application.GetMinRealAverage(30),
UnSelectedImagePath = "PersonalCenter/AddFunctionIcon.png",
};
residenceAddFunctionView.AddChidren(residenceAddFunctionIcon);
residenceAddFunctionText = new Button()
{
Y = residenceManageIcon.Bottom,
Height = Application.GetRealHeight(29),
TextID = StringId.AddFunction,
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel
};
residenceAddFunctionView.AddChidren(residenceAddFunctionText);
#endregion
}
else
{
#region ---安放区域
residenceArmView = new FrameLayout()
{
X = Application.GetRealWidth(28 - 24),
Y = Application.GetRealHeight(68),
Width = Application.GetMinRealAverage(64 + 48),
Height = Application.GetMinRealAverage(64),
};
residenceInfoView.AddChidren(residenceArmView);
residenceArmIcon = new Button
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(5),
Width = Application.GetMinRealAverage(30),
Height = Application.GetMinRealAverage(30),
UnSelectedImagePath = "PersonalCenter/ResidenceArmIcon.png",
};
residenceArmView.AddChidren(residenceArmIcon);
residenceArmText = new Button()
{
Y = residenceArmIcon.Bottom,
Height = Application.GetRealHeight(29),
TextID = StringId.Undefense,
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel
};
residenceArmView.AddChidren(residenceArmText);
#endregion
#region ---数据备份区域
residenceDataBackupView = new FrameLayout()
{
X = residenceArmView.Right,
Y = Application.GetRealHeight(68),
Width = Application.GetMinRealAverage(64 + 48),
Height = Application.GetMinRealAverage(64),
};
residenceInfoView.AddChidren(residenceDataBackupView);
residenceDataBackupIcon = new Button
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(5),
Width = Application.GetMinRealAverage(30),
Height = Application.GetMinRealAverage(30),
UnSelectedImagePath = "PersonalCenter/ResidenceDataBackupIcon.png",
};
residenceDataBackupView.AddChidren(residenceDataBackupIcon);
residenceDataBackupText = new Button()
{
Y = residenceDataBackupIcon.Bottom,
Height = Application.GetRealHeight(29),
TextID = StringId.DataBackup,
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel
};
residenceDataBackupView.AddChidren(residenceDataBackupText);
#endregion
#region ---辅助功能区域
residenceAuxiliaryFunctionView = new FrameLayout()
{
X = residenceDataBackupView.Right,
Y = Application.GetRealHeight(68),
Width = Application.GetMinRealAverage(64 + 48),
Height = Application.GetMinRealAverage(64),
};
residenceInfoView.AddChidren(residenceAuxiliaryFunctionView);
residenceAuxiliaryFunctionIcon = new Button
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(5),
Width = Application.GetMinRealAverage(30),
Height = Application.GetMinRealAverage(30),
UnSelectedImagePath = "PersonalCenter/AuxiliaryFunctionIcon.png",
};
residenceAuxiliaryFunctionView.AddChidren(residenceAuxiliaryFunctionIcon);
residenceAuxiliaryFunctionText = new Button()
{
Y = residenceAuxiliaryFunctionIcon.Bottom,
Height = Application.GetRealHeight(29),
TextID = StringId.AuxiliaryFunction,
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel
};
residenceAuxiliaryFunctionView.AddChidren(residenceAuxiliaryFunctionText);
#endregion
}
#endregion
#endregion
#region 软件设置区域
softSettingView = new FrameLayout()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(8) + residenceInfoView.Bottom,
Width = Application.GetRealWidth(343),
Height = Application.GetRealHeight(88),
BackgroundColor = CSS_Color.MainBackgroundColor,
Radius = (uint)Application.GetRealHeight(5),
BorderColor = 0x00FFFFFF,
BorderWidth = 0,
};
bodyView.AddChidren(softSettingView);
btnNightViewModeIcon = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealHeight(10),
Width = Application.GetMinRealAverage(24),
Height = Application.GetMinRealAverage(24),
UnSelectedImagePath = "PersonalCenter/NightViewIcon.png",
};
softSettingView.AddChidren(btnNightViewModeIcon);
btnNightViewModeText = new Button()
{
X = Application.GetRealWidth(48),
Width = Application.GetRealWidth(180),
Height = Application.GetRealHeight(44),
TextID = StringId.NightView,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.TextFontSize,
TextAlignment = TextAlignment.CenterLeft,
};
softSettingView.AddChidren(btnNightViewModeText);
btnNightViewModeSwitch = new Button()
{
X = Application.GetRealWidth(293),
Y = Application.GetRealHeight(4),
Width = Application.GetMinRealAverage(36),
Height = Application.GetMinRealAverage(36),
UnSelectedImagePath = "PersonalCenter/SwitchClose.png",
};
softSettingView.AddChidren(btnNightViewModeSwitch);
var btnSoftSettingViewLine = new Button()
{
X = Application.GetRealWidth(48),
Y = btnNightViewModeText.Bottom,
Height = Application.GetRealHeight(1),
BackgroundColor = CSS_Color.DividingLineColor
};
softSettingView.AddChidren(btnSoftSettingViewLine);
btnGeneralSettingsIcon = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealHeight(54),
Width = Application.GetMinRealAverage(24),
Height = Application.GetMinRealAverage(24),
UnSelectedImagePath = "PersonalCenter/GeneralSettingsIcon.png",
};
softSettingView.AddChidren(btnGeneralSettingsIcon);
btnGeneralSettingsText = new Button()
{
X = Application.GetRealWidth(48),
Y = btnSoftSettingViewLine.Bottom,
Width = Application.GetRealWidth(180),
Height = Application.GetRealHeight(44),
TextID = StringId.GeneralSettings,
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.TextFontSize
};
softSettingView.AddChidren(btnGeneralSettingsText);
#endregion
#region 获取支持
supportView = new FrameLayout()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(8) + softSettingView.Bottom,
Width = Application.GetRealWidth(343),
Height = Application.GetRealHeight(44),
BackgroundColor = CSS_Color.MainBackgroundColor,
Radius = (uint)Application.GetRealHeight(5),
BorderColor = 0x00FFFFFF,
BorderWidth = 0,
};
bodyView.AddChidren(supportView);
btnSupportIcon = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealHeight(10),
Width = Application.GetMinRealAverage(24),
Height = Application.GetMinRealAverage(24),
UnSelectedImagePath = "PersonalCenter/SupportIcon.png",
};
supportView.AddChidren(btnSupportIcon);
btnSupportText = new Button()
{
X = Application.GetRealWidth(48),
Width = Application.GetRealWidth(180),
Height = Application.GetRealHeight(44),
TextID = StringId.GetSupport,
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.TextFontSize
};
supportView.AddChidren(btnSupportText);
#endregion
LoadEventList();
}
}
}