Beispiel #1
0
        /// <summary>
        /// Static method to create an instance of SettingsManager
        /// </summary>
        /// <param name="storage"></param>
        /// <param name="settingCollections"></param>
        /// <returns>An initialized SettingsManager object, with all latest values from storage</returns>
        public static SettingsManager CreateSettingsManager(ISettingsStorage storage, List <SettingsCollectionBase> settingCollections)
        {
            if (_storage == null)
            {
                // ToDo : If lock is needed here ?
                _storage = storage;
            }

            if (_settingsCollections == null)
            {
                // ToDo : If lock is needed here ?
                _settingsCollections = new List <SettingsCollectionBase>();
            }

            var mgr = new SettingsManager(storage, settingCollections);

            // Perform the loading of settings from storage for existing
            if (storage.IsReady())
            {
                mgr.GenerateCollectionsFromDTOs(storage.ReadAll());
            }

            return(mgr);
        }
Beispiel #2
0
 /// <summary>
 /// Load all settings from storage
 /// </summary>
 /// <returns></returns>
 private List <SettingsCollectionDTO> LoadFromStorage()
 {
     return(_storage.ReadAll());
 }