private void OnShufflePropertyChanged(object sender, ShuffleChangedEventArgs e) { Unsubscribe(e.OldShuffleSongs); Subscribe(e.NewShuffleSongs); ShuffleChanged?.Invoke(this, new SubscriptionsEventArgs <ISongCollection, ShuffleChangedEventArgs>(sender, e)); }
/// <summary> /// Initializes the wrapper. /// </summary> /// <param name="audioSourceDirectory">The directory of the audio source.</param> /// <returns>True if successful.</returns> public bool Initialize(string audioSourceDirectory) { try { _logger = AudioBandLogManager.GetLogger($"AudioSourceWrapper({new DirectoryInfo(audioSourceDirectory).Name})"); _logger.Debug("Initializing wrapper"); AppDomain.CurrentDomain.UnhandledException += (o, e) => _logger.Error(e.ExceptionObject as Exception, "Unhandled exception in wrapper"); _audioSource = AudioSourceLoader.LoadFromDirectory(audioSourceDirectory); _audioSource.Logger = new AudioSourceLogger(_audioSource.Name); _audioSource.SettingChanged += (o, e) => SettingChanged?.Invoke(this, e); _audioSource.TrackInfoChanged += (o, e) => TrackInfoChanged?.Invoke(this, e); _audioSource.IsPlayingChanged += (o, e) => IsPlayingChanged?.Invoke(this, e); _audioSource.TrackProgressChanged += (o, e) => TrackProgressChanged?.Invoke(this, e); _audioSource.VolumeChanged += (o, e) => VolumeChanged?.Invoke(this, e); _audioSource.ShuffleChanged += (o, e) => ShuffleChanged?.Invoke(this, e); _audioSource.RepeatModeChanged += (o, e) => RepeatModeChanged?.Invoke(this, e); _audioSourceSettingsList = _audioSource.GetSettings(); foreach (AudioSourceSetting setting in _audioSourceSettingsList) { _audioSourceSettings.Add(setting.Attribute.Name, setting); } _logger.Debug("Wrapper initialization complete"); return(true); } catch (Exception e) { _logger.Error(e); return(false); } }
private void NotifyShuffle() { bool shuffle = _itunesControls.Shuffle; if (shuffle == _shuffle) { return; } _shuffle = shuffle; ShuffleChanged?.Invoke(this, _shuffle); }
private void NotifyShuffle() { bool shuffle = _ipc.GetShuffle(); if (shuffle == _shuffle) { return; } _shuffle = shuffle; ShuffleChanged?.Invoke(this, _shuffle); }
protected virtual void OnShuffleChanged() { ShuffleChanged?.Invoke(this, EventArgs.Empty); }