Пример #1
0
        public GalleryCompactView(IEventAggregator aggregator, ViewLifetimeControl lifetime, MediaPlayer player, RemoteFileStream fileStream)
        {
            _aggregator = aggregator;
            _lifetime   = lifetime;

            _mediaPlayer = player;
            _fileStream  = fileStream;

            _aggregator.Subscribe(this);

            RequestedTheme    = ElementTheme.Dark;
            TransportControls = new MediaTransportControls
            {
                IsCompact = true,
                IsCompactOverlayButtonVisible = false,
                IsFastForwardButtonVisible    = false,
                IsFastRewindButtonVisible     = false,
                IsFullWindowButtonVisible     = false,
                IsNextTrackButtonVisible      = false,
                IsPlaybackRateButtonVisible   = false,
                IsPreviousTrackButtonVisible  = false,
                IsRepeatButtonVisible         = false,
                IsSkipBackwardButtonVisible   = false,
                IsSkipForwardButtonVisible    = false,
                IsVolumeButtonVisible         = false,
                IsStopButtonVisible           = false,
                IsZoomButtonVisible           = false,
            };
            AreTransportControlsEnabled = true;

            SetMediaPlayer(player);

            lifetime.Closed   += OnReleased;
            lifetime.Released += OnReleased;
        }
        public MusicPlayerController(IMediaPlayer musicPlayer)
        {
            foregroundAppState = AppState.Active;
            _player            = musicPlayer;
            _controllerHandler = new MusicPlayerControllerHandler();

            #region musicplayer
            _player.SeekCompleted       += _player_SeekCompleted;
            _player.MediaOpened         += _player_MediaOpened;
            _player.MediaEnded          += _player_MediaEnded;
            _player.MediaFailed         += _player_MediaFailed;
            _player.CurrentStateChanged += _player_CurrentStateChanged;
            #endregion

            #region stmc

            _mtControls                = new MediaTransportControls(_player.SystemMediaTransportControls);
            _mtControls.IsEnabled      = _mtControls.IsPauseEnabled = _mtControls.IsPlayEnabled = true;
            _mtControls.ButtonPressed += _mtControls_ButtonPressed;
            #endregion

            _playlist = new PlayList();
        }