diff --git a/AM2RLauncher/AM2RLauncher/MainForm/CustomControls/LauncherCheckbox.cs b/AM2RLauncher/AM2RLauncher/MainForm/CustomControls/LauncherCheckbox.cs
new file mode 100644
index 0000000..dc5e5c1
--- /dev/null
+++ b/AM2RLauncher/AM2RLauncher/MainForm/CustomControls/LauncherCheckbox.cs
@@ -0,0 +1,13 @@
+using Eto.Forms;
+
+namespace AM2RLauncher;
+
+public class LauncherCheckbox : CheckBox
+{
+ public LauncherCheckbox(string text, bool? checkedState = false)
+ {
+ Text = text;
+ Checked = checkedState;
+ TextColor = LauncherColors.Green;
+ }
+}
\ No newline at end of file
diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs
index 77a5b66..7aef4ff 100644
--- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs
+++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs
@@ -566,8 +566,8 @@ public partial class MainForm : Form
/// Gets called when gets clicked and writes its new value to the config.
private void AutoUpdateLauncherCheckChanged(object sender, EventArgs e)
{
- log.Info("Auto Update Launcher has been set to " + autoUpdateAM2RCheck.Checked + ".");
- WriteToConfig("AutoUpdateLauncher", autoUpdateAM2RCheck.Checked.Value);
+ log.Info("Auto Update Launcher has been set to " + autoUpdateLauncherCheck.Checked + ".");
+ WriteToConfig("AutoUpdateLauncher", autoUpdateLauncherCheck.Checked.Value);
}
/// Gets called when gets clicked and writes its new value to the config.
diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs
index f3cce12..f466c48 100644
--- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs
+++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs
@@ -475,52 +475,17 @@ public partial class MainForm : Form
languageDropDown.SelectedIndex = 0;
else
languageDropDown.SelectedIndex = languageDropDown.Items.IndexOf(languageDropDown.Items.FirstOrDefault(x => x.Text.Equals(tmpLanguage)));
-
if (languageDropDown.SelectedIndex == -1)
{
log.Info($"User has tried to use {tmpLanguage} as a Language, but it was not found. Reverting to System Language");
languageDropDown.SelectedIndex = 0;
}
- // autoUpdateAM2R checkbox
- autoUpdateAM2RCheck = new CheckBox
- {
- Checked = Boolean.Parse(ReadFromConfig("AutoUpdateAM2R")),
- Text = Text.AutoUpdateAM2R,
- TextColor = LauncherColors.Green
- };
-
- // autoUpdateLauncher checkbox
- autoUpdateLauncherCheck = new CheckBox
- {
- Checked = Boolean.Parse(ReadFromConfig("AutoUpdateLauncher")),
- Text = Text.AutoUpdateLauncher,
- TextColor = LauncherColors.Green
- };
-
- // HQ music, PC
- hqMusicPCCheck = new CheckBox
- {
- Checked = Boolean.Parse(ReadFromConfig("MusicHQPC")),
- Text = Text.HighQualityPC,
- TextColor = LauncherColors.Green
- };
-
- // HQ music, Android
- hqMusicAndroidCheck = new CheckBox
- {
- Checked = Boolean.Parse(ReadFromConfig("MusicHQAndroid")),
- Text = Text.HighQualityAndroid,
- TextColor = LauncherColors.Green
- };
-
- // Create game debug logs
- profileDebugLogCheck = new CheckBox
- {
- Checked = Boolean.Parse(ReadFromConfig("ProfileDebugLog")),
- Text = Text.ProfileDebugCheckBox,
- TextColor = LauncherColors.Green
- };
+ autoUpdateAM2RCheck = new LauncherCheckbox(Text.AutoUpdateAM2R, Boolean.Parse(ReadFromConfig("AutoUpdateAM2R")));
+ autoUpdateLauncherCheck = new LauncherCheckbox(Text.AutoUpdateLauncher, Boolean.Parse(ReadFromConfig("AutoUpdateLauncher")));
+ hqMusicPCCheck = new LauncherCheckbox(Text.HighQualityPC, Boolean.Parse(ReadFromConfig("MusicHQPC")));
+ hqMusicAndroidCheck = new LauncherCheckbox(Text.HighQualityAndroid, Boolean.Parse(ReadFromConfig("MusicHQAndroid")));
+ profileDebugLogCheck = new LauncherCheckbox(Text.ProfileDebugCheckBox, Boolean.Parse(ReadFromConfig("ProfileDebugLog")));
// Mirror list
mirrorLabel = new Label
@@ -545,12 +510,7 @@ public partial class MainForm : Form
currentMirror = mirrorList[mirrorDropDown.SelectedIndex];
// Custom mirror
- customMirrorCheck = new CheckBox
- {
- Checked = Boolean.Parse(ReadFromConfig("CustomMirrorEnabled")),
- Text = Text.CustomMirrorCheck,
- TextColor = LauncherColors.Green
- };
+ customMirrorCheck = new LauncherCheckbox(Text.CustomMirrorCheck, Boolean.Parse(ReadFromConfig("CustomMirrorEnabled")));
customMirrorTextBox = new TextBox
{
@@ -660,13 +620,9 @@ public partial class MainForm : Form
Pages =
{
mainPage,
-
changelogPage,
-
newsPage,
-
settingsPage,
-
modSettingsPage
}
};