示例#1
0
        private void _restoreMediaVolumes()
        {
            var volumes = Properties.Settings.Default.MediaVolumes.Split(';')
                          .Select(vol => vol.Split('=')).ToDictionary(vol => vol[0], vol => Convert.ToDouble(vol.ElementAtOrDefault(1)));

            MediaViewModels.ForEach(mvm => { if (volumes.ContainsKey(mvm.Media.Name))
                                             {
                                                 mvm.Volume = volumes[mvm.Media.Name];
                                             }
                                    });
        }
示例#2
0
        public CurrentSoundViewModel()
        {
            MediaViewModels = _allMedia.Select(m => new MediaViewModel(m)).ToList();
            MediaViewModels.ForEach(mvm => mvm.PropertyChanged +=
                                        (s, e) => { if (e.PropertyName == "Volume")
                                                    {
                                                        _updateVolume((MediaViewModel)s); _saveMediaVolumes();
                                                    }
                                    });
            Properties.Settings.Default.PropertyChanged +=
                (s, e) => { if (e.PropertyName == "GlobalVolume")
                            {
                                _updateGlobalVolume();
                            }
            };

            _restoreMediaVolumes();
            _updateGlobalVolume();
            IsPlaying = Properties.Settings.Default.PlayOnLaunch;
        }
示例#3
0
 private void _updateGlobalVolume()
 {
     _volume = Properties.Settings.Default.GlobalVolume;
     MediaViewModels.ForEach(_updateVolume);
 }