From dc0309e64f02227d8e1468b7326c07955f804612 Mon Sep 17 00:00:00 2001 From: chenqiyang <1406175257@qq.com> Date: 星期三, 22 六月 2022 11:22:18 +0800 Subject: [PATCH] 修改引用路径 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/PswNumberInputControl.cs | 822 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 411 insertions(+), 411 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/PswNumberInputControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/PswNumberInputControl.cs old mode 100755 new mode 100644 index e348862..168ad29 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/PswNumberInputControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/PswNumberInputControl.cs @@ -1,411 +1,411 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Text; - -namespace Shared.Phone.UserCenter -{ - /// <summary> - /// 鏁板瓧鎸夐敭瀵嗙爜杈撳叆鎺т欢(鑷埗鐨勬墜鍔ㄦ寜閿緭鍏ョ被鍨�,璇峰疄鐜般�怉ctionPswFinish銆戜簨浠�) - /// </summary> - public class PswNumberInputControl : FrameLayoutBase - { - #region 鈻� 鍙橀噺澹版槑___________________________ - - /// <summary> - /// 瀵嗙爜杈撳叆瀹屾垚鐨勪簨浠� - /// </summary> - public Action<string> FinishInputEvent = null; - /// <summary> - /// 瀵嗙爜闀垮害 - /// </summary> - private int passwordLength = 0; - /// <summary> - /// 鏁板瓧鎸夐敭鐨勫ぇ灏� - /// </summary> - private int NumberSize = 196; - /// <summary> - /// 鏁板瓧鎸夐敭宸﹀彸鐨勯棿璺� - /// </summary> - private int NumberLeftRightSpace = 101; - /// <summary> - /// 鏁板瓧鎸夐敭涓婁笅鐨勯棿璺� - /// </summary> - private int NumberTopButtomSpace = 63; - /// <summary> - /// 杈撳叆鐨勫瘑鐮� - /// </summary> - private string inputPassword = string.Empty; - /// <summary> - /// 鏍囬鎺т欢 - /// </summary> - public NormalViewControl btnTitle = null; - /// <summary> - /// 閿欒淇℃伅鎻愮ず鎺т欢 - /// </summary> - public NormalViewControl btnError = null; - /// <summary> - /// 鏄剧ず瀵嗙爜榛戠偣鐨凢rame(鏈夊彲鑳介渶瑕佽皟鏁村畠鐨勪綅缃�) - /// </summary> - public FrameLayout framePswIcon = null; - /// <summary> - /// 鏁板瓧琛ㄧ洏鐨凢rame(鏈夊彲鑳介渶瑕佽皟鏁村畠鐨勪綅缃�) - /// </summary> - public FrameLayout frameNumberIcon = null; - /// <summary> - /// 鏁板瓧琛ㄧ洏鎸夐敭鐨勮儗鏅壊 - /// </summary> - public uint NumberIconBackColor = 0xfff5f6fa; - /// <summary> - /// 鍒犻櫎鎺т欢 - /// </summary> - private NormalViewControl btnDelete = null; - /// <summary> - /// 瀵嗙爜鍥炬爣鎺т欢闆嗗悎 - /// </summary> - private List<NormalViewControl> listPswIcon = new List<NormalViewControl>(); - - #endregion - - #region 鈻� 鍒濆鍖朹____________________________ - - /// <summary> - /// <para>瀵嗙爜杈撳叆鎺т欢(鑷埗鐨勬墜鍔ㄦ寜閿緭鍏ョ被鍨�,璇峰疄鐜般�怓inishInputEvent銆戜簨浠�)</para> - /// <para>瀹藉害涓猴細鏁板瓧閿洏鐨勫搴�+宸﹀彸鍚�40闂磋窛</para> - /// <para>瀹藉害涓猴細銆愭爣棰樼殑椤堕儴銆戝埌銆愭寜閿�0銆戝簳閮ㄧ殑楂樺害</para> - /// </summary> - /// <param name="i_title">鍒濆鏍囬鏂囨湰淇℃伅</param> - /// <param name="i_passwordLength">瀵嗙爜闀垮害,榛樿4浣�</param> - public PswNumberInputControl(string i_title, int i_passwordLength = 4) - { - this.passwordLength = i_passwordLength; - //鍔犻棿璺� - 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> - /// 鍒濆鍖栨帶浠� - /// </summary> - public void InitControl() - { - //鏍囬 - btnTitle.Width = this.Width; - btnTitle.TextAlignment = TextAlignment.Center; - btnTitle.TextSize = 18; - this.AddChidren(btnTitle); - - //鍒濆鍖栧瘑鐮佸浘鏍� - this.InitPswIconControl(); - - //鍒濆鍖栨暟瀛楄〃鐩� - this.InitNumberTableControl(); - - //閿欒淇℃伅鎻愮ず - this.btnError = new NormalViewControl(this.Width, Application.GetRealHeight(60), false); - btnError.Y = Application.GetRealHeight(222); - btnError.TextAlignment = TextAlignment.Center; - btnError.TextColor = 0xfff75858; - this.AddChidren(btnError); - - //鍒犻櫎鎺т欢 - this.btnDelete = new NormalViewControl(200, 60, true); - 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; - btnDelete.TextID = R.MyInternationalizationString.uDelete; - this.AddChidren(btnDelete); - btnDelete.ButtonClickEvent += (sender, e) => - { - if (inputPassword == string.Empty) - { - return; - } - //鍙栨秷涓�浣嶅瘑鐮� - inputPassword = inputPassword.Substring(0, inputPassword.Length - 1); - listPswIcon[inputPassword.Length].BackgroundColor = UserCenterColor.Current.Transparent; - if (btnError.Visible == true) - { - btnError.Visible = false; - } - }; - } - - #endregion - - #region 鈻� 鍒濆鍖栧瘑鐮佸浘鏍嘷____________________ - - /// <summary> - /// 鍒濆鍖栧瘑鐮佸浘鏍� - /// </summary> - private void InitPswIconControl() - { - //鍥炬爣澶у皬 - int iconSize = this.GetPictrueRealSize(36); - //鍥炬爣闂寸殑闂撮殧 - int space = this.GetPictrueRealSize(100); - //璁$畻瀵嗙爜涓暟鏄惁瓒婄晫 - int value = Application.CurrentWidth - iconSize * passwordLength; - if (passwordLength > 1) - { - value = value / (passwordLength - 1); - } - if (value < space) - { - //瓒婄晫鏃�,璋冩暣闂磋窛 - space = value; - } - - this.framePswIcon = new FrameLayout(); - framePswIcon.Height = iconSize; - framePswIcon.Width = iconSize * passwordLength + space * (passwordLength - 1); - framePswIcon.Y = Application.GetRealHeight(149); - framePswIcon.Gravity = Gravity.CenterHorizontal; - this.AddChidren(framePswIcon); - - for (int i = 0; i < passwordLength; i++) - { - var btnIcon = new NormalViewControl(iconSize, iconSize, false); - btnIcon.BorderWidth = 1; - btnIcon.BorderColor = 0xff999999; - btnIcon.Radius = (uint)iconSize / 2; - if (listPswIcon.Count > 0) - { - btnIcon.X = listPswIcon[listPswIcon.Count - 1].Right + space; - } - framePswIcon.AddChidren(btnIcon); - listPswIcon.Add(btnIcon); - } - } - - #endregion - - #region 鈻� 鍒濆鍖栨暟瀛楄〃鐩榑____________________ - - /// <summary> - /// 鍒濆鍖栨暟瀛楄〃鐩� - /// </summary> - private void InitNumberTableControl() - { - this.frameNumberIcon = new FrameLayout(); - frameNumberIcon.Y = Application.GetRealHeight(368); - frameNumberIcon.Width = this.Width; - frameNumberIcon.Gravity = Gravity.CenterHorizontal; - frameNumberIcon.Height = this.GetPictrueRealSize(NumberSize * 4 + NumberTopButtomSpace * 3); - this.AddChidren(frameNumberIcon); - - //鍓嶄竴涓帶浠剁殑鍙冲潗鏍� - int btnTempRight = 0; - //闂磋窛 - int space = this.GetPictrueRealSize(NumberLeftRightSpace); - //1鍒�9鐨勬暟瀛楃洏 - for (int i = 1; i <= 9; i++) - { - var btnNum = this.InitNumberControl(); - btnNum.Text = i.ToString(); - if (btnTempRight != 0) - { - btnNum.X = btnTempRight + space; - } - - frameNumberIcon.AddChidren(btnNum); - btnNum.Y = (i - 1) / 3 * (btnNum.Height + this.GetPictrueRealSize(NumberTopButtomSpace)); - btnNum.ButtonClickEvent += (sender, e) => - { - //鐐瑰嚮鏁板瓧鎸夐敭 - this.btnNumClickEvent(sender.Text); - }; - btnTempRight = btnNum.Right; - if (i % 3 == 0) - { - //娓呯┖ - btnTempRight = 0; - } - } - - //0鐨勬暟瀛楃洏 - var btnNum0 = this.InitNumberControl(); - btnNum0.X = this.GetPictrueRealSize(40) + frameNumberIcon.GetChildren(0).Height + space; - btnNum0.Text = "0"; - - frameNumberIcon.AddChidren(btnNum0); - btnNum0.Y = 3 * (frameNumberIcon.GetChildren(0).Height + this.GetPictrueRealSize(NumberTopButtomSpace)); - btnNum0.ButtonClickEvent += (sender, e) => - { - //鐐瑰嚮鏁板瓧鎸夐敭 - this.btnNumClickEvent("0"); - }; - } - - /// <summary> - /// 鍒濆鍖栨暟瀛楁帶浠� - /// </summary> - /// <returns></returns> - private NormalClickButton InitNumberControl() - { - int iconSize = this.GetPictrueRealSize(NumberSize); - var btnNum = new NormalClickButton(iconSize, iconSize, false); - btnNum.X = this.GetPictrueRealSize(40); - btnNum.BackgroundColor = this.NumberIconBackColor; - btnNum.clickStatuColor = 0x7e656565; - btnNum.Radius = (uint)iconSize / 2; - btnNum.TextColor = UserCenterColor.Current.TextGrayColor3; - btnNum.TextSize = 32; - - return btnNum; - } - - /// <summary> - /// 鐐瑰嚮鏁板瓧鎸夐敭 - /// </summary> - /// <param name="strNum">鏁板瓧鍊�</param> - private void btnNumClickEvent(string strNum) - { - if (inputPassword.Length >= listPswIcon.Count) - { - return; - } - if (btnError.Visible == true) - { - btnError.Visible = false; - } - //鐗规晥鏀瑰彉 - listPswIcon[inputPassword.Length].BackgroundColor = 0xff333333; - inputPassword += strNum; - //杈撳叆缁撴潫 - if (FinishInputEvent != null && inputPassword.Length == passwordLength) - { - //璋冪敤鍥炶皟鍑芥暟 - FinishInputEvent(inputPassword); - } - } - - #endregion - - #region 鈻� 閲嶇疆鎺т欢___________________________ - - /// <summary> - /// 閲嶇疆鎺т欢 - /// </summary> - /// <param name="i_title">鏍囬淇℃伅</param> - public void ResetControlInfo(string i_title) - { - //鏍囬 - btnTitle.Text = i_title; - //璁板綍鐨勫瘑鐮� - inputPassword = string.Empty; - //瀵嗙爜鍥炬爣 - for (int i = 0; i < listPswIcon.Count; i++) - { - listPswIcon[i].BackgroundColor = UserCenterColor.Current.Transparent; - } - //閿欒淇℃伅 - btnError.Text = string.Empty; - } - - #endregion - - #region 鈻� 閿欒淇℃伅璁剧疆_______________________ - - /// <summary> - /// 鏄剧ず閿欒鐨勪俊鎭� - /// </summary> - /// <param name="i_msg"></param> - public void SetErrorMsg(string i_msg) - { - if (btnError.Visible == false) - { - 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 - - #region 鈻� 鍙樻洿鍒犻櫎鎸夐挳浣嶇疆___________________ - - /// <summary> - /// 鍙樻洿鍒犻櫎鎸夐挳浣嶇疆,瀹冩渶鍒濈殑榛樿浣嶇疆鏄湪鏈�搴曢儴(鐖舵帶浠剁殑楂樺害浼氳嚜鍔ㄨ皟鏁�) - /// </summary> - /// <param name="XX">X杞�(涓嶅彉鏇磋璁剧疆涓�-1)</param> - /// <param name="YY">Y杞�(涓嶅彉鏇磋璁剧疆涓�-1)</param> - /// <param name="real">鏄惁璁$畻鐪熷疄鍊�</param> - public void ChangedDeleteButtonPoint(int XX, int YY, bool real = true) - { - if (real == true) - { - if (XX != -1) - { - XX = Application.GetRealWidth(XX); - } - if (YY != -1) - { - YY = Application.GetRealHeight(YY); - } - } - if (XX != -1) - { - this.btnDelete.X = XX; - } - if (YY != -1) - { - this.btnDelete.Y = YY; - } - - //鑷姩璋冩暣楂樺害 - int minHeight = this.GetPictrueRealSize(NumberSize * 4 + NumberTopButtomSpace * 3) + Application.GetRealHeight(368); - int realHeight = this.btnDelete.Bottom; - if (realHeight < minHeight) - { - realHeight = minHeight; - } - this.Height = realHeight; - } - - #endregion - - #region 鈻� 娣诲姞鍏抽棴鎸夐挳_______________________ - - /// <summary> - /// 娣诲姞鍏抽棴鎸夐挳 - /// </summary> - /// <returns></returns> - public IconViewControl AddCloseButton() - { - //鍏抽棴鎸夐挳 - var btnClose = new IconViewControl(86); - btnClose.Y = Application.GetRealHeight(-12); - btnClose.X = this.Width - btnClose.IconSize; - btnClose.UnSelectedImagePath = "Item/CancelIcon.png"; - this.AddChidren(btnClose); - - return btnClose; - } - - #endregion - - #region 鈻� 鎺т欢鎽ф瘉___________________________ - - /// <summary> - /// 鎺т欢鎽ф瘉 - /// </summary> - public override void RemoveFromParent() - { - FinishInputEvent = null; - base.RemoveFromParent(); - } - - #endregion - } -} +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 鏁板瓧鎸夐敭瀵嗙爜杈撳叆鎺т欢(鑷埗鐨勬墜鍔ㄦ寜閿緭鍏ョ被鍨�,璇峰疄鐜般�怉ctionPswFinish銆戜簨浠�) + /// </summary> + public class PswNumberInputControl : FrameLayoutBase + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 瀵嗙爜杈撳叆瀹屾垚鐨勪簨浠� + /// </summary> + public Action<string> FinishInputEvent = null; + /// <summary> + /// 瀵嗙爜闀垮害 + /// </summary> + private int passwordLength = 0; + /// <summary> + /// 鏁板瓧鎸夐敭鐨勫ぇ灏� + /// </summary> + private int NumberSize = 196; + /// <summary> + /// 鏁板瓧鎸夐敭宸﹀彸鐨勯棿璺� + /// </summary> + private int NumberLeftRightSpace = 101; + /// <summary> + /// 鏁板瓧鎸夐敭涓婁笅鐨勯棿璺� + /// </summary> + private int NumberTopButtomSpace = 63; + /// <summary> + /// 杈撳叆鐨勫瘑鐮� + /// </summary> + private string inputPassword = string.Empty; + /// <summary> + /// 鏍囬鎺т欢 + /// </summary> + public NormalViewControl btnTitle = null; + /// <summary> + /// 閿欒淇℃伅鎻愮ず鎺т欢 + /// </summary> + public NormalViewControl btnError = null; + /// <summary> + /// 鏄剧ず瀵嗙爜榛戠偣鐨凢rame(鏈夊彲鑳介渶瑕佽皟鏁村畠鐨勪綅缃�) + /// </summary> + public FrameLayout framePswIcon = null; + /// <summary> + /// 鏁板瓧琛ㄧ洏鐨凢rame(鏈夊彲鑳介渶瑕佽皟鏁村畠鐨勪綅缃�) + /// </summary> + public FrameLayout frameNumberIcon = null; + /// <summary> + /// 鏁板瓧琛ㄧ洏鎸夐敭鐨勮儗鏅壊 + /// </summary> + public uint NumberIconBackColor = 0xfff5f6fa; + /// <summary> + /// 鍒犻櫎鎺т欢 + /// </summary> + private NormalViewControl btnDelete = null; + /// <summary> + /// 瀵嗙爜鍥炬爣鎺т欢闆嗗悎 + /// </summary> + private List<NormalViewControl> listPswIcon = new List<NormalViewControl>(); + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// <para>瀵嗙爜杈撳叆鎺т欢(鑷埗鐨勬墜鍔ㄦ寜閿緭鍏ョ被鍨�,璇峰疄鐜般�怓inishInputEvent銆戜簨浠�)</para> + /// <para>瀹藉害涓猴細鏁板瓧閿洏鐨勫搴�+宸﹀彸鍚�40闂磋窛</para> + /// <para>瀹藉害涓猴細銆愭爣棰樼殑椤堕儴銆戝埌銆愭寜閿�0銆戝簳閮ㄧ殑楂樺害</para> + /// </summary> + /// <param name="i_title">鍒濆鏍囬鏂囨湰淇℃伅</param> + /// <param name="i_passwordLength">瀵嗙爜闀垮害,榛樿4浣�</param> + public PswNumberInputControl(string i_title, int i_passwordLength = 4) + { + this.passwordLength = i_passwordLength; + //鍔犻棿璺� + 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> + /// 鍒濆鍖栨帶浠� + /// </summary> + public void InitControl() + { + //鏍囬 + btnTitle.Width = this.Width; + btnTitle.TextAlignment = TextAlignment.Center; + btnTitle.TextSize = 18; + this.AddChidren(btnTitle); + + //鍒濆鍖栧瘑鐮佸浘鏍� + this.InitPswIconControl(); + + //鍒濆鍖栨暟瀛楄〃鐩� + this.InitNumberTableControl(); + + //閿欒淇℃伅鎻愮ず + this.btnError = new NormalViewControl(this.Width, Application.GetRealHeight(60), false); + btnError.Y = Application.GetRealHeight(222); + btnError.TextAlignment = TextAlignment.Center; + btnError.TextColor = 0xfff75858; + this.AddChidren(btnError); + + //鍒犻櫎鎺т欢 + this.btnDelete = new NormalViewControl(200, 60, true); + 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; + btnDelete.TextID = R.MyInternationalizationString.uDelete; + this.AddChidren(btnDelete); + btnDelete.ButtonClickEvent += (sender, e) => + { + if (inputPassword == string.Empty) + { + return; + } + //鍙栨秷涓�浣嶅瘑鐮� + inputPassword = inputPassword.Substring(0, inputPassword.Length - 1); + listPswIcon[inputPassword.Length].BackgroundColor = UserCenterColor.Current.Transparent; + if (btnError.Visible == true) + { + btnError.Visible = false; + } + }; + } + + #endregion + + #region 鈻� 鍒濆鍖栧瘑鐮佸浘鏍嘷____________________ + + /// <summary> + /// 鍒濆鍖栧瘑鐮佸浘鏍� + /// </summary> + private void InitPswIconControl() + { + //鍥炬爣澶у皬 + int iconSize = this.GetPictrueRealSize(36); + //鍥炬爣闂寸殑闂撮殧 + int space = this.GetPictrueRealSize(100); + //璁$畻瀵嗙爜涓暟鏄惁瓒婄晫 + int value = Application.CurrentWidth - iconSize * passwordLength; + if (passwordLength > 1) + { + value = value / (passwordLength - 1); + } + if (value < space) + { + //瓒婄晫鏃�,璋冩暣闂磋窛 + space = value; + } + + this.framePswIcon = new FrameLayout(); + framePswIcon.Height = iconSize; + framePswIcon.Width = iconSize * passwordLength + space * (passwordLength - 1); + framePswIcon.Y = Application.GetRealHeight(149); + framePswIcon.Gravity = Gravity.CenterHorizontal; + this.AddChidren(framePswIcon); + + for (int i = 0; i < passwordLength; i++) + { + var btnIcon = new NormalViewControl(iconSize, iconSize, false); + btnIcon.BorderWidth = 1; + btnIcon.BorderColor = 0xff999999; + btnIcon.Radius = (uint)iconSize / 2; + if (listPswIcon.Count > 0) + { + btnIcon.X = listPswIcon[listPswIcon.Count - 1].Right + space; + } + framePswIcon.AddChidren(btnIcon); + listPswIcon.Add(btnIcon); + } + } + + #endregion + + #region 鈻� 鍒濆鍖栨暟瀛楄〃鐩榑____________________ + + /// <summary> + /// 鍒濆鍖栨暟瀛楄〃鐩� + /// </summary> + private void InitNumberTableControl() + { + this.frameNumberIcon = new FrameLayout(); + frameNumberIcon.Y = Application.GetRealHeight(368); + frameNumberIcon.Width = this.Width; + frameNumberIcon.Gravity = Gravity.CenterHorizontal; + frameNumberIcon.Height = this.GetPictrueRealSize(NumberSize * 4 + NumberTopButtomSpace * 3); + this.AddChidren(frameNumberIcon); + + //鍓嶄竴涓帶浠剁殑鍙冲潗鏍� + int btnTempRight = 0; + //闂磋窛 + int space = this.GetPictrueRealSize(NumberLeftRightSpace); + //1鍒�9鐨勬暟瀛楃洏 + for (int i = 1; i <= 9; i++) + { + var btnNum = this.InitNumberControl(); + btnNum.Text = i.ToString(); + if (btnTempRight != 0) + { + btnNum.X = btnTempRight + space; + } + + frameNumberIcon.AddChidren(btnNum); + btnNum.Y = (i - 1) / 3 * (btnNum.Height + this.GetPictrueRealSize(NumberTopButtomSpace)); + btnNum.ButtonClickEvent += (sender, e) => + { + //鐐瑰嚮鏁板瓧鎸夐敭 + this.btnNumClickEvent(sender.Text); + }; + btnTempRight = btnNum.Right; + if (i % 3 == 0) + { + //娓呯┖ + btnTempRight = 0; + } + } + + //0鐨勬暟瀛楃洏 + var btnNum0 = this.InitNumberControl(); + btnNum0.X = this.GetPictrueRealSize(40) + frameNumberIcon.GetChildren(0).Height + space; + btnNum0.Text = "0"; + + frameNumberIcon.AddChidren(btnNum0); + btnNum0.Y = 3 * (frameNumberIcon.GetChildren(0).Height + this.GetPictrueRealSize(NumberTopButtomSpace)); + btnNum0.ButtonClickEvent += (sender, e) => + { + //鐐瑰嚮鏁板瓧鎸夐敭 + this.btnNumClickEvent("0"); + }; + } + + /// <summary> + /// 鍒濆鍖栨暟瀛楁帶浠� + /// </summary> + /// <returns></returns> + private NormalClickButton InitNumberControl() + { + int iconSize = this.GetPictrueRealSize(NumberSize); + var btnNum = new NormalClickButton(iconSize, iconSize, false); + btnNum.X = this.GetPictrueRealSize(40); + btnNum.BackgroundColor = this.NumberIconBackColor; + btnNum.clickStatuColor = 0x7e656565; + btnNum.Radius = (uint)iconSize / 2; + btnNum.TextColor = UserCenterColor.Current.TextGrayColor3; + btnNum.TextSize = 32; + + return btnNum; + } + + /// <summary> + /// 鐐瑰嚮鏁板瓧鎸夐敭 + /// </summary> + /// <param name="strNum">鏁板瓧鍊�</param> + private void btnNumClickEvent(string strNum) + { + if (inputPassword.Length >= listPswIcon.Count) + { + return; + } + if (btnError.Visible == true) + { + btnError.Visible = false; + } + //鐗规晥鏀瑰彉 + listPswIcon[inputPassword.Length].BackgroundColor = 0xff333333; + inputPassword += strNum; + //杈撳叆缁撴潫 + if (FinishInputEvent != null && inputPassword.Length == passwordLength) + { + //璋冪敤鍥炶皟鍑芥暟 + FinishInputEvent(inputPassword); + } + } + + #endregion + + #region 鈻� 閲嶇疆鎺т欢___________________________ + + /// <summary> + /// 閲嶇疆鎺т欢 + /// </summary> + /// <param name="i_title">鏍囬淇℃伅</param> + public void ResetControlInfo(string i_title) + { + //鏍囬 + btnTitle.Text = i_title; + //璁板綍鐨勫瘑鐮� + inputPassword = string.Empty; + //瀵嗙爜鍥炬爣 + for (int i = 0; i < listPswIcon.Count; i++) + { + listPswIcon[i].BackgroundColor = UserCenterColor.Current.Transparent; + } + //閿欒淇℃伅 + btnError.Text = string.Empty; + } + + #endregion + + #region 鈻� 閿欒淇℃伅璁剧疆_______________________ + + /// <summary> + /// 鏄剧ず閿欒鐨勪俊鎭� + /// </summary> + /// <param name="i_msg"></param> + public void SetErrorMsg(string i_msg) + { + if (btnError.Visible == false) + { + 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 + + #region 鈻� 鍙樻洿鍒犻櫎鎸夐挳浣嶇疆___________________ + + /// <summary> + /// 鍙樻洿鍒犻櫎鎸夐挳浣嶇疆,瀹冩渶鍒濈殑榛樿浣嶇疆鏄湪鏈�搴曢儴(鐖舵帶浠剁殑楂樺害浼氳嚜鍔ㄨ皟鏁�) + /// </summary> + /// <param name="XX">X杞�(涓嶅彉鏇磋璁剧疆涓�-1)</param> + /// <param name="YY">Y杞�(涓嶅彉鏇磋璁剧疆涓�-1)</param> + /// <param name="real">鏄惁璁$畻鐪熷疄鍊�</param> + public void ChangedDeleteButtonPoint(int XX, int YY, bool real = true) + { + if (real == true) + { + if (XX != -1) + { + XX = Application.GetRealWidth(XX); + } + if (YY != -1) + { + YY = Application.GetRealHeight(YY); + } + } + if (XX != -1) + { + this.btnDelete.X = XX; + } + if (YY != -1) + { + this.btnDelete.Y = YY; + } + + //鑷姩璋冩暣楂樺害 + int minHeight = this.GetPictrueRealSize(NumberSize * 4 + NumberTopButtomSpace * 3) + Application.GetRealHeight(368); + int realHeight = this.btnDelete.Bottom; + if (realHeight < minHeight) + { + realHeight = minHeight; + } + this.Height = realHeight; + } + + #endregion + + #region 鈻� 娣诲姞鍏抽棴鎸夐挳_______________________ + + /// <summary> + /// 娣诲姞鍏抽棴鎸夐挳 + /// </summary> + /// <returns></returns> + public IconViewControl AddCloseButton() + { + //鍏抽棴鎸夐挳 + var btnClose = new IconViewControl(86); + btnClose.Y = Application.GetRealHeight(-12); + btnClose.X = this.Width - btnClose.IconSize; + btnClose.UnSelectedImagePath = "Item/CancelIcon.png"; + this.AddChidren(btnClose); + + return btnClose; + } + + #endregion + + #region 鈻� 鎺т欢鎽ф瘉___________________________ + + /// <summary> + /// 鎺т欢鎽ф瘉 + /// </summary> + public override void RemoveFromParent() + { + FinishInputEvent = null; + base.RemoveFromParent(); + } + + #endregion + } +} -- Gitblit v1.8.0