Пример #1
0
        private void Stmp_ButtonPressed(Windows.Media.SystemMediaTransportControls sender, Windows.Media.SystemMediaTransportControlsButtonPressedEventArgs args)
        {
            switch (args.Button)
            {
            case Windows.Media.SystemMediaTransportControlsButton.Play:
                mediaplayer.Play();
                break;

            case Windows.Media.SystemMediaTransportControlsButton.Pause:
                mediaplayer.Pause();
                break;

            case SystemMediaTransportControlsButton.Next:
                Next(sender, mediaplayer);
                break;

            case SystemMediaTransportControlsButton.Previous:
                Previous(sender, mediaplayer);
                break;

            default:
                break;
            }
        }
Пример #2
0
 async private void MediaButtonPressed(SystemMediaTransportControls sender, ButtonArgs args)
 {
     await Play(args.Button);
 }
Пример #3
0
        private void SystemMediaTransportControls_ButtonPressed(Windows.Media.SystemMediaTransportControls sender, Windows.Media.SystemMediaTransportControlsButtonPressedEventArgs args)
        {
            var vs = new ValueSet();

            switch (args.Button)
            {
            case SystemMediaTransportControlsButton.Play:
                BackgroundMediaPlayer.Current.Play();
                vs.Add("state", "play");
                BackgroundMediaPlayer.SendMessageToForeground(vs);
                break;

            case SystemMediaTransportControlsButton.Pause:
                BackgroundMediaPlayer.Current.Pause();
                vs.Add("state", "pause");
                BackgroundMediaPlayer.SendMessageToForeground(vs);
                break;
            }
        }