Skip to content

Commit

Permalink
Minor config editor optimisations
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparronator9999 committed Dec 18, 2024
1 parent a223438 commit 2805b33
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 77 deletions.
60 changes: 28 additions & 32 deletions YAMDCC.ConfigEditor/Dialogs/CrashDialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions YAMDCC.ConfigEditor/Dialogs/CrashDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ internal sealed partial class CrashDialog : Form
public CrashDialog(Exception ex)
{
InitializeComponent();
txtStackTrace.Text = $"{ex.GetType()}: {ex.Message}\r\n{ex.StackTrace}";
lblError.Text = Strings.GetString("Crash");
txtReport.Text = $"{ex.GetType()}: {ex.Message}\r\n{ex.StackTrace}";
}

private void btnReportIssue_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/Sparronator9999/YAMDCC/issues");
Process.Start($"{Paths.SourcePrefix}/issues");
}

private void btnCopy_Click(object sender, EventArgs e)
{
Clipboard.SetText(txtStackTrace.Text);
Clipboard.SetText(txtReport.Text);

// should never fail, but better safe than sorry
// (this is the crash handling dialog after all)
Expand Down
3 changes: 0 additions & 3 deletions YAMDCC.ConfigEditor/Dialogs/CrashDialog.resx
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@
<metadata name="btnExit.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="lblError.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="btnIssues.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion YAMDCC.ConfigEditor/Dialogs/TextInputDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal sealed partial class TextInputDialog : Form
/// </summary>
public string Result;

public TextInputDialog(string caption, string title = "", string text = "", bool multiline = false)
public TextInputDialog(string caption, string title, string text, bool multiline = false)
{
InitializeComponent();
lblCaption.Text = caption;
Expand Down
12 changes: 5 additions & 7 deletions YAMDCC.ConfigEditor/Dialogs/VersionDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ namespace YAMDCC.ConfigEditor.Dialogs
{
internal sealed partial class VersionDialog : Form
{
private static readonly string SourcePrefix = "https://github.com/Sparronator9999/YAMDCC";

public VersionDialog()
{
InitializeComponent();
lblDesc.Text = Strings.GetString("dlgAboutDesc");
lblCopyright.Text = Strings.GetString("dlgAboutCopyright");
lblDesc.Text = Strings.GetString("abtDesc");
lblCopyright.Text = Strings.GetString("abtCopyright");
lblVersion.Text += Utils.GetVerString();

string revision = Utils.GetRevision();
Expand All @@ -50,17 +48,17 @@ private void btnLicense_Click(object sender, EventArgs e)

private void btnSource_Click(object sender, EventArgs e)
{
Process.Start(SourcePrefix);
Process.Start(Paths.SourcePrefix);
}

private void btnFAQ_Click(object sender, EventArgs e)
{
Process.Start($"{SourcePrefix}#faq");
Process.Start($"{Paths.SourcePrefix}#faq");
}

private void btnIssues_Click(object sender, EventArgs e)
{
Process.Start($"{SourcePrefix}/issues");
Process.Start($"{Paths.SourcePrefix}/issues");
}
}
}
22 changes: 11 additions & 11 deletions YAMDCC.ConfigEditor/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public MainWindow()
tsiRevert.ToolTipText = Strings.GetString("ttRevert");
tsiExit.ToolTipText = Strings.GetString("ttExit");
tsiProfAdd.ToolTipText = Strings.GetString("ttProfAdd");
tsiProfRename.ToolTipText = Strings.GetString("ttProfRename");
tsiProfRename.ToolTipText = Strings.GetString("ttProfRen");
tsiProfChangeDesc.ToolTipText = Strings.GetString("ttProfChangeDesc");
tsiProfDel.ToolTipText = Strings.GetString("ttProfDel");
tsiECMon.ToolTipText = Strings.GetString("ttECMon");
Expand Down Expand Up @@ -114,7 +114,7 @@ public MainWindow()
TickFrequency = 5,
TickStyle = TickStyle.Both,
};
ttMain.SetToolTip(tbFanSpds[i], Strings.GetString("ttFanSpdTB"));
ttMain.SetToolTip(tbFanSpds[i], Strings.GetString("ttFanSpd"));
tbFanSpds[i].ValueChanged += tbFanSpd_Scroll;
tblCurve.Controls.Add(tbFanSpds[i], i + 1, 1);

Expand Down Expand Up @@ -205,7 +205,7 @@ private void MainWindow_Load(object sender, EventArgs e)
}
catch (Exception ex)
{
Utils.ShowError(Strings.GetString("svcErrorConnect", ex));
Utils.ShowError(Strings.GetString("svcErrConnect", ex));
Application.Exit();
return;
}
Expand All @@ -220,13 +220,13 @@ private void MainWindow_Load(object sender, EventArgs e)
}
else
{
SendServiceMessage(new ServiceCommand(Command.GetKeyLightBright, ""));
SendServiceMessage(new ServiceCommand(Command.GetKeyLightBright, string.Empty));
}
}

