Skip to content

Commit

Permalink
Disable Apply, Revert, and Full Blast buttons while waiting for the s…
Browse files Browse the repository at this point in the history
…ervice to process their respective commands
  • Loading branch information
Sparronator9999 committed Jan 15, 2025
1 parent c8f334a commit a80bb82
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions YAMDCC.ConfigEditor/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,15 @@ private void IPCMessage(object sender, PipeMessageEventArgs<ServiceResponse, Ser
switch ((Command)value)
{
case Command.ApplyConfig:
btnApply.Enabled = tsiApply.Enabled = true;
ToggleSvcCmds(true);
UpdateStatus(StatusCode.ConfApplied);
if (Config.KeyLightConf is not null)
{
SendSvcMessage(new ServiceCommand(Command.GetKeyLightBright, ""));
}
break;
case Command.FullBlast:
ToggleSvcCmds(true);
UpdateStatus(StatusCode.FullBlastToggled);
break;
}
Expand Down Expand Up @@ -953,6 +954,7 @@ private void btnGetModel_Click(object sender, EventArgs e)

private void FullBlastToggle(object sender, EventArgs e)
{
ToggleSvcCmds(false);
SendSvcMessage(new ServiceCommand(Command.FullBlast, chkFullBlast.Checked ? "1" : "0"));
}

Expand Down Expand Up @@ -990,7 +992,7 @@ private void RevertConf(object sender, EventArgs e)

private void ApplyConf(object sender, EventArgs e)
{
btnApply.Enabled = tsiApply.Enabled = false;
ToggleSvcCmds(false);

// Save the updated config
Config.ChargeLimitConf.CurVal = (byte)(chkChgLim.Checked
Expand Down Expand Up @@ -1287,9 +1289,8 @@ private static NumericUpDown FanCurveNUD(int tag, float scale)

private void DisableAll()
{
ToggleSvcCmds(false);
tsiSaveConf.Enabled = false;
tsiApply.Enabled = false;
tsiRevert.Enabled = false;
tsiProfAdd.Enabled = false;
tsiProfEdit.Enabled = false;
tsiProfDel.Enabled = false;
Expand Down Expand Up @@ -1327,10 +1328,15 @@ private void DisableAll()
txtManufacturer.Enabled = false;
txtModel.Enabled = false;
btnGetModel.Enabled = false;
}

chkFullBlast.Enabled = false;
btnRevert.Enabled = false;
btnApply.Enabled = false;
private void ToggleSvcCmds(bool enable)
{
tsiApply.Enabled = enable;
tsiRevert.Enabled = enable;
chkFullBlast.Enabled = enable;
btnApply.Enabled = enable;
btnRevert.Enabled = enable;
}

private bool FansHaveSameProfCount()
Expand Down

0 comments on commit a80bb82

Please sign in to comment.