old mode 100644
new mode 100755
| | |
| | | /// </summary>
|
| | | public Action FinishInputEvent = null;
|
| | | /// <summary>
|
| | | /// 值改变事件(受MaxByte属性限制)
|
| | | /// </summary>
|
| | | public Action<string> TextChangedEvent = null;
|
| | | /// <summary>
|
| | | /// 指定该输入框是否为不可省略(默认为false)
|
| | | /// </summary>
|
| | | public bool MustInput = false;
|
| | |
| | | private void TxtCode_TextChangedEvent(object sender, string value)
|
| | | {
|
| | | var byteData = Encoding.UTF8.GetBytes(value);
|
| | | var newValue = value;
|
| | |
|
| | | //如果输入的值,已经大于指定的byte数,则截取
|
| | | if (byteData.Length > this.m_MaxByte)
|
| | | {
|
| | | //截取指定的byte字节
|
| | | var newValue = Encoding.UTF8.GetString(byteData, 0, this.m_MaxByte);
|
| | | newValue = Encoding.UTF8.GetString(byteData, 0, this.m_MaxByte);
|
| | | //最后一位不要,因为截取的最后一位可能是乱码
|
| | | newValue = newValue.Substring(0, newValue.Length - 1);
|
| | | //拼接上它的下一位,然后检测
|
| | |
| | | newValue = checkValue;
|
| | | }
|
| | | this.Text = newValue;
|
| | | #if Android
|
| | | //将光标至于最后
|
| | | #if Android
|
| | | this.SetSelectionEnd();
|
| | | #endif
|
| | | }
|
| | | this.TextChangedEvent?.Invoke(newValue);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | public override void RemoveFromParent()
|
| | | {
|
| | | this.FinishInputEvent = null;
|
| | | this.TextChangedEvent = null;
|
| | | if (this.Parent != null)
|
| | | {
|
| | | base.RemoveFromParent();
|