using System;
|
using Shared;
|
using HDL_ON.UI.CSS;
|
|
namespace HDL_ON.UI
|
{
|
public partial class AppUnlockPasswordSettingPage : FrameLayout
|
{
|
FrameLayout bodyView;
|
|
string passwrod = "";
|
string oldPasswrod = "";
|
public AppUnlockPasswordSettingPage(string pw)
|
{
|
bodyView = this;
|
oldPasswrod = pw;
|
}
|
|
public void LoadPage()
|
{
|
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
|
new TopViewDiv(bodyView, Language.StringByID(StringId.SetDigitalPassword)).LoadTopView();
|
|
var btnTipTitle = new Button()
|
{
|
Y = Application.GetRealWidth(186),
|
Height = Application.GetRealWidth(42),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextID = string.IsNullOrEmpty(oldPasswrod)? StringId.PlsEntryPassword : StringId.PlsRegisterRepeatPassword,
|
};
|
bodyView.AddChidren(btnTipTitle);
|
|
var btnTipIcon1 = new Button()
|
{
|
X = Application.GetRealWidth(132),
|
Y = Application.GetRealWidth(238),
|
Width = Application.GetRealWidth(16),
|
Height = Application.GetRealWidth(16),
|
BorderColor = CSS_Color.FirstLevelTitleColor,
|
BorderWidth = (uint)Application.GetRealWidth(1),
|
Radius = (uint)Application.GetRealWidth(8),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
SelectedBackgroundColor = CSS_Color.FirstLevelTitleColor,
|
};
|
bodyView.AddChidren(btnTipIcon1);
|
|
|
var btnTipIcon2 = new Button()
|
{
|
X = btnTipIcon1.Right + Application.GetRealWidth(16),
|
Y = Application.GetRealWidth(238),
|
Width = Application.GetRealWidth(16),
|
Height = Application.GetRealWidth(16),
|
BorderColor = CSS_Color.FirstLevelTitleColor,
|
BorderWidth = (uint)Application.GetRealWidth(1),
|
Radius = (uint)Application.GetRealWidth(8),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
SelectedBackgroundColor = CSS_Color.FirstLevelTitleColor,
|
};
|
bodyView.AddChidren(btnTipIcon2);
|
|
|
var btnTipIcon3 = new Button()
|
{
|
X = btnTipIcon2.Right + Application.GetRealWidth(16),
|
Y = Application.GetRealWidth(238),
|
Width = Application.GetRealWidth(16),
|
Height = Application.GetRealWidth(16),
|
BorderColor = CSS_Color.FirstLevelTitleColor,
|
BorderWidth = (uint)Application.GetRealWidth(1),
|
Radius = (uint)Application.GetRealWidth(8),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
SelectedBackgroundColor = CSS_Color.FirstLevelTitleColor,
|
};
|
bodyView.AddChidren(btnTipIcon3);
|
|
|
var btnTipIcon4 = new Button()
|
{
|
X = btnTipIcon3.Right + Application.GetRealWidth(16),
|
Y = Application.GetRealWidth(238),
|
Width = Application.GetRealWidth(16),
|
Height = Application.GetRealWidth(16),
|
BorderColor = CSS_Color.FirstLevelTitleColor,
|
BorderWidth = (uint)Application.GetRealWidth(1),
|
Radius = (uint)Application.GetRealWidth(8),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
SelectedBackgroundColor = CSS_Color.FirstLevelTitleColor,
|
};
|
bodyView.AddChidren(btnTipIcon4);
|
|
|
Button btnTipError = new Button()
|
{
|
Y = Application.GetRealWidth(258),
|
Height = Application.GetRealWidth(40),
|
TextID = StringId.IncorrectRepeatPassword,
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.WarningColor,
|
TextSize = CSS_FontSize.TextFontSize,
|
Visible = false,
|
};
|
bodyView.AddChidren(btnTipError);
|
|
|
EditText etPassword = new EditText()
|
{
|
Y = Application.GetRealWidth(100),
|
Height = Application.GetRealWidth(10),
|
Foucs = true,
|
Visible = false,
|
IsNumberKeyboardType = true,
|
};
|
bodyView.AddChidren(etPassword);
|
|
etPassword.TextChangeEventHandler = (sender, e) => {
|
passwrod = etPassword.Text.Trim();
|
switch(etPassword.Text.Trim().Length)
|
{
|
case 0:
|
btnTipIcon1.IsSelected = false;
|
btnTipIcon2.IsSelected = false;
|
btnTipIcon3.IsSelected = false;
|
btnTipIcon4.IsSelected = false;
|
break;
|
case 1:
|
btnTipIcon1.IsSelected = true;
|
btnTipIcon2.IsSelected = false;
|
btnTipIcon3.IsSelected = false;
|
btnTipIcon4.IsSelected = false;
|
btnTipError.Visible = false;
|
break;
|
case 2:
|
btnTipIcon1.IsSelected = true;
|
btnTipIcon2.IsSelected = true;
|
btnTipIcon3.IsSelected = false;
|
btnTipIcon4.IsSelected = false;
|
break;
|
case 3:
|
btnTipIcon1.IsSelected = true;
|
btnTipIcon2.IsSelected = true;
|
btnTipIcon3.IsSelected = true;
|
btnTipIcon4.IsSelected = false;
|
break;
|
case 4:
|
btnTipIcon1.IsSelected = true;
|
btnTipIcon2.IsSelected = true;
|
btnTipIcon3.IsSelected = true;
|
btnTipIcon4.IsSelected = true;
|
if (string.IsNullOrEmpty(oldPasswrod))
|
{
|
var page = new AppUnlockPasswordSettingPage(passwrod);
|
MainPage.BasePageView.AddChidren(page);
|
page.LoadPage();
|
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
|
}
|
else
|
{
|
if (passwrod == oldPasswrod)
|
{
|
MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount-1);
|
MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount-1);
|
var page = new OperationResultDisPalyPage();
|
page.Show();
|
page.LoadPage(true);
|
}
|
else
|
{
|
etPassword.Text = "";
|
btnTipError.Visible = true;
|
}
|
}
|
break;
|
}
|
};
|
}
|
}
|
}
|