/// <summary> /// Save on close /// </summary> public void CloseAudioband() { _appSettings.Save(); try { _currentAudioSource?.DeactivateAsync(); } catch (Exception) { // ignore } }
private async Task UnsubscribeToAudioSource(IAudioSource source) { if (source == null) { return; } source.TrackInfoChanged -= AudioSourceOnTrackInfoChanged; source.TrackPlaying -= AudioSourceOnTrackPlaying; source.TrackPaused -= AudioSourceOnTrackPaused; source.TrackProgressChanged -= AudioSourceOnTrackProgressChanged; _audioSourceTokenSource.Cancel(); await source.DeactivateAsync(); _settingsManager.AudioSource = null; }
private async Task UnsubscribeToAudioSource(IAudioSource source) { if (source == null) { return; } source.TrackInfoChanged -= AudioSourceOnTrackInfoChanged; source.TrackPlaying -= AudioSourceOnTrackPlaying; source.TrackPaused -= AudioSourceOnTrackPaused; source.TrackProgressChanged -= AudioSourceOnTrackProgressChanged; _audioSourceTokenSource.Cancel(); await source.DeactivateAsync(); _appSettings.AudioSource = null; _currentAudioSource = null; ResetTrack(); Logger.Debug($"Audio source `{source.Name}` deactivated"); }
private async Task UnsubscribeToAudioSource(IAudioSource source) { if (source == null) { Logger.Warn("Tried unsubscribing to audio source but it was null"); return; } source.TrackInfoChanged -= AudioSourceOnTrackInfoChanged; source.IsPlayingChanged -= AudioSourceOnIsPlayingChanged; source.TrackProgressChanged -= AudioSourceOnTrackProgressChanged; Logger.Debug("Deactivating audio source {name}", source.Name); await source.DeactivateAsync().ConfigureAwait(false); _appSettings.AudioSource = null; _currentAudioSource = null; ResetTrack(); Logger.Debug("Audio source {name} deactivated", source.Name); }
/// <summary> /// Save on close /// </summary> protected override void OnClose() { base.OnClose(); _appSettings.Save(); _currentAudioSource.DeactivateAsync(); }