public static void SaveToStorage(ScreenShakeSettings settings, IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            var store = GetSettingsStore(serviceProvider);

            SetOption(store, SCREEN_SHAKE_SETTINGS_CATELOG, nameof(ScreenShakeSettings.MinIntensity), settings.MinIntensity);
            SetOption(store, SCREEN_SHAKE_SETTINGS_CATELOG, nameof(ScreenShakeSettings.MaxIntensity), settings.MaxIntensity);
        }
        public static ScreenShakeSettings GetScreenShakeSettings(IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }

            ScreenShakeSettings screenShakeSettingsCache = null;
            var store = GetSettingsStore(serviceProvider);

            screenShakeSettingsCache = new ScreenShakeSettings();
            screenShakeSettingsCache.MinIntensity = GetIntegerOption(store, SCREEN_SHAKE_SETTINGS_CATELOG, nameof(ScreenShakeSettings.MinIntensity)).GetValueOrDefault(screenShakeSettingsCache.MinIntensity);
            screenShakeSettingsCache.MaxIntensity = GetIntegerOption(store, SCREEN_SHAKE_SETTINGS_CATELOG, nameof(ScreenShakeSettings.MaxIntensity)).GetValueOrDefault(screenShakeSettingsCache.MaxIntensity);

            return(screenShakeSettingsCache);
        }
Ejemplo n.º 3
0
 public void CloneFrom(ScreenShakeSettings other)
 {
     this.MinIntensity = other.MinIntensity;
     this.MaxIntensity = other.MaxIntensity;
 }