Skip to content

Commit d05639f

Browse files
Simplify the settings engine by not watching the folder for file changes
1 parent a702df0 commit d05639f

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

RadialActions/Properties/Settings.Engine.cs

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ namespace RadialActions.Properties;
66

77
public sealed partial class Settings : ObservableObject
88
{
9-
private readonly FileSystemWatcher _watcher;
10-
119
private static readonly Lazy<Settings> _default = new(LoadAndAttemptSave);
1210

1311
private static readonly JsonSerializerSettings _jsonSerializerSettings = new()
@@ -34,15 +32,7 @@ static Settings()
3432
}
3533

3634
// Private constructor to enforce singleton pattern.
37-
private Settings()
38-
{
39-
// Watch for changes in specifically the settings file.
40-
_watcher = new(App.MainFileInfo.DirectoryName, Path.GetFileName(FilePath))
41-
{
42-
EnableRaisingEvents = true,
43-
};
44-
_watcher.Changed += FileChanged;
45-
}
35+
private Settings() { }
4636

4737
/// <summary>
4838
/// The singleton instance of the local settings file.
@@ -146,21 +136,4 @@ private static Settings LoadAndAttemptSave()
146136
return settings;
147137
}
148138

149-
/// <summary>
150-
/// Occurs after the watcher detects a change in the settings file.
151-
/// </summary>
152-
private void FileChanged(object sender, FileSystemEventArgs e)
153-
{
154-
Log.Debug($"File changed: {e.FullPath}");
155-
156-
try
157-
{
158-
Populate(this);
159-
}
160-
catch (Exception ex)
161-
{
162-
Log.Error(ex, "Failed to reload settings after the file changed");
163-
}
164-
}
165-
166139
}

0 commit comments

Comments
 (0)