mirror of
https://github.com/jie65535/GrasscutterCommandGenerator.git
synced 2025-06-08 23:19: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();
|
ExpandCommandRunLog();
|
||||||
BtnInvokeOpenCommand.Enabled = false;
|
try
|
||||||
BtnInvokeOpenCommand.Cursor = Cursors.WaitCursor;
|
|
||||||
int i = 0;
|
|
||||||
foreach (var command in commands)
|
|
||||||
{
|
{
|
||||||
TxtCommandRunLog.AppendText(">");
|
BtnInvokeOpenCommand.Enabled = false;
|
||||||
TxtCommandRunLog.AppendText(command);
|
BtnInvokeOpenCommand.Cursor = Cursors.WaitCursor;
|
||||||
if (commands.Length > 1)
|
int i = 0;
|
||||||
TxtCommandRunLog.AppendText($" ({++i}/{commands.Length})");
|
foreach (var command in commands)
|
||||||
TxtCommandRunLog.AppendText(Environment.NewLine);
|
|
||||||
var cmd = command.Substring(1);
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var msg = await OC.Invoke(cmd);
|
TxtCommandRunLog.AppendText(">");
|
||||||
TxtCommandRunLog.AppendText(string.IsNullOrEmpty(msg) ? "OK" : msg);
|
TxtCommandRunLog.AppendText(command);
|
||||||
|
if (commands.Length > 1)
|
||||||
|
TxtCommandRunLog.AppendText($" ({++i}/{commands.Length})");
|
||||||
TxtCommandRunLog.AppendText(Environment.NewLine);
|
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;
|
finally
|
||||||
BtnInvokeOpenCommand.Enabled = true;
|
{
|
||||||
|
BtnInvokeOpenCommand.Cursor = Cursors.Default;
|
||||||
|
BtnInvokeOpenCommand.Enabled = true;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user