mirror of
https://github.com/jie65535/GrasscutterCommandGenerator.git
synced 2025-06-07 22:59:14 +08:00
Fix run button disabled after command failed
This commit is contained in:
parent
a0cc908983
commit
b9d1a2c2cd
@ -1234,35 +1234,41 @@ namespace GrasscutterTools.Forms
|
||||
}
|
||||
|
||||
ExpandCommandRunLog();
|
||||
BtnInvokeOpenCommand.Enabled = false;
|
||||
BtnInvokeOpenCommand.Cursor = Cursors.WaitCursor;
|
||||
int i = 0;
|
||||
foreach (var command in commands)
|
||||
try
|
||||
{
|
||||
TxtCommandRunLog.AppendText(">");
|
||||
TxtCommandRunLog.AppendText(command);
|
||||
if (commands.Length > 1)
|
||||
TxtCommandRunLog.AppendText($" ({++i}/{commands.Length})");
|
||||
TxtCommandRunLog.AppendText(Environment.NewLine);
|
||||
var cmd = command.Substring(1);
|
||||
try
|
||||
BtnInvokeOpenCommand.Enabled = false;
|
||||
BtnInvokeOpenCommand.Cursor = Cursors.WaitCursor;
|
||||
int i = 0;
|
||||
foreach (var command in commands)
|
||||
{
|
||||
var msg = await OC.Invoke(cmd);
|
||||
TxtCommandRunLog.AppendText(string.IsNullOrEmpty(msg) ? "OK" : msg);
|
||||
TxtCommandRunLog.AppendText(">");
|
||||
TxtCommandRunLog.AppendText(command);
|
||||
if (commands.Length > 1)
|
||||
TxtCommandRunLog.AppendText($" ({++i}/{commands.Length})");
|
||||
TxtCommandRunLog.AppendText(Environment.NewLine);
|
||||
var cmd = command.Substring(1);
|
||||
try
|
||||
{
|
||||
var msg = await OC.Invoke(cmd);
|
||||
TxtCommandRunLog.AppendText(string.IsNullOrEmpty(msg) ? "OK" : msg);
|
||||
TxtCommandRunLog.AppendText(Environment.NewLine);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TxtCommandRunLog.AppendText("Error: ");
|
||||
TxtCommandRunLog.AppendText(ex.Message);
|
||||
TxtCommandRunLog.AppendText(Environment.NewLine);
|
||||
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
TxtCommandRunLog.ScrollToCaret();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TxtCommandRunLog.AppendText("Error: ");
|
||||
TxtCommandRunLog.AppendText(ex.Message);
|
||||
TxtCommandRunLog.AppendText(Environment.NewLine);
|
||||
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
TxtCommandRunLog.ScrollToCaret();
|
||||
}
|
||||
BtnInvokeOpenCommand.Cursor = Cursors.Default;
|
||||
BtnInvokeOpenCommand.Enabled = true;
|
||||
finally
|
||||
{
|
||||
BtnInvokeOpenCommand.Cursor = Cursors.Default;
|
||||
BtnInvokeOpenCommand.Enabled = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user