using System;
using Shared;
using HDL_ON.UI.CSS;
namespace HDL_ON.UI
{
public partial class ResetPasswordOptionPage : FrameLayout
{
FrameLayout bodyView;
public ResetPasswordOptionPage()
{
bodyView = this;
}
public void LoadPage()
{
bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
new TopViewDiv(bodyView, Language.StringByID(StringId.ModifyPassword)).LoadTopView();
Button btnTip1 = new Button()
{
Y = Application.GetRealHeight(86),
Height = Application.GetRealHeight(29),
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.SubheadingFontSize,
TextID = StringId.ModifyPasswordTip1,
};
bodyView.AddChidren(btnTip1);
Button btnTip2 = new Button()
{
Y = btnTip1.Bottom,
Height = Application.GetRealHeight(29),
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.SubheadingFontSize,
TextID = StringId.ModifyPasswordTip2,
};
bodyView.AddChidren(btnTip2);
Button btnPhoneNumberOption = new Button()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealWidth(226),
Width = Application.GetRealWidth(250),
Height = Application.GetRealWidth(44),
TextAlignment = TextAlignment.Center,
Radius = (uint)Application.GetRealWidth(22),
BackgroundColor = CSS_Color.MainColor,
TextID = StringId.PhoneNumberVerification,
TextSize = CSS_FontSize.SubheadingFontSize,
TextColor = CSS_Color.MainBackgroundColor,
};
bodyView.AddChidren(btnPhoneNumberOption);
Button btnEmailOption = new Button()
{
Gravity = Gravity.CenterHorizontal,
TextAlignment = TextAlignment.Center,
Y = btnPhoneNumberOption.Bottom,
Radius = (uint)Application.GetRealWidth(22),
Width = Application.GetRealWidth(250),
Height = Application.GetRealWidth(64),
TextID = StringId.EmailVerification,
TextSize = CSS_FontSize.TextFontSize,
TextColor = CSS_Color.MainColor,
};
bodyView.AddChidren(btnEmailOption);
btnPhoneNumberOption.MouseUpEventHandler = (sender, e) =>
{
LoadMethod_OptionVerification(0);
};
btnEmailOption.MouseUpEventHandler = (sender, e) =>
{
LoadMethod_OptionVerification(1);
};
}
}
//------------------------------------------------------------------------------------
public partial class ResetPasswordOptionPage
{
///
///
///
/// 验证类型0:手机,1:邮箱
void LoadMethod_OptionVerification(int verificationOption)
{
if (verificationOption == 0)
{
if (string.IsNullOrEmpty( UserInfo.Current.userMobileInfo))
{
LoadDialog_UnbindTipInfo(verificationOption);
}
else
{
this.RemoveFromParent();
var vcp = new ResetPasswordVerificationCodePage();
MainPage.BasePageView.AddChidren(vcp);
vcp.LoadPage(StringId.PhoneNumberVerification, true, UserInfo.Current.userMobileInfo);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
}
}
else
{
if (string.IsNullOrEmpty( UserInfo.Current.userEmailInfo))
{
LoadDialog_UnbindTipInfo(verificationOption);
}
else
{
this.RemoveFromParent();
var vcp = new ResetPasswordVerificationCodePage();
MainPage.BasePageView.AddChidren(vcp);
vcp.LoadPage(StringId.EmailVerification, false, UserInfo.Current.userEmailInfo);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
}
}
}
///
/// 没有绑定手机/邮箱提示
///
/// 验证类型0:手机,1:邮箱
void LoadDialog_UnbindTipInfo(int verificationOption)
{
Dialog dialog = new Dialog();
FrameLayout dialogView = new FrameLayout();
dialogView.MouseUpEventHandler = (sender, e) => {
dialog.Close();
};
dialog.AddChidren(dialogView);
FrameLayout contentView = new FrameLayout()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealWidth(223),
Width = Application.GetRealWidth(288),
Height = Application.GetRealWidth(245),
Radius = (uint)Application.GetRealWidth(6),
BackgroundColor = CSS_Color.MainBackgroundColor,
};
dialogView.AddChidren(contentView);
Button btnTitleIcon = new Button()
{
X = Application.GetRealWidth(108),
Y = Application.GetRealWidth(152),
Width = Application.GetRealWidth(160),
Height = Application.GetRealWidth(160),
UnSelectedImagePath = "PersonalCenter/ResetPassword/DialogTipTitleIcon.png"
};
dialogView.AddChidren(btnTitleIcon);
btnTitleIcon.MouseUpEventHandler = (sender, e) => {
dialog.Close();
};
Button btnMsg = new Button()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealWidth(79),
Width = Application.GetRealWidth(220),
Height = Application.GetRealWidth(62),
TextColor = CSS_Color.MainColor,
TextSize = CSS_FontSize.SubheadingFontSize,
TextID = verificationOption == 0 ? StringId.UnBindPhoneNumberCannotVerification: StringId.UnBindEmailCannotVerification,
};
contentView.AddChidren(btnMsg);
Button btnSkipBindPage = new Button()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealWidth(169),
Width = Application.GetRealWidth(220),
Height = Application.GetRealWidth(44),
TextAlignment = TextAlignment.Center,
Radius = (uint)Application.GetRealWidth(22),
BackgroundColor = CSS_Color.MainColor,
TextID = StringId.GoBind,
TextSize = CSS_FontSize.SubheadingFontSize,
TextColor = CSS_Color.MainBackgroundColor,
};
contentView.AddChidren(btnSkipBindPage);
btnSkipBindPage.MouseUpEventHandler = (sender, e) =>
{
dialog.Close();
Action action = (obj) => { };
//var vcp = new BindAccountPage();
//MainPage.BasePageView.AddChidren(vcp);
//vcp.LoadPage(action, verificationOption == 0 ? StringId.BindPhone : StringId.BindEmail);
//MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
//是否为换绑手机
var isPhone = verificationOption == 0;
//跳转新绑定页面
var aep = new NewBindAccountPage();
MainPage.BasePageView.AddChidren(aep);
aep.LoadPage(action, isPhone);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
};
dialog.Show();
}
}
}