//TODO: this does not trigger private static void SmtcManagerOnCurrentSessionChanged(GlobalSystemMediaTransportControlsSessionManager sender, CurrentSessionChangedEventArgs args) { if (_smtc != null) { _smtc.MediaPropertiesChanged -= SmtcOnMediaPropertiesChanged; _smtc.TimelinePropertiesChanged -= SmtcOnTimelinePropertiesChanged; } _smtc = sender.GetCurrentSession(); if (_smtc != null) { _smtc.MediaPropertiesChanged += SmtcOnMediaPropertiesChanged; _mediaProperties = _smtc.TryGetMediaPropertiesAsync().GetAwaiter().GetResult(); } }
private async void SMTC_CurrentSessionChanged(GlobalSystemMediaTransportControlsSessionManager smtc, CurrentSessionChangedEventArgs args) { await Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(() => { if (CurrentSession != null) { CurrentSession.MediaPropertiesChanged -= UpdateMediaProperties; } CurrentSession = smtc.GetCurrentSession(); if (CurrentSession != null) { UpdateSessionInfo(CurrentSession); CurrentSession.MediaPropertiesChanged += UpdateMediaProperties; MainButton.Visibility = Visibility.Visible; } else { MainButton.Visibility = Visibility.Collapsed; } })); }
private void OnCurrentSessionChanged(MediaControlSessionManager sender, CurrentSessionChangedEventArgs arg) { CurrentSessionChanged?.Invoke(sender, arg); }
private void OnCurrentSessionChanged(object sender, CurrentSessionChangedEventArgs e) { OnMediaChanged(new object(), MediaController.Instance.GetCurrentMediaInfo()); }
private void SessionManager_CurrentSessionChanged(GlobalSystemMediaTransportControlsSessionManager sender, CurrentSessionChangedEventArgs args) { WriteCurrentlyPlayingAsync(); AddCurrentSessionHandlers(); }
private static void GlobalSystemMediaTransportControlsSessionManager_CurrentSessionChanged(GlobalSystemMediaTransportControlsSessionManager sender, CurrentSessionChangedEventArgs args) { if (globalSystemMediaTransportControlsSession != null) { globalSystemMediaTransportControlsSession.MediaPropertiesChanged -= GlobalSystemMediaTransportControlsSession_MediaPropertiesChanged; } globalSystemMediaTransportControlsSession = globalSystemMediaTransportControlsSessionManager.GetCurrentSession(); if (globalSystemMediaTransportControlsSession != null) { globalSystemMediaTransportControlsSession.MediaPropertiesChanged += GlobalSystemMediaTransportControlsSession_MediaPropertiesChanged; } }