public static void LoadConfig() { ConfigMigrator.UpdateToVersion4(); if (autoSaveTimer != null) { autoSaveTimer.Stop(); } if (!firstRun) { try { string jsonText = File.ReadAllText("settings.json"); settings = JsonConvert.DeserializeObject <AppConfig>(jsonText); } catch (JsonReaderException) { MessageDialog.ShowWarning("Your WinDynamicDesktop configuration file was corrupt and has been " + "reset to the default settings.", "Warning"); firstRun = true; } } unsavedChanges = false; autoSaveTimer = new Timer(); autoSaveTimer.AutoReset = false; autoSaveTimer.Interval = 1000; settings.PropertyChanged += OnSettingsPropertyChanged; autoSaveTimer.Elapsed += OnAutoSaveTimerElapsed; }