Skip to content

Commit

Permalink
Added the option to close to icon tray
Browse files Browse the repository at this point in the history
  • Loading branch information
Plenyx committed Mar 24, 2024
1 parent d1a8255 commit 14b4c5b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 14 deletions.
3 changes: 3 additions & 0 deletions AppSettings/ApplicationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ private static ApplicationSettings DeserialiseFromFile(string loadLocation)
[JsonProperty("minimiseToTry")]
internal bool MinimiseToTray { get; set; } = true;

[JsonProperty("closeToTry")]
internal bool CloseToTray { get; set; } = false;

[JsonProperty("session")]
internal ApplicationSettingsSession Session { get; set; } = new ApplicationSettingsSession();

Expand Down
41 changes: 28 additions & 13 deletions Forms/FormMain.Designer.cs

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

19 changes: 18 additions & 1 deletion Forms/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ internal FormMain()
ApplicationSettings.Current.Gw2Location = "";
}
}
checkBoxCloseToTrayIcon.Checked = ApplicationSettings.Current.CloseToTray;
twitchCommandsLink.checkBoxGW2BuildEnable.Checked = ApplicationSettings.Current.Twitch.Commands.BuildEnabled;
twitchCommandsLink.textBoxGW2Build.Text = ApplicationSettings.Current.Twitch.Commands.BuildCommand;
twitchCommandsLink.checkBoxUploaderEnable.Checked = ApplicationSettings.Current.Twitch.Commands.UploaderEnabled;
Expand Down Expand Up @@ -342,6 +343,7 @@ internal FormMain()
checkBoxUsePolling.CheckedChanged += CheckBoxUsePolling_CheckedChanged;
comboBoxMaxUploads.SelectedIndexChanged += ComboBoxMaxUploads_SelectedIndexChanged;
checkBoxAutoUpdate.CheckedChanged += CheckBoxAutoUpdate_CheckedChanged;
checkBoxCloseToTrayIcon.CheckedChanged += CheckBoxCloseToTrayIcon_CheckedChanged;
logSessionLink.checkBoxSupressWebhooks.CheckedChanged += logSessionLink.CheckBoxSupressWebhooks_CheckedChanged;
logSessionLink.checkBoxOnlySuccess.CheckedChanged += logSessionLink.CheckBoxOnlySuccess_CheckedChanged;
logSessionLink.checkBoxSaveToFile.CheckedChanged += logSessionLink.CheckBoxSaveToFile_CheckedChanged;
Expand Down Expand Up @@ -1360,7 +1362,7 @@ private void ButtonLogsLocation_Click(object sender, EventArgs e)
buttonOpenLogs.Enabled = true;
}

private void CheckBoxUsePolling_CheckedChanged(object sender, System.EventArgs e)
private void CheckBoxUsePolling_CheckedChanged(object sender, EventArgs e)
{
watcher.ChangeMode(checkBoxUsePolling.Checked ? ArcLogsChangeObserverMode.Polling : default);

Expand Down Expand Up @@ -1655,6 +1657,21 @@ private void CheckBoxOnlyWhenStreamSoftwareRunning_CheckedChanged(object sender,
ApplicationSettings.Current.Upload.PostLogsToTwitchOnlyWithStreamingSoftware = checkBoxOnlyWhenStreamSoftwareRunning.Checked;
ApplicationSettings.Current.Save();
}

private void CheckBoxCloseToTrayIcon_CheckedChanged(object sender, EventArgs e)
{
ApplicationSettings.Current.CloseToTray = checkBoxCloseToTrayIcon.Checked;
ApplicationSettings.Current.Save();
}

private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (ApplicationSettings.Current.CloseToTray)
{
WindowState = FormWindowState.Minimized;
e.Cancel = true;
}
}
#endregion
}
}

0 comments on commit 14b4c5b

Please sign in to comment.