/// <summary>
        /// Uses specified player business object to play the session.
        /// </summary>
        /// <param name="player">The player business object through which to play the session.</param>
        public void SetPlayer(IMediaPlayerBusiness player)
        {
            player.SetPath();
            if (this.player != null)
            {
                player.AllowClose = this.player.AllowClose;
                if (this.player.CurrentVideo != null)
                {
                    player.CurrentVideo = this.player.CurrentVideo;
                }
            }

            // If changing player, close the previous one.
            if (this.player != null)
            {
                this.player.Close();
            }

            this.player        = player;
            player.PlayNext   += player_PlayNext;
            player.NowPlaying += player_NowPlaying;
            player.Pause      += player_Pause;
            player.Resume     += player_Resume;

            if (player.CurrentVideo != null)
            {
                player.PlayVideoAsync(player.CurrentVideo, false);
            }
        }
Esempio n. 2
0
        private async Task PlayVideo(Media video)
        {
            await Player.PlayVideoAsync(video, false);

            await Task.Delay(500);

            this.Activate();
        }
        /// <summary>
        /// Uses specified player business object to play the session.
        /// </summary>
        /// <param name="player">The player business object through which to play the session.</param>
        public void SetPlayer(IMediaPlayerBusiness player) {
            player.SetPath();
            if (this.player != null) {
                player.AllowClose = this.player.AllowClose;
                if (this.player.CurrentVideo != null)
                    player.CurrentVideo = this.player.CurrentVideo;
            }

            // If changing player, close the previous one.
            if (this.player != null)
                this.player.Close();

            this.player = player;
            player.PlayNext += player_PlayNext;
            player.NowPlaying += player_NowPlaying;
            player.Pause += player_Pause;
            player.Resume += player_Resume;

            if (player.CurrentVideo != null)
                player.PlayVideoAsync(player.CurrentVideo);
        }