mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Merge pull request #4450 from ivandrofly/goto-line
goto-line: display error message on both ENTER and LEFT-MOUSE click
This commit is contained in:
commit
25ae0666ec
@ -44,13 +44,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
if (int.TryParse(textBox1.Text, out _lineNumber))
|
||||
{
|
||||
if (_lineNumber >= _min && _lineNumber <= _max)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
}
|
||||
Validate(textBox1.Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -90,20 +84,24 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void ButtonOkClick(object sender, EventArgs e)
|
||||
{
|
||||
if (int.TryParse(textBox1.Text, out _lineNumber))
|
||||
{
|
||||
if (_lineNumber >= _min && _lineNumber <= _max)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
return;
|
||||
}
|
||||
}
|
||||
MessageBox.Show(string.Format(Configuration.Settings.Language.GoToLine.XIsNotAValidNumber, textBox1.Text));
|
||||
Validate(textBox1.Text);
|
||||
}
|
||||
|
||||
private void ButtonCancelClick(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
|
||||
private void Validate(string inp)
|
||||
{
|
||||
if (int.TryParse(inp, out _lineNumber) && _lineNumber >= _min && _lineNumber <= _max)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(string.Format(Configuration.Settings.Language.GoToLine.XIsNotAValidNumber, textBox1.Text));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user