Example #1
0
        /// <summary>
        /// Can be used to initialize an optional Settings field.
        /// </summary>
        /// <param name="settingsFieldFullName">full name of Settings field; it equals to the name of its storage file without extention</param>
        /// <param name="throwExceptionIfCouldNotLoadFromStorageFile"></param>
        public static void Reload(string settingsFieldFullName, bool throwExceptionIfCouldNotLoadFromStorageFile = false)
        {
            SettingsFieldInfo sfi = GetSettingsFieldInfo(settingsFieldFullName);
            Settings          s   = Settings.Create(sfi, false, throwExceptionIfCouldNotLoadFromStorageFile);

            sfi.SetObject(s);
        }
Example #2
0
        //// ???what would it be needed for?
        //public static S CreateResetInstance<S>(string settingsFieldFullName) where S : Settings, new()
        //{
        //    return (S)Settings.Create(GetSettingsFieldInfo(settingsFieldFullName), true, true);
        //}

        //// ???what would it be needed for?
        //public static S CreateReloadedInstance<S>(string settingsFieldFullName, bool throwExceptionIfCouldNotLoadFromStorageFile = false) where S : Settings, new()
        //{
        //    return (S)Settings.Create(GetSettingsFieldInfo(settingsFieldFullName), false, throwExceptionIfCouldNotLoadFromStorageFile);
        //}

        /// <summary>
        /// Can be used to initialize an optional Settings field.
        /// </summary>
        /// <param name="settingsFieldFullName">full name of Settings field; it equals to the name of its storage file without extention</param>
        public static void Reset(string settingsFieldFullName)
        {
            SettingsFieldInfo sfi = GetSettingsFieldInfo(settingsFieldFullName);
            Settings          s   = Settings.Create(sfi, true, true);

            sfi.SetObject(s);
        }