if (File.Exists(Paths.ECToConfFail))
{
Utils.ShowError(Strings.GetString("dlgECtoConfError", Paths.Logs));
Utils.ShowError(Strings.GetString("dlgECtoConfErr", Paths.Logs));
}
else if (File.Exists(Paths.ECToConfSuccess))
{
Expand Down Expand Up @@ -429,7 +429,7 @@ private void tsiProfRename_Click(object sender, EventArgs e)
.FanCurveConfs[cboProfSel.SelectedIndex];

TextInputDialog dlg = new(
Strings.GetString("dlgProfRename"),
Strings.GetString("dlgProfRen"),
"Change Profile Name", curveCfg.Name);
if (dlg.ShowDialog() == DialogResult.OK)
{
Expand Down Expand Up @@ -511,14 +511,14 @@ private void tsiStopSvc_Click(object sender, EventArgs e)

if (!Utils.StopService("yamdccsvc"))
{
Utils.ShowError(Strings.GetString("dlgSvcStopError"));
Utils.ShowError(Strings.GetString("dlgSvcStopErr"));
}
}
}

private void tsiUninstall_Click(object sender, EventArgs e)
{
if (MessageBox.Show(Strings.GetString("dlgSvcUninstall"), "Uninstall Service",
if (MessageBox.Show(Strings.GetString("dlgUninstall"), "Uninstall Service",
MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
bool delData = MessageBox.Show(
Expand All @@ -545,12 +545,12 @@ private void tsiUninstall_Click(object sender, EventArgs e)
}
else
{
Utils.ShowError(Strings.GetString("dlgSvcUninstallError"));
Utils.ShowError(Strings.GetString("dlgUninstallErr"));
}
}
else
{
Utils.ShowError(Strings.GetString("dlgSvcStopError"));
Utils.ShowError(Strings.GetString("dlgSvcStopErr"));
}
}
}
Expand Down Expand Up @@ -1100,7 +1100,7 @@ private void UpdateStatus(StatusCode status, int data = 0)
{
case StatusCode.ServiceCommandFail:
persist = true;
lblStatus.Text = Strings.GetString("statSvcError", (Command)data);
lblStatus.Text = Strings.GetString("statSvcErr", (Command)data);
break;
case StatusCode.ServiceResponseEmpty:
lblStatus.Text = Strings.GetString("statResponseEmpty");
Expand Down
5 changes: 5 additions & 0 deletions YAMDCC.ConfigEditor/Paths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ namespace YAMDCC.ConfigEditor
{
internal static class Paths
{
/// <summary>
/// The URL to this project's GitHub page.
/// </summary>
public static readonly string SourcePrefix = "https://github.com/Sparronator9999/YAMDCC";

/// <summary>
/// The path where program data is stored.
/// </summary>
Expand Down
8 changes: 4 additions & 4 deletions YAMDCC.ConfigEditor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private static void Main()
}
else
{
Utils.ShowError(Strings.GetString("svcErrorCrash"));
Utils.ShowError(Strings.GetString("svcErrCrash"));
}
}
else
Expand Down Expand Up @@ -112,7 +112,7 @@ private static void Main()
{
if (!Utils.StartService("yamdccsvc"))
{
Utils.ShowError(Strings.GetString("svcErrorCrash"));
Utils.ShowError(Strings.GetString("svcErrCrash"));
return;
}
}
Expand All @@ -124,7 +124,7 @@ private static void Main()
}
catch (Exception ex)
{
Utils.ShowError(Strings.GetString("svcErrorStart", ex));
Utils.ShowError(Strings.GetString("svcErrStart", ex));
return;
}
finally
Expand Down Expand Up @@ -153,7 +153,7 @@ private static void Start()

if (rebootFlag == 1)
{
if (MessageBox.Show(Strings.GetString("dlgECtoConfRebootPending"),
if (MessageBox.Show(Strings.GetString("dlgECtoConfReboot"),
"Reboot pending", MessageBoxButtons.YesNo, MessageBoxIcon.Warning,
MessageBoxDefaultButton.Button2) == DialogResult.Yes)
{
Expand Down
Loading

0 comments on commit 2805b33

Please sign in to comment.