Esempio n. 1
0
 //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();
     }
 }
Esempio n. 2
0
 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;
         }
     }));
 }
Esempio n. 3
0
 private void OnCurrentSessionChanged(MediaControlSessionManager sender, CurrentSessionChangedEventArgs arg)
 {
     CurrentSessionChanged?.Invoke(sender, arg);
 }
Esempio n. 4
0
 private void OnCurrentSessionChanged(object sender, CurrentSessionChangedEventArgs e)
 {
     OnMediaChanged(new object(), MediaController.Instance.GetCurrentMediaInfo());
 }
Esempio n. 5
0
 private void SessionManager_CurrentSessionChanged(GlobalSystemMediaTransportControlsSessionManager sender, CurrentSessionChangedEventArgs args)
 {
     WriteCurrentlyPlayingAsync();
     AddCurrentSessionHandlers();
 }
Esempio n. 6
0
        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;
            }
        }