| | |
| | | /// </summary> |
| | | /// <param name="titleId">标题文本</param> |
| | | /// <param name="tnputEditTxet">显示文本</param> |
| | | /// <param name="errorId_IsNullOrEmpty">输入框本文为空自定义提示错误文本</param> |
| | | /// <param name="confirmAction">回调函数</param> |
| | | public void InputBox1(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, Action<string> confirmAction) |
| | | public void InputBox(int titleId, string tnputEditTxet, Action<string> confirmAction) |
| | | { |
| | | Dialog dialog = new Dialog() |
| | | { |
| | |
| | | IsNumberKeyboardType=true, |
| | | }; |
| | | editBjView.AddChidren(editText); |
| | | |
| | | editText.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | if (!editText.Foucs) |
| | | editText.Foucs = true; |
| | | |
| | | }; |
| | | |
| | | Button btn_subtract = new Button |
| | | { |
| | | X = Application.GetRealWidth(17), |
| | |
| | | whiteView.AddChidren(btn_add); |
| | | btn_subtract.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | string editTextValue = editText.Text; |
| | | if (!string.IsNullOrEmpty(editTextValue)) |
| | | { |
| | | int intValue = int.Parse(editTextValue); |
| | | if (intValue - 1 >= 0) |
| | | if (intValue>1) |
| | | { |
| | | editText.Text = (intValue - 1).ToString(); |
| | | editText.Foucs = false; |
| | | |
| | | } |
| | | } |
| | | |
| | | }; |
| | | btn_add.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | string editTextValue = editText.Text; |
| | | if (!string.IsNullOrEmpty(editTextValue)) |
| | | { |
| | | int intValue = int.Parse(editTextValue); |
| | | if (intValue - 1 <= 100) |
| | | if (intValue <100) |
| | | { |
| | | editText.Text = (intValue + 1).ToString(); |
| | | editText.Foucs = false; |
| | | } |
| | | } |
| | | }; |
| | |
| | | |
| | | btnConfirm.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | string errorId_IsNullOrEmpty = ""; |
| | | if (string.IsNullOrEmpty(editText.Text.Trim())) |
| | | { |
| | | |
| | | errorId_IsNullOrEmpty = Language.StringByID(StringId.nullvalue); |
| | | } |
| | | else |
| | | { |
| | | var editTextValue = editText.Text.Trim(); |
| | | int intValue = int.Parse(editTextValue); |
| | | if (intValue <= 0 || intValue > 100) |
| | | { |
| | | errorId_IsNullOrEmpty = Language.StringByID(StringId.setvalue); |
| | | } |
| | | } |
| | | if (errorId_IsNullOrEmpty!="") |
| | | { |
| | | whiteView.Height = Application.GetRealHeight(183); |
| | | btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1); |
| | | btnCancel.Y = btnLine.Bottom; |
| | |
| | | btnConfirm.Y = btnLine.Bottom; |
| | | btnConfirm.Gravity = Gravity.BottomRight; |
| | | |
| | | btnTip.X = Application.GetRealWidth(24); |
| | | btnTip.X = Application.GetRealWidth(53); |
| | | btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12); |
| | | btnTip.Width = Application.GetRealWidth(222); |
| | | btnTip.Width = Application.GetRealWidth(200); |
| | | btnTip.Height = Application.GetRealHeight(17); |
| | | btnTip.Text = Language.StringByID(errorId_IsNullOrEmpty); |
| | | btnTip.Text = errorId_IsNullOrEmpty; |
| | | btnTip.TextColor = CSS_Color.textRedColor; |
| | | btnTip.TextSize = TextSize.text12; |
| | | btnTip.TextAlignment = TextAlignment.CenterLeft; |
| | | return; |
| | | } |
| | | |
| | | |
| | | confirmAction(editText.Text.Trim()); |
| | | dialog.Close(); |