/// <summary> /// Constructor for the DisplayPresetCollection singleton. Initializes the /// collection of presets with presets saved in the configuration file. /// </summary> private DisplayPresetCollection() { mDisplayPresetDictionary = new Dictionary <string, DisplayPreset>(StringComparer.CurrentCultureIgnoreCase); // RAII baby, load it up List <DisplayPreset> displayPresets = DisplayPersistence.LoadPresets(); if (displayPresets != null) { foreach (DisplayPreset preset in displayPresets) { mDisplayPresetDictionary.Add(preset.Name, preset); } } DisplayPresetCollectionChanged += OnDisplayPresetCollectionChanged; }
/// <summary> /// Writes current collection of display presets to disk if changes have been made. /// </summary> private void PersistDisplayPresets() { DisplayPersistence.WritePresets(this.GetPresets()); }