|
|
|
@ -69,11 +69,17 @@ public partial class MessageBox : Window |
|
|
|
|
return _result; |
|
|
|
|
} |
|
|
|
|
// |
|
|
|
|
public MessageBoxResult ShowInput(String message, out String inputStr , String confirmButtonTitle = "", String cancelButtonTitle ="") |
|
|
|
|
public MessageBoxResult ShowInput(String message, out String inputStr , String confirmButtonTitle = "", String cancelButtonTitle ="", bool EnterConfirm = true) |
|
|
|
|
{ |
|
|
|
|
_showType = 2; |
|
|
|
|
this.Height = 300; |
|
|
|
|
TextBlockCenterBox.Text = message; |
|
|
|
|
TextBoxInput.Focus(); |
|
|
|
|
if (EnterConfirm) |
|
|
|
|
{ |
|
|
|
|
TextBoxInput.KeyDown += TextBoxInput_OnKeyDown; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(confirmButtonTitle) && !string.IsNullOrWhiteSpace(cancelButtonTitle)) |
|
|
|
|
{ |
|
|
|
|
ConfirmButtonText.Text = confirmButtonTitle; |
|
|
|
@ -136,4 +142,12 @@ public partial class MessageBox : Window |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void TextBoxInput_OnKeyDown(object sender, KeyEventArgs e) |
|
|
|
|
{ |
|
|
|
|
if (e.Key == Key.Enter) // 检测是否按下回车键 |
|
|
|
|
{ |
|
|
|
|
ConfirmButton_OnClick(sender, e); // 调用按钮的点击事件 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |