using System; using HDL_ON.DAL.Server; using HDL_ON.UI; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI { public partial class PersonalDataPage : FrameLayout { #region 控件列表 /// /// 当前 /// FrameLayout bodyView; /// /// 当前 /// VerticalScrolViewLayout bodyScrolView; /// /// 头像区域 /// FrameLayout headPortraitView; /// /// 头像按钮 /// ImageView userHeadImageView; #region 图标选择部分图标 /// /// 背景图选项区域 /// FrameLayout pictureOptionView; /// /// 背景图选项选择区域 /// VerticalScrolViewLayout optionView; /// /// 拍照按钮 /// Button btnTakePicture; /// /// 相册按钮 /// Button btnAlbum; /// /// 取消按钮 /// Button btnCancel; #endregion #region 个人信息选项区域 /// /// 个人信息选项区域 /// VerticalScrolViewLayout optionListView; #region 个人选项-名字区域 /// /// 个人选项-名字区域 /// FrameLayout userNameView; /// /// 用户名称标题 /// Button btnUserNameTitle; /// /// 用户名称 /// Button btnUserName; /// /// 修改用户名称按钮 /// Button btnEditUserNameIcon; #endregion #region 个人选项-二维码区域 /// /// 个人选项-二维码区域 /// FrameLayout _QRcodeView; /// /// 用户二维码标题 /// Button btnQRcode; /// /// 二维码图标 /// Button btnQRcodeIcon; /// /// 二维码前进图标 /// Button btnQRcodeRight; #endregion #region 个人选项-邮箱信息区域 /// /// 个人选项-邮箱信息区域 /// FrameLayout userEmailInfoView; /// /// 用户邮箱信息标题 /// Button btnUserEmailTilte; /// /// 用户邮箱信息 /// Button btnUserEmailInfo; /// /// 用户邮箱信息前进图标 /// Button btnUserEmailRight; #endregion #region 个人选项-手机信息区域 /// /// 个人选项-手机信息区域 /// FrameLayout userPhoneInfoView; /// /// 用户手机信息 /// Button btnUserPhoneTitle; /// /// 用户手机信息 /// Button btnUserPhoneInfo; /// /// 用户手机信息前进图标 /// Button btnUserPhoneRight; #endregion #region 个人选项-第三方授权区域 /// /// 个人选项-第三方授权区域 /// FrameLayout thirdPartyAuthorizationView; /// /// 第三方授权文本提示信息按钮 /// Button btnThirdPartyAuthorizationTitle; Button btnThirdPartyAuthorizationRight; #region 个人选项-修改登录密码区域 /// /// 个人选项-修改登录密码区域 /// FrameLayout resetPasswordView; /// /// 修改登录密码提示文本 /// Button btnResetPasswordText; Button btnResetPasswordRight; #endregion #region 个人选项-新增住宅 /// /// 个人选项-新增住宅区域 /// FrameLayout addResidenceView; /// /// 新增住宅提示文本 /// Button btnAddResidenceText; Button btnAddResidenceScan; #endregion #region 个人选项-人脸通讯管理 /// /// 个人选项-人脸通行管理行 /// FrameLayout faceManagementView; /// /// 人脸通行管理文本 /// Button btnFaceManagementText; #endregion #endregion #endregion #region 解锁设置区域 /// /// 解锁设置区域 /// FrameLayout interpretationSettingsView; Button btnInterpretationSettingsTitle; Button btnInterpretationSettingsTip; Button btnInterpretationSettingsRight; #endregion /// /// 退出登录按钮 /// Button btnLogout; #endregion /// /// 更新头像的回调函数 /// Action updataHeadImage; /// /// 更新用户名称的回调函数 /// Action updataUserName; public PersonalDataPage(Action upHeadImage, Action upUserName) { updataHeadImage = upHeadImage; updataUserName = upUserName; bodyView = this; } public void LoadView() { bodyView.BackgroundColor = CSS_Color.BackgroundColor; new TopViewDiv(bodyView, Language.StringByID(StringId.PersonalCenter)).LoadTopView(); bodyScrolView = new VerticalScrolViewLayout() { Y = Application.GetRealHeight(64), VerticalScrollBarEnabled = false, Height = Application.GetRealHeight(551), }; bodyView.AddChidren(bodyScrolView); if (MainPage.Increase) { bodyScrolView.Height = Application.GetRealHeight(541); } headPortraitView = new FrameLayout() { //Y = Application.GetRealHeight(64), Height = Application.GetRealHeight(124), BackgroundColor = CSS_Color.MainBackgroundColor, }; bodyScrolView.AddChidren(headPortraitView); userHeadImageView = new ImageView() { Gravity = Gravity.Center, Width = Application.GetMinRealAverage(84), Height = Application.GetMinRealAverage(84), Radius = (uint)Application.GetMinRealAverage(42), ImagePath = UserInfo.Current.headImagePagePath, }; headPortraitView.AddChidren(userHeadImageView); #region 个人信息选项区域 var topPaddingView = new FrameLayout() { Height = Application.GetRealHeight(8) }; bodyScrolView.AddChidren(topPaddingView); /// /// 个人信息选项区域 /// optionListView = new VerticalScrolViewLayout() { Height = Application.GetRealHeight(51 * 6), BackgroundColor = CSS_Color.MainBackgroundColor, ScrollEnabled = false, }; bodyScrolView.AddChidren(optionListView); if(Entity.DB_ResidenceData.Instance.SupportFacePass) { optionListView.Height = Application.GetRealHeight(51 * (6 + 1)); } #region 个人选项-名字区域 /// /// 个人选项-名字区域 /// userNameView = new FrameLayout() { Height = Application.GetRealHeight(50), }; optionListView.AddChidren(userNameView); /// /// 用户名称标题 /// btnUserNameTitle = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(120), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.Name, }; userNameView.AddChidren(btnUserNameTitle); /// /// 用户名称 /// btnUserName = new Button() { X = Application.GetRealWidth(100), Width = Application.GetRealWidth(230), TextAlignment = TextAlignment.CenterRight, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.TextFontSize, Text = string.IsNullOrEmpty(UserInfo.Current.userName) ? Language.StringByID(StringId.UsersWhoNameIsEmpty) : UserInfo.Current.userName }; userNameView.AddChidren(btnUserName); /// /// 修改用户名称按钮 /// btnEditUserNameIcon = new Button() { X = Application.GetRealWidth(333), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(28), Height = Application.GetMinRealAverage(28), UnSelectedImagePath = "Public/EditIcon.png", }; userNameView.AddChidren(btnEditUserNameIcon); optionListView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); #endregion #region 个人选项-二维码区域 /// /// 个人选项-二维码区域 /// _QRcodeView = new FrameLayout() { Height = Application.GetRealHeight(50), }; optionListView.AddChidren(_QRcodeView); /// /// 用户二维码标题 /// btnQRcode = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(120), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.MyQRcode, }; _QRcodeView.AddChidren(btnQRcode); /// /// 二维码图标 /// btnQRcodeIcon = new Button() { X = Application.GetRealWidth(305), Gravity = Gravity.CenterVertical, Width = Application.GetRealWidth(24), Height = Application.GetRealWidth(24), UnSelectedImagePath = "PersonalCenter/PersonalData/QRcodeIcon.png", }; _QRcodeView.AddChidren(btnQRcodeIcon); optionListView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); /// /// 二维码前进图标 /// btnQRcodeRight = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; _QRcodeView.AddChidren(btnQRcodeRight); #endregion #region 个人选项-邮箱信息区域 /// /// 个人选项-邮箱信息区域 /// userEmailInfoView = new FrameLayout() { Height = Application.GetRealHeight(50), }; optionListView.AddChidren(userEmailInfoView); /// /// 用户邮箱信息 /// btnUserEmailTilte = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(120), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.BoundEmailInfo, }; userEmailInfoView.AddChidren(btnUserEmailTilte); /// /// 用户邮箱信息 /// btnUserEmailInfo = new Button() { X = Application.GetRealWidth(100), Width = Application.GetRealWidth(230), TextAlignment = TextAlignment.CenterRight, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.TextFontSize, Text = GetBindAccountText(UserInfo.Current.userEmailInfo) }; userEmailInfoView.AddChidren(btnUserEmailInfo); /// /// 用户邮箱信息前进图标 /// btnUserEmailRight = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; userEmailInfoView.AddChidren(btnUserEmailRight); optionListView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); #endregion #region 个人选项-手机信息区域 /// /// 个人选项-手机信息区域 /// userPhoneInfoView = new FrameLayout() { Height = Application.GetRealHeight(50), }; optionListView.AddChidren(userPhoneInfoView); /// /// 用户手机信息 /// btnUserPhoneTitle = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(120), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.BoundMobileInfo, }; userPhoneInfoView.AddChidren(btnUserPhoneTitle); /// /// 用户手机信息 /// btnUserPhoneInfo = new Button() { X = Application.GetRealWidth(100), Width = Application.GetRealWidth(230), TextAlignment = TextAlignment.CenterRight, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.TextFontSize, Text = GetBindAccountText(UserInfo.Current.userMobileInfo) }; userPhoneInfoView.AddChidren(btnUserPhoneInfo); /// /// 用户手机信息前进图标 /// btnUserPhoneRight = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; userPhoneInfoView.AddChidren(btnUserPhoneRight); optionListView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); #endregion #region 个人选项-第三方授权区域 //2020-12-08 暂时隐藏第三方授权功能 /// /// 个人选项-第三方授权区域 /// thirdPartyAuthorizationView = new FrameLayout() { Height = Application.GetRealHeight(50), }; //optionListView.AddChidren(thirdPartyAuthorizationView); /// /// 第三方授权文本提示信息按钮 /// btnThirdPartyAuthorizationTitle = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(120), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.ThirdPartyAuthorization, }; thirdPartyAuthorizationView.AddChidren(btnThirdPartyAuthorizationTitle); btnThirdPartyAuthorizationRight = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; thirdPartyAuthorizationView.AddChidren(btnThirdPartyAuthorizationRight); #endregion #region 个人选项-修改登录密码区域 /// /// 个人选项-修改登录密码区域 /// resetPasswordView = new FrameLayout() { Height = Application.GetRealHeight(50), }; optionListView.AddChidren(resetPasswordView); /// /// 修改登录密码提示文本 /// btnResetPasswordText = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(220), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.ChangeLoginPassword, }; resetPasswordView.AddChidren(btnResetPasswordText); btnResetPasswordRight = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; resetPasswordView.AddChidren(btnResetPasswordRight); optionListView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); #endregion #region 个人选项-添加住宅 addResidenceView = new FrameLayout() { Height = Application.GetRealHeight(50), }; optionListView.AddChidren(addResidenceView); btnAddResidenceScan = new Button() { X = Application.GetRealWidth(319), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(30), Height = Application.GetMinRealAverage(30), UnSelectedImagePath = "Public/ScanGrey.png", }; addResidenceView.AddChidren(btnAddResidenceScan); btnAddResidenceText = new Button() { X = Application.GetRealWidth(16), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.ScanQRCoden, }; addResidenceView.AddChidren(btnAddResidenceText); btnAddResidenceText.MouseUpEventHandler = (sender, e) => { Scan.OpenScan((scanString) => { if (scanString.StartsWith("source://bind/")) { var waitPage = new Loading(); new System.Threading.Thread(() => { try { Application.RunOnMainThread(() => { waitPage.Start("Plaese wait..."); }); var sendString = scanString.Replace("source://bind/", ""); MainPage.Log($"绑定source屏:{sendString}"); //绑定source屏 var pack = new HttpServerRequest().BindSourcePanel(sendString); Application.RunOnMainThread(() => { var title = Language.StringByID(StringId.Tip); var msg = ""; if(pack.Code == StateCode.SUCCESS) { if(Language.CurrentLanguage=="Chinese") { msg = "Source屏绑定成功."; } else { msg = "Source Hub binding succeeded"; } new HDL_ON.UI.PublicAssmebly().TipMsg(title, msg); } else { if (Language.CurrentLanguage == "Chinese") { msg = $"Source屏绑定失败.({pack.Code})"; } else { msg = "Source Hub binding failed"; } new HDL_ON.UI.PublicAssmebly().TipMsg(title, msg); } }); } catch(Exception ex) { } finally { Application.RunOnMainThread(() => { waitPage.Hide(); }); } }) { IsBackground = true }.Start(); } else { //执行绑定住宅 new BindingResidencePage().DoBindResidence(scanString); } }); }; #endregion if (Entity.DB_ResidenceData.Instance.SupportFacePass) { #region 个人选项-人脸通行管理 optionListView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); faceManagementView = new FrameLayout() { Height = Application.GetRealHeight(50), }; optionListView.AddChidren(faceManagementView); var btnFaceManagementRight = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; faceManagementView.AddChidren(btnFaceManagementRight); btnFaceManagementText = new Button() { X = Application.GetRealWidth(16), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.FacePassageSetting, }; faceManagementView.AddChidren(btnFaceManagementText); btnFaceManagementText.MouseUpEventHandler = (sender, e) => { var page = new FacePassagePage(); MainPage.BasePageView.AddChidren(page); page.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; #endregion } #endregion #region 解锁设置区域 var topPaddingView2 = new FrameLayout() { Height = Application.GetRealHeight(8) }; bodyScrolView.AddChidren(topPaddingView2); /// /// 解锁设置区域 /// interpretationSettingsView = new FrameLayout() { BackgroundColor = CSS_Color.MainBackgroundColor, Height = Application.GetRealHeight(70), }; bodyScrolView.AddChidren(interpretationSettingsView); if(Language.CurrentLanguage != "Chinese") { interpretationSettingsView.Height = Application.GetRealHeight(80); } btnInterpretationSettingsTitle = new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(32), TextAlignment = TextAlignment.BottomLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.InterpretationSettings, }; interpretationSettingsView.AddChidren(btnInterpretationSettingsTitle); btnInterpretationSettingsTip = new Button() { X = Application.GetRealWidth(16), Y = btnInterpretationSettingsTitle.Bottom, Height = Application.GetRealHeight(32), Width = Application.GetRealWidth(310), TextAlignment = TextAlignment.TopLeft, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.TextFontSize, TextID = StringId.AppUnlockSettingsTip, IsMoreLines = true, }; interpretationSettingsView.AddChidren(btnInterpretationSettingsTip); btnInterpretationSettingsRight = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; interpretationSettingsView.AddChidren(btnInterpretationSettingsRight); interpretationSettingsView.AddChidren(new LineView(interpretationSettingsView.Height)); #endregion #region 服务器信息 ListCellView myServerInfoCellView = new ListCellView() { }; bodyScrolView.AddChidren(myServerInfoCellView); //跳转服务器信息 Action selectAction = () => { var myServerInfoPage = new MyServerInfoPage(); MainPage.BasePageView.AddChidren(myServerInfoPage); myServerInfoPage.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; myServerInfoCellView.GoAction = selectAction; myServerInfoCellView.BtnTilte.Text = Language.StringByID(StringId.ServerInformation); myServerInfoCellView.LineView.RemoveFromParent(); #endregion btnLogout = new Button() { Y = Application.GetRealHeight(623), Height = Application.GetRealHeight(50), TextAlignment = TextAlignment.Center, TextSize = CSS_FontSize.SubheadingFontSize, TextColor = CSS_Color.AuxiliaryColor2, TextID = StringId.Logout, BackgroundColor = CSS_Color.MainBackgroundColor, }; bodyView.AddChidren(btnLogout); if (MainPage.Increase) { btnLogout.Y = Application.GetRealHeight(613); btnLogout.Height = Application.GetRealHeight(50); bodyView.AddChidren(new Button() { Y = Application.GetRealHeight(663), Height = Application.GetRealHeight(20), BackgroundColor = CSS_Color.MainBackgroundColor }); } LoadEventList(); } /// /// 加载图标选择选项 /// void LoadPictureOptionView() { var pictureBaseView = new FrameLayout() { BackgroundColor = CSS_Color.DialogTransparentColor1, }; bodyView.AddChidren(pictureBaseView); pictureOptionView = new FrameLayout() { Y = Application.GetRealHeight(495), AnimateSpeed = 0.3f, Animate = Animate.DownToUp, Height = Application.GetRealHeight(200), }; pictureBaseView.AddChidren(pictureOptionView); optionView = new VerticalScrolViewLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(100), BackgroundColor = CSS_Color.MainBackgroundColor, Radius = (uint)Application.GetRealWidth(12), ScrollEnabled = false, }; pictureOptionView.AddChidren(optionView); btnTakePicture = new Button() { Height = Application.GetRealHeight(50), TextAlignment = TextAlignment.Center, TextColor = CSS_Color.TextualColor, SelectedTextColor = CSS_Color.MainColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.TakePicture, }; optionView.AddChidren(btnTakePicture); optionView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); btnAlbum = new Button() { Height = Application.GetRealHeight(50), TextAlignment = TextAlignment.Center, TextColor = CSS_Color.TextualColor, SelectedTextColor = CSS_Color.MainColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.Album, }; optionView.AddChidren(btnAlbum); optionView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); btnCancel = new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(8) + optionView.Bottom, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(50), BackgroundColor = CSS_Color.MainBackgroundColor, Radius = (uint)Application.GetRealWidth(12), TextID = StringId.Cancel, TextColor = CSS_Color.WarningColor, TextSize = CSS_FontSize.SubheadingFontSize, }; pictureOptionView.AddChidren(btnCancel); LoadEvent_PictureOptionViewEventList(pictureBaseView); } /// /// 获取绑定账号显示文本,空的时候显示为未绑定 /// /// string GetBindAccountText(string account) { return string.IsNullOrEmpty(account) ? Language.StringByID(StringId.Unbound) : account; } /// /// 判断是否为未绑定 /// /// /// bool CheckIfUnbound(string account) { return string.IsNullOrEmpty(account) || account == Language.StringByID(StringId.Unbound); } } }