Skip to content

Commit 3035308

Browse files
committed
Saving bugs when changing settings.
fixed bug where Icon was not parsing correctly
1 parent 32b447a commit 3035308

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

Helpers/AppSettings.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public bool ActivateOnLaunch
2020
{
2121
_activateOnLaunch = value;
2222
appSettings[nameof(ActivateOnLaunch)].Value = _activateOnLaunch.ToString();
23+
configFile.Save(ConfigurationSaveMode.Modified);
2324
}
2425
}
2526

@@ -32,6 +33,7 @@ public bool AutomaticallyLaunchWithWindows
3233
{
3334
_automaticallyLaunchWithWindows = value;
3435
appSettings[nameof(AutomaticallyLaunchWithWindows)].Value = _automaticallyLaunchWithWindows.ToString();
36+
configFile.Save(ConfigurationSaveMode.Modified);
3537
}
3638
}
3739

@@ -45,6 +47,7 @@ public bool ShowMessageOnLaunch
4547
{
4648
_showMessageOnLaunch = value;
4749
appSettings[nameof(ShowMessageOnLaunch)].Value = _showMessageOnLaunch.ToString();
50+
configFile.Save(ConfigurationSaveMode.Modified);
4851
}
4952
}
5053

@@ -58,6 +61,7 @@ public int DefaultDuration
5861
{
5962
_defaultDuration = value;
6063
appSettings[nameof(DefaultDuration)].Value = _defaultDuration.ToString();
64+
configFile.Save(ConfigurationSaveMode.Modified);
6165
}
6266
}
6367

@@ -71,6 +75,7 @@ public TrayIcon Icon
7175
{
7276
_icon = value;
7377
appSettings[nameof(Icon)].Value = _icon.ToString();
78+
configFile.Save(ConfigurationSaveMode.Modified);
7479
}
7580
}
7681

@@ -84,6 +89,7 @@ public List<int> Durations
8489
{
8590
_durations = value;
8691
appSettings[nameof(Durations)].Value = string.Join(',',Durations.ToArray());
92+
configFile.Save(ConfigurationSaveMode.Modified);
8793
}
8894
}
8995

@@ -149,7 +155,7 @@ public AppSettings()
149155
case "Mug":
150156
_icon = TrayIcon.Mug;
151157
break;
152-
case "Eye-ZZZ":
158+
case "EyeWithZzz":
153159
_icon = TrayIcon.EyeWithZzz;
154160
break;
155161
default:
@@ -181,6 +187,8 @@ public AppSettings()
181187
AddUpdateAppSettings(nameof(Durations), string.Join(',', _durations.ToArray()));
182188
Console.WriteLine($"Error reading Durations app settings");
183189
}
190+
191+
configFile.Save(ConfigurationSaveMode.Modified);
184192
}
185193

186194
void AddUpdateAppSettings(string key, string value)

SettingsForm.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ private async void setStartupCheckBox() {
114114
}
115115

116116
private void okBtn_Click(object sender, EventArgs e) {
117-
//Settings.Default.Save();
118117
this.Close();
119118
}
120119

0 commit comments

Comments
 (0)