using System; using System.Timers; using Shared.Common; using Shared.Phone.Device.CommonForm; using Shared.Phone.UserCenter; namespace Shared.Phone.Device.Account { public class PhoneEmailForm : FrameLayout { /// /// 选择手机 /// public Button SelectedPhone; /// /// 选择邮箱 /// public Button SelectedEmail; /// /// 手机邮箱 /// private FrameLayout PhoneEmailFL; public PhoneEmailForm() { } /// /// Init /// /// public void Init(FrameLayout frameLayout, int y = 559, int width = 876, int height = 127) { PhoneEmailFL = new FrameLayout() { Y = Application.GetRealHeight(y), Width = Application.GetMinRealAverage(905), Height = Application.GetMinRealAverage(170), //BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor, //Radius = (uint)Application.GetRealHeight(height / 2), Gravity = Gravity.CenterHorizontal }; frameLayout.AddChidren(PhoneEmailFL); var bg = new Button { Width = Application.GetMinRealAverage(905), Height = Application.GetMinRealAverage(170), UnSelectedImagePath = "Account/PhoneEmail_White.png", Gravity = Gravity.CenterHorizontal }; PhoneEmailFL.AddChidren(bg); SelectedPhone = new Button() { X=Application.GetRealWidth(10), Width = Application.GetMinRealAverage(905 / 2 + 20), Height=Application.GetMinRealAverage(height), SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonSelectedColor, TextID = R.MyInternationalizationString.PhoneNum, TextColor = ZigbeeColor.Current.GXCTextColor, SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor, Radius = (uint)Application.GetRealHeight(height / 2), IsSelected = true, Tag = "Phone" }; PhoneEmailFL.AddChidren(SelectedPhone); SelectedEmail = new Button() { X = Application.GetMinRealAverage(905 / 2 - 20), Width = Application.GetMinRealAverage(905 / 2 + 20), Height = Application.GetMinRealAverage(height), SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonSelectedColor, TextID = R.MyInternationalizationString.Email, TextColor = ZigbeeColor.Current.GXCTextColor, SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor, Radius = (uint)Application.GetRealHeight(height / 2), IsSelected = false, Tag = "Email" }; PhoneEmailFL.AddChidren(SelectedEmail); } /// /// SetSelectedColor /// /// public void SetSelectedColor(uint selectedColor) { SelectedPhone.SelectedBackgroundColor = selectedColor; SelectedEmail.SelectedBackgroundColor = selectedColor; SelectedPhone.IsSelected = true; SelectedEmail.IsSelected = false; } } public class PhoneRowForm : FrameLayout { /// /// 手机区号btn /// public Button PhoneZoneBtn; /// /// 账号输入控件 /// public EditText AccountET; /// /// Button_Height /// private int Button_Height = 92; /// /// Init /// /// /// public void Init(FrameLayout frameLayout, FrameLayout parFL, string account, int x, int y) { var accountFL = new FrameLayout() { X = Application.GetRealWidth(x), Y = Application.GetRealHeight(y), Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = Application.GetRealHeight(CommonFormResouce.Row_Height), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; frameLayout.AddChidren(accountFL); PhoneZoneBtn = new Button() { X = Application.GetRealWidth(29), Width = Application.GetRealWidth(150), Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, Text = $"+{CommonPage.PhoneZoneStr}", TextAlignment = TextAlignment.Center, TextSize = CommonFormResouce.loginTextSize }; accountFL.AddChidren(PhoneZoneBtn); PhoneZoneBtn.MouseUpEventHandler += (sender, e) => { var form = new AreaCodeSelectForm(); parFL.AddChidren(form); form.InitForm(); form.ShowForm(); form.FinishSelectEvent += (code) => { (sender as Button).Text = "+" + code; CommonPage.PhoneZoneStr = code; }; //var zoneListView = new PhoneZone { }; //zoneListView.ActionSelectedZone += (zone) => //{ // var t = CommonPage.PhoneZoneStr; // (sender as Button).Text = "+" + zone; //}; //parFL.AddChidren(zoneListView); //zoneListView.Show(); }; AccountET = new EditText() { X = Application.GetRealWidth(222), Width = Application.GetRealWidth(600), Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPhoneNum), PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Text = account, TextAlignment = TextAlignment.CenterLeft, TextSize = CommonFormResouce.loginTextSize }; accountFL.AddChidren(AccountET); var accountLine = new Button() { Y = Application.GetRealHeight(CommonFormResouce.Row_Height) - 1, Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = 1, BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor }; accountFL.AddChidren(accountLine); } } public class PhoneLoginRowForm : FrameLayout { /// /// 账号输入控件 /// public EditText AccountET; /// /// Button_Height /// private int Button_Height = 92; /// /// Init /// /// /// public void Init(FrameLayout frameLayout, FrameLayout parFL, string account, int x, int y) { var accountFL = new FrameLayout() { X = Application.GetRealWidth(x), Y = Application.GetRealHeight(y), Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = Application.GetRealHeight(CommonFormResouce.Row_Height), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; frameLayout.AddChidren(accountFL); var accountBtn = new Button() { X = Application.GetRealWidth(69), Width = Application.GetMinRealAverage(Button_Height), Height = Application.GetMinRealAverage(Button_Height), Gravity = Gravity.CenterVertical, UnSelectedImagePath = "Account/Account.png" }; accountFL.AddChidren(accountBtn); AccountET = new EditText() { X = Application.GetRealWidth(193), Width = Application.GetRealWidth(600), Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPhoneNum), PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Text = account, TextAlignment = TextAlignment.CenterLeft, TextSize = CommonFormResouce.loginTextSize }; accountFL.AddChidren(AccountET); var accountLine = new Button() { Y = Application.GetRealHeight(CommonFormResouce.Row_Height) - 1, Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = 1, BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor }; accountFL.AddChidren(accountLine); } } public class EmailRowForm : FrameLayout { /// /// 账号输入控件 /// public EditText AccountET; /// /// Button_Height /// private int Button_Height = 92; /// /// Init /// /// /// public void Init(FrameLayout frameLayout, string account, int x, int y) { var accountFL = new FrameLayout() { X = Application.GetRealWidth(x), Y = Application.GetRealHeight(y), Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = Application.GetRealHeight(CommonFormResouce.Row_Height), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; frameLayout.AddChidren(accountFL); var accountBtn = new Button() { X = Application.GetRealWidth(29), Width = Application.GetMinRealAverage(Button_Height), Height = Application.GetMinRealAverage(Button_Height), Gravity = Gravity.CenterVertical, UnSelectedImagePath = "Account/Account.png" }; accountFL.AddChidren(accountBtn); AccountET = new EditText() { X = Application.GetRealWidth(222), Width = Application.GetRealWidth(700), Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputEmail), PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Text = account, TextAlignment = TextAlignment.CenterLeft, TextSize = CommonFormResouce.loginTextSize }; accountFL.AddChidren(AccountET); var accountLine = new Button() { Y = Application.GetRealHeight(CommonFormResouce.Row_Height) - 1, Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = 1, BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor }; accountFL.AddChidren(accountLine); } } public class EmailLoginRowForm : FrameLayout { /// /// 账号输入控件 /// public EditText AccountET; /// /// Button_Height /// private int Button_Height = 92; /// /// Init /// /// /// public void Init(FrameLayout frameLayout, string account, int x, int y) { var accountFL = new FrameLayout() { X = Application.GetRealWidth(x), Y = Application.GetRealHeight(y), Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = Application.GetRealHeight(CommonFormResouce.Row_Height), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; frameLayout.AddChidren(accountFL); var accountBtn = new Button() { X = Application.GetRealWidth(69), Width = Application.GetMinRealAverage(Button_Height), Height = Application.GetMinRealAverage(Button_Height), Gravity = Gravity.CenterVertical, UnSelectedImagePath = "Account/Account.png" }; accountFL.AddChidren(accountBtn); AccountET = new EditText() { X = Application.GetRealWidth(222), Width = Application.GetRealWidth(700), Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputEmail), PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Text = account, TextAlignment = TextAlignment.CenterLeft, TextSize = CommonFormResouce.loginTextSize }; accountFL.AddChidren(AccountET); var accountLine = new Button() { Y = Application.GetRealHeight(CommonFormResouce.Row_Height) - 1, Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = 1, BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor }; accountFL.AddChidren(accountLine); } } public class EmailForgotRowForm : FrameLayout { /// /// 账号输入控件 /// public EditText AccountET; /// /// Button_Height /// private int Button_Height = 92; /// /// Init /// /// /// public void Init(FrameLayout frameLayout, string account, int x, int y) { var accountFL = new FrameLayout() { X = Application.GetRealWidth(x), Y = Application.GetRealHeight(y), Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = Application.GetRealHeight(CommonFormResouce.Row_Height), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; frameLayout.AddChidren(accountFL); AccountET = new EditText() { X = Application.GetRealWidth(CommonFormResouce.Row_X), Width = Application.GetRealWidth(700), Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputEmail), PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Text = account, TextAlignment = TextAlignment.CenterLeft, TextSize = CommonFormResouce.loginTextSize }; accountFL.AddChidren(AccountET); var accountLine = new Button() { Y = Application.GetRealHeight(CommonFormResouce.Row_Height) - 1, Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = 1, BackgroundColor = ZigbeeColor.Current.GXCSelectedLineColor }; accountFL.AddChidren(accountLine); } } public class VerificationCodeRowForm : FrameLayout { /// /// Button_Height /// private int Button_Height = 92; /// /// codeBtn /// //public Button CodeBtn; /// /// sendCode /// public Button SendCodeBtn; /// /// VerificationCodeET /// public EditText VerificationCodeET; /// /// Init /// /// /// /// public void Init(FrameLayout frameLayout, int x, int y) { var codeFL = new FrameLayout() { X = Application.GetRealWidth(x), Y = Application.GetRealHeight(y), Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = Application.GetRealHeight(CommonFormResouce.Row_Height), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; frameLayout.AddChidren(codeFL); var codeBtn = new Button() { X = Application.GetRealWidth(29), Width = Application.GetMinRealAverage(Button_Height), Height = Application.GetMinRealAverage(Button_Height), Gravity = Gravity.CenterVertical, UnSelectedImagePath = "Account/Code.png" }; codeFL.AddChidren(codeBtn); VerificationCodeET = new EditText() { X = Application.GetRealWidth(222), Width = Application.GetRealWidth(350), Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputVerificationCode), TextAlignment = TextAlignment.CenterLeft, PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextColor = ZigbeeColor.Current.GXCTextBlackColor, TextSize = CommonFormResouce.PlaceHolderTextSize }; codeFL.AddChidren(VerificationCodeET); var sendCodeLine = new Button() { X = Application.GetRealWidth(611), Width = 1, Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, BackgroundColor = ZigbeeColor.Current.GXCLineColor }; codeFL.AddChidren(sendCodeLine); SendCodeBtn = new Button() { X = sendCodeLine.Right + Application.GetRealWidth(20), Width = Application.GetRealWidth(250), Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, TextID = R.MyInternationalizationString.SendVerificationCode, TextColor = ZigbeeColor.Current.GXCTextGrayColor, SelectedTextColor = ZigbeeColor.Current.GXCTextColor, TextAlignment = TextAlignment.Center, Enable = false, IsSelected = false }; codeFL.AddChidren(SendCodeBtn); var pwdLine = new Button() { Y = Application.GetRealHeight(CommonFormResouce.Row_Height) - 1, Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = 1, BackgroundColor = ZigbeeColor.Current.GXCSelectedLineColor }; codeFL.AddChidren(pwdLine); } } public class PwdRowForm : FrameLayout { /// /// PasswrodET /// public EditText PasswrodET; /// /// hidePWD /// private Button hidenPWDbtn; /// /// Button_Height /// private int Button_Height = 92; /// /// Init /// /// /// /// /// public void Init(FrameLayout frameLayout ,int x,int y,string password="") { var pwdFL = new FrameLayout() { X = Application.GetRealWidth(x), Y = Application.GetRealHeight(y), Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = Application.GetRealHeight(CommonFormResouce.Row_Height), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; frameLayout.AddChidren(pwdFL); var passwordBtn = new Button() { X = Application.GetRealWidth(29), Width = Application.GetMinRealAverage(Button_Height), Height = Application.GetMinRealAverage(Button_Height), Gravity=Gravity.CenterVertical, UnSelectedImagePath = "Account/Password.png" }; pwdFL.AddChidren(passwordBtn); PasswrodET = new EditText() { X = Application.GetRealWidth(222), Width = Application.GetRealWidth(550), Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD), PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Text = password, TextAlignment = TextAlignment.CenterLeft, TextSize = CommonFormResouce.loginTextSize, SecureTextEntry = true }; pwdFL.AddChidren(PasswrodET); hidenPWDbtn = new Button() { X = Application.GetRealWidth(775), Width = Application.GetMinReal(Button_Height), Height = Application.GetMinReal(Button_Height), Gravity = Gravity.CenterVertical, SelectedImagePath = "Account/HidePwd.png", UnSelectedImagePath = "Account/UnhidePwd.png", IsSelected=true }; pwdFL.AddChidren(hidenPWDbtn); hidenPWDbtn.MouseUpEventHandler += (sender, e) => { (sender as Button).IsSelected = !(sender as Button).IsSelected; PasswrodET.SecureTextEntry = (sender as Button).IsSelected; }; var pwdLine = new Button() { Y = Application.GetRealHeight(CommonFormResouce.Row_Height) - 1, Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = 1, BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor }; pwdFL.AddChidren(pwdLine); } /// /// SetPlaceholdText /// /// public void SetPlaceholdText(string holdText) { PasswrodET.PlaceholderText = holdText; } } public class PwdLoginRowForm : FrameLayout { /// /// PasswrodET /// public EditText PasswrodET; /// /// hidePWD /// private Button hidenPWDbtn; /// /// Button_Height /// private int Button_Height = 92; /// /// Init /// /// /// /// /// public void Init(FrameLayout frameLayout, int x, int y, string password = "") { var pwdFL = new FrameLayout() { X = Application.GetRealWidth(x), Y = Application.GetRealHeight(y), Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = Application.GetRealHeight(CommonFormResouce.Row_Height), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; frameLayout.AddChidren(pwdFL); var passwordBtn = new Button() { X = Application.GetRealWidth(69), Width = Application.GetMinRealAverage(Button_Height), Height = Application.GetMinRealAverage(Button_Height), Gravity = Gravity.CenterVertical, UnSelectedImagePath = "Account/Password.png" }; pwdFL.AddChidren(passwordBtn); PasswrodET = new EditText() { X = Application.GetRealWidth(193), Width = Application.GetRealWidth(600), Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD), PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Text = password, TextAlignment = TextAlignment.CenterLeft, TextSize = CommonFormResouce.loginTextSize, SecureTextEntry = true }; pwdFL.AddChidren(PasswrodET); hidenPWDbtn = new Button() { X = Application.GetRealWidth(775), Width = Application.GetMinReal(Button_Height), Height = Application.GetMinReal(Button_Height), Gravity = Gravity.CenterVertical, SelectedImagePath = "Account/HidePwd.png", UnSelectedImagePath = "Account/UnhidePwd.png", IsSelected = true }; pwdFL.AddChidren(hidenPWDbtn); hidenPWDbtn.MouseUpEventHandler += (sender, e) => { (sender as Button).IsSelected = !(sender as Button).IsSelected; PasswrodET.SecureTextEntry = (sender as Button).IsSelected; }; var pwdLine = new Button() { Y = Application.GetRealHeight(CommonFormResouce.Row_Height) - 1, Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = 1, BackgroundColor = ZigbeeColor.Current.GXCSelectedLineColor }; pwdFL.AddChidren(pwdLine); } /// /// SetPlaceholdText /// /// public void SetPlaceholdText(string holdText) { PasswrodET.PlaceholderText = holdText; } } public class PwdForForgetRowForm : FrameLayout { /// /// PasswrodET /// public EditText PasswrodET; /// /// hidePWD /// private Button hidenPWDbtn; /// /// Button_Height /// private int Button_Height = 92; /// /// Init /// /// /// /// /// public void Init(FrameLayout frameLayout, int x, int y, string password = "") { var pwdFL = new FrameLayout() { X = Application.GetRealWidth(x), Y = Application.GetRealHeight(y), Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = Application.GetRealHeight(CommonFormResouce.Row_Height), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; frameLayout.AddChidren(pwdFL); PasswrodET = new EditText() { X = Application.GetRealWidth(CommonFormResouce.Row_X), Width = Application.GetRealWidth(700), Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD), PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Text = password, TextAlignment = TextAlignment.CenterLeft, TextSize = CommonFormResouce.loginTextSize, SecureTextEntry = true }; pwdFL.AddChidren(PasswrodET); hidenPWDbtn = new Button() { X = Application.GetRealWidth(775), Width = Application.GetMinReal(Button_Height), Height = Application.GetMinReal(Button_Height), Gravity = Gravity.CenterVertical, SelectedImagePath = "Account/HidePwd.png", UnSelectedImagePath = "Account/UnhidePwd.png", IsSelected = true }; pwdFL.AddChidren(hidenPWDbtn); hidenPWDbtn.MouseUpEventHandler += (sender, e) => { (sender as Button).IsSelected = !(sender as Button).IsSelected; PasswrodET.SecureTextEntry = (sender as Button).IsSelected; }; var pwdLine = new Button() { Y = Application.GetRealHeight(CommonFormResouce.Row_Height) - 1, Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = 1, BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor }; pwdFL.AddChidren(pwdLine); } /// /// SetPlaceholdText /// /// public void SetPlaceholdText(string holdText) { PasswrodET.PlaceholderText = holdText; } } public class CodeForRegisterRowForm : FrameLayout { /// /// Button_Height /// private int Button_Height = 92; /// /// codeBtn /// //public Button CodeBtn; /// /// sendCode /// public Button SendCodeBtn; /// /// VerificationCodeET /// public EditText VerificationCodeET; /// /// sendCodeBG /// private FrameLayout SendCodeBG; private Timer t; private DateTime dateBegin; public CodeForRegisterRowForm() { t = new Timer(); dateBegin = new DateTime(); } /// /// Init /// /// /// /// public void Init(FrameLayout frameLayout, int x, int y) { var codeFL = new FrameLayout() { X = Application.GetRealWidth(x), Y = Application.GetRealHeight(y), Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = Application.GetRealHeight(CommonFormResouce.Row_Height), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; frameLayout.AddChidren(codeFL); var codeBtn = new Button() { X = Application.GetRealWidth(29), Width = Application.GetMinRealAverage(Button_Height), Height = Application.GetMinRealAverage(Button_Height), Gravity = Gravity.CenterVertical, UnSelectedImagePath = "Account/Code.png" }; codeFL.AddChidren(codeBtn); VerificationCodeET = new EditText() { X = Application.GetRealWidth(222), Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputVerificationCode), TextAlignment = TextAlignment.CenterLeft, PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextColor = ZigbeeColor.Current.GXCTextBlackColor, TextSize = CommonFormResouce.PlaceHolderTextSize }; codeFL.AddChidren(VerificationCodeET); SendCodeBtn = new Button() { X = Application.GetRealWidth(CommonFormResouce.Row_Width - 300), Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(127), Gravity = Gravity.CenterVertical, TextID = R.MyInternationalizationString.SendVerificationCode, TextColor = ZigbeeColor.Current.GXCTextWhiteColor, SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor, TextAlignment = TextAlignment.Center, BackgroundColor = ZigbeeColor.Current.GXCButtonDisableColor, SelectedBackgroundColor=ZigbeeColor.Current.GXCButtonSelectedColor, Enable = false, IsSelected = false, Radius=(uint)Application.GetRealHeight(12) }; codeFL.AddChidren(SendCodeBtn); var pwdLine = new Button() { Y = Application.GetRealHeight(CommonFormResouce.Row_Height) - 1, Width = Application.GetRealWidth(536), Height = 1, BackgroundColor = ZigbeeColor.Current.GXCSelectedLineColor }; codeFL.AddChidren(pwdLine); } /// /// TimeOut /// /// /// private void TimeOut(object sender, System.Timers.ElapsedEventArgs e) { var span = DateTime.Now - dateBegin; if (span.TotalSeconds <= 61) { Application.RunOnMainThread(() => { SendCodeBtn.Text = Convert.ToInt16(60 - span.TotalSeconds) + "s" + Language.StringByID(R.MyInternationalizationString.SendVerificationCodeAgain); SendCodeBtn.Enable = SendCodeBtn.IsSelected = false; SendCodeBtn.BackgroundColor = ZigbeeColor.Current.GXCClearColor; SendCodeBtn.SelectedBackgroundColor= ZigbeeColor.Current.GXCClearColor; SendCodeBtn.TextColor = ZigbeeColor.Current.GXCTextBlackColor; }); } else { Application.RunOnMainThread(() => { SendCodeBtn.TextID = R.MyInternationalizationString.SendVerificationCode; SendCodeBtn.BackgroundColor = ZigbeeColor.Current.GXCButtonDisableColor; SendCodeBtn.SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonSelectedColor; SendCodeBtn.TextColor = ZigbeeColor.Current.GXCTextWhiteColor; SendCodeBtn.Enable = SendCodeBtn.IsSelected = true; t.Stop(); t.Close(); }); } } /// /// TimeBegin /// public void TimeBegin() { t.Interval = 1000; t.AutoReset = true; t.Enabled = true; t.Elapsed += TimeOut; //启动计时器倒计时-60s t.Start(); dateBegin = DateTime.Now; } /// /// RemoveFromParent /// public override void RemoveFromParent() { t.Close(); t.Dispose(); base.RemoveFromParent(); } } public class CodeForForgetRowForm:FrameLayout { /// /// Button_Height /// private int Button_Height = 92; /// /// sendCode /// public Button SendCodeBtn; /// /// VerificationCodeET /// public EditText VerificationCodeET; /// /// Timer /// private Timer t; /// /// dateBegin /// private DateTime dateBegin; public CodeForForgetRowForm() { t = new Timer(); dateBegin = new DateTime(); } /// /// Init /// /// /// /// public void Init(FrameLayout frameLayout, int x, int y) { var codeFL = new FrameLayout() { X = Application.GetRealWidth(x), Y = Application.GetRealHeight(y), Width = Application.GetRealWidth(CommonFormResouce.Row_Width), Height = Application.GetRealHeight(CommonFormResouce.Row_Height), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; frameLayout.AddChidren(codeFL); VerificationCodeET = new EditText() { X = Application.GetRealWidth(CommonFormResouce.Row_X), Width = Application.GetRealWidth(536), Height = Application.GetRealHeight(Button_Height), Gravity = Gravity.CenterVertical, PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputVerificationCode), TextAlignment = TextAlignment.CenterLeft, PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextColor = ZigbeeColor.Current.GXCTextBlackColor, TextSize = CommonFormResouce.PlaceHolderTextSize }; codeFL.AddChidren(VerificationCodeET); SendCodeBtn = new Button() { X = Application.GetRealWidth(CommonFormResouce.Row_Width - 300), Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(127), Gravity = Gravity.CenterVertical, TextID = R.MyInternationalizationString.SendVerificationCode, TextColor = ZigbeeColor.Current.GXCTextWhiteColor, SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor, TextAlignment = TextAlignment.Center, BackgroundColor = ZigbeeColor.Current.GXCButtonDisableColor, SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonSelectedColor, Enable = false, IsSelected = false, Radius = (uint)Application.GetRealHeight(12) }; codeFL.AddChidren(SendCodeBtn); var pwdLine = new Button() { Y = Application.GetRealHeight(CommonFormResouce.Row_Height) - 1, Width = Application.GetRealWidth(536), Height = 1, BackgroundColor = ZigbeeColor.Current.GXCSelectedLineColor }; codeFL.AddChidren(pwdLine); } /// /// TimeOut /// /// /// private void TimeOut(object sender, System.Timers.ElapsedEventArgs e) { var span = DateTime.Now - dateBegin; if (span.TotalSeconds <= 61) { Application.RunOnMainThread(() => { SendCodeBtn.Text = Convert.ToInt16(60 - span.TotalSeconds) + "s" + Language.StringByID(R.MyInternationalizationString.SendVerificationCodeAgain); SendCodeBtn.Enable = SendCodeBtn.IsSelected = false; SendCodeBtn.BackgroundColor = ZigbeeColor.Current.GXCClearColor; SendCodeBtn.SelectedBackgroundColor = ZigbeeColor.Current.GXCClearColor; SendCodeBtn.TextColor = ZigbeeColor.Current.GXCTextBlackColor; }); } else { Application.RunOnMainThread(() => { SendCodeBtn.TextID = R.MyInternationalizationString.SendVerificationCode; SendCodeBtn.BackgroundColor = ZigbeeColor.Current.GXCButtonDisableColor; SendCodeBtn.SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonSelectedColor; SendCodeBtn.TextColor = ZigbeeColor.Current.GXCTextWhiteColor; SendCodeBtn.Enable = SendCodeBtn.IsSelected = true; t.Stop(); t.Close(); }); } } /// /// TimeBegin /// public void TimeBegin() { t.Interval = 1000; t.AutoReset = true; t.Enabled = true; t.Elapsed += TimeOut; //启动计时器倒计时-60s t.Start(); dateBegin = DateTime.Now; } /// /// RemoveFromParent /// public override void RemoveFromParent() { t.Close(); t.Dispose(); base.RemoveFromParent(); } } }