mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
BUG-1560 added format-validation for the arguments-field
This commit is contained in:
parent
3f16a5d4f2
commit
d2558f2159
3 changed files with 24 additions and 2 deletions
|
@ -98,6 +98,7 @@ namespace ExternalCommand {
|
|||
buttonOk.Enabled = true;
|
||||
textBox_name.BackColor = Color.White;
|
||||
textBox_commandline.BackColor = Color.White;
|
||||
textBox_arguments.BackColor = Color.White;
|
||||
// Is there a text in the name field
|
||||
if(string.IsNullOrEmpty(textBox_name.Text)) {
|
||||
buttonOk.Enabled = false;
|
||||
|
@ -116,6 +117,16 @@ namespace ExternalCommand {
|
|||
buttonOk.Enabled = false;
|
||||
textBox_commandline.BackColor = Color.Red;
|
||||
}
|
||||
// Are the arguments in a valid format?
|
||||
try
|
||||
{
|
||||
ExternalCommandDestination.FormatArguments(textBox_arguments.Text, string.Empty);
|
||||
}
|
||||
catch
|
||||
{
|
||||
buttonOk.Enabled = false;
|
||||
textBox_arguments.BackColor = Color.Red;
|
||||
}
|
||||
}
|
||||
|
||||
private void textBox_name_TextChanged(object sender, EventArgs e) {
|
||||
|
@ -126,5 +137,10 @@ namespace ExternalCommand {
|
|||
OKButtonState();
|
||||
}
|
||||
|
||||
private void textBox_arguments_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
OKButtonState();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue