| | |
| | | /// <summary>
|
| | | /// 数字按键密码输入控件(自制的手动按键输入类型,请实现【ActionPswFinish】事件)
|
| | | /// </summary>
|
| | | public class PswNumberInputControl : FrameLayout
|
| | | public class PswNumberInputControl : FrameLayoutBase
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | |
| | | {
|
| | | this.passwordLength = i_passwordLength;
|
| | | //加间距
|
| | | this.Width = Application.GetMinRealAverage(NumberSize * 3 + NumberLeftRightSpace * 2 + 80);
|
| | | this.Height = Application.GetMinRealAverage(NumberSize * 4 + NumberTopButtomSpace * 3) + Application.GetRealHeight(368);
|
| | | this.Width = this.GetPictrueRealSize(NumberSize * 3 + NumberLeftRightSpace * 2 + 80);
|
| | | this.Height = this.GetPictrueRealSize(NumberSize * 4 + NumberTopButtomSpace * 3) + Application.GetRealHeight(368);
|
| | | this.btnTitle = new NormalViewControl(Application.CurrentWidth, Application.GetRealWidth(75), false);
|
| | | btnTitle.Text = i_title;
|
| | | btnTitle.IsBold = true;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | |
|
| | | //删除控件
|
| | | this.btnDelete = new NormalViewControl(200, 60, true);
|
| | | btnDelete.X = this.Width - Application.GetRealWidth(200) - Application.GetMinRealAverage(40);
|
| | | btnDelete.X = this.Width - Application.GetRealWidth(200) - this.GetPictrueRealSize(40);
|
| | | btnDelete.Y = this.Height - Application.GetRealHeight(60);
|
| | | btnDelete.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnDelete.TextAlignment = TextAlignment.Center;
|
| | |
| | | private void InitPswIconControl()
|
| | | {
|
| | | //图标大小
|
| | | int iconSize = Application.GetMinRealAverage(36);
|
| | | int iconSize = this.GetPictrueRealSize(36);
|
| | | //图标间的间隔
|
| | | int space = Application.GetMinRealAverage(100);
|
| | | int space = this.GetPictrueRealSize(100);
|
| | | //计算密码个数是否越界
|
| | | int value = Application.CurrentWidth - iconSize * passwordLength;
|
| | | if (passwordLength > 1)
|
| | |
| | | frameNumberIcon.Y = Application.GetRealHeight(368);
|
| | | frameNumberIcon.Width = this.Width;
|
| | | frameNumberIcon.Gravity = Gravity.CenterHorizontal;
|
| | | frameNumberIcon.Height = Application.GetMinRealAverage(NumberSize * 4 + NumberTopButtomSpace * 3);
|
| | | frameNumberIcon.Height = this.GetPictrueRealSize(NumberSize * 4 + NumberTopButtomSpace * 3);
|
| | | this.AddChidren(frameNumberIcon);
|
| | |
|
| | | //前一个控件的右坐标
|
| | | int btnTempRight = 0;
|
| | | //间距
|
| | | int space = Application.GetMinRealAverage(NumberLeftRightSpace);
|
| | | int space = this.GetPictrueRealSize(NumberLeftRightSpace);
|
| | | //1到9的数字盘
|
| | | for (int i = 1; i <= 9; i++)
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | frameNumberIcon.AddChidren(btnNum);
|
| | | btnNum.Y = (i - 1) / 3 * (btnNum.Height + Application.GetMinRealAverage(NumberTopButtomSpace));
|
| | | btnNum.Y = (i - 1) / 3 * (btnNum.Height + this.GetPictrueRealSize(NumberTopButtomSpace));
|
| | | btnNum.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //点击数字按键
|
| | |
| | |
|
| | | //0的数字盘
|
| | | var btnNum0 = this.InitNumberControl();
|
| | | btnNum0.X = Application.GetMinRealAverage(40) + frameNumberIcon.GetChildren(0).Height + space;
|
| | | btnNum0.X = this.GetPictrueRealSize(40) + frameNumberIcon.GetChildren(0).Height + space;
|
| | | btnNum0.Text = "0";
|
| | |
|
| | | frameNumberIcon.AddChidren(btnNum0);
|
| | | btnNum0.Y = 3 * (frameNumberIcon.GetChildren(0).Height + Application.GetMinRealAverage(NumberTopButtomSpace));
|
| | | btnNum0.Y = 3 * (frameNumberIcon.GetChildren(0).Height + this.GetPictrueRealSize(NumberTopButtomSpace));
|
| | | btnNum0.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //点击数字按键
|
| | |
| | | /// <returns></returns>
|
| | | private NormalClickButton InitNumberControl()
|
| | | {
|
| | | int iconSize = Application.GetMinRealAverage(NumberSize);
|
| | | int iconSize = this.GetPictrueRealSize(NumberSize);
|
| | | var btnNum = new NormalClickButton(iconSize, iconSize, false);
|
| | | btnNum.X = Application.GetMinRealAverage(40);
|
| | | btnNum.X = this.GetPictrueRealSize(40);
|
| | | btnNum.BackgroundColor = this.NumberIconBackColor;
|
| | | btnNum.clickStatuColor = 0x7e656565;
|
| | | btnNum.Radius = (uint)iconSize / 2;
|
| | |
| | | /// 重置控件
|
| | | /// </summary>
|
| | | /// <param name="i_title">标题信息</param>
|
| | | /// <param name="clearError">是否清除错误信息</param>
|
| | | public void ResetControlInfo(string i_title, bool clearError = true)
|
| | | public void ResetControlInfo(string i_title)
|
| | | {
|
| | | //标题
|
| | | btnTitle.Text = i_title;
|
| | |
| | | {
|
| | | listPswIcon[i].BackgroundColor = UserCenterColor.Current.Transparent;
|
| | | }
|
| | | if (clearError == true)
|
| | | {
|
| | | //错误信息
|
| | | btnError.Text = string.Empty;
|
| | | }
|
| | | //错误信息
|
| | | btnError.Text = string.Empty;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | btnError.Visible = true;
|
| | | }
|
| | | btnError.Text = i_msg;
|
| | |
|
| | | //记录的密码
|
| | | inputPassword = string.Empty;
|
| | | //密码图标
|
| | | for (int i = 0; i < listPswIcon.Count; i++)
|
| | | {
|
| | | listPswIcon[i].BackgroundColor = UserCenterColor.Current.Transparent;
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | }
|
| | |
|
| | | //自动调整高度
|
| | | int minHeight = Application.GetMinRealAverage(NumberSize * 4 + NumberTopButtomSpace * 3) + Application.GetRealHeight(368);
|
| | | int minHeight = this.GetPictrueRealSize(NumberSize * 4 + NumberTopButtomSpace * 3) + Application.GetRealHeight(368);
|
| | | int realHeight = this.btnDelete.Bottom;
|
| | | if (realHeight < minHeight)
|
| | | {
|