示例#1
0
        public async Task <double> GetVolume()
        {
            var virtualVolume = GetVirtualVolumeService();

            if (virtualVolume != null)
            {
                return(await virtualVolume.GetVolume());
            }

            if (!await Preferences.Contains(PREFERENCES_KEY_VOLUME_DUMMY))
            {
                return(Constants.VOLUME_MAX);
            }
            return(await Preferences.Get(PREFERENCES_KEY_VOLUME_DUMMY));
        }
示例#2
0
        public async Task <double> GetVolume()
        {
            if (!double.IsFinite(Volume))
            {
                if (await Preferences.Contains(PREFERENCES_KEY_VOLUME))
                {
                    Volume = await Preferences.Get(PREFERENCES_KEY_VOLUME);

                    Volume = Util.Volume.Limit(Volume);
                }
                else
                {
                    Volume = Constants.VOLUME_MAX;
                }
            }

            return(Volume);
        }
示例#3
0
        // <summary>
        // Return the setting object for the specified key.  It's assumed that the caller knows
        // the type object that will be returned.
        // </summary>
        public static object Get(string key)
        {
            object val = null;

            try {
                val = provider.Get(key);
            } catch {
                Logger.Info("Saved preference not found for {0}.", key);
            }

            if (val == null)
            {
                object defaultValue = GetDefault(key);
                if (defaultValue != null)
                {
                    Logger.Info("Setting a default value for {0}.", key);
                    Set(key, defaultValue);
                }

                return(defaultValue);
            }

            return(val);
        }