コード例 #1
0
 public static MediaPlayerState GetPlayerState(this MediaPlayer player)
 {
     MediaPlayerState result = new MediaPlayerState();
     result.Position = player.Position;
     result.IsPaused = player.CurrentState == MediaElementState.Paused;
     PlaylistPlugin playlistPlugin = player.Plugins.OfType<PlaylistPlugin>().FirstOrDefault();
     if(playlistPlugin != null) {
         result.PlaylistItemIndex = playlistPlugin.CurrentPlaylistItemIndex; }
     return result;
 }
コード例 #2
0
 public static void RestorePlayerState(this MediaPlayer player, MediaPlayerState state)
 {
     if(state == null) {
         throw new ArgumentNullException("state"); }
     player.StartupPosition = state.Position;
     player.AutoPlay = !state.IsPaused;
     player.AutoLoad = true;
     PlaylistPlugin playlistPlugin = player.Plugins.OfType<PlaylistPlugin>().FirstOrDefault();
     if(playlistPlugin != null) {
         playlistPlugin.StartupPlaylistItemIndex = state.PlaylistItemIndex; }
 }
コード例 #3
0
        public static MediaPlayerState GetPlayerState(this MediaPlayer player)
        {
            MediaPlayerState result = new MediaPlayerState();

            result.Position = player.Position;
            result.IsPaused = player.CurrentState == MediaElementState.Paused;
            PlaylistPlugin playlistPlugin = player.Plugins.OfType <PlaylistPlugin>().FirstOrDefault();

            if (playlistPlugin != null)
            {
                result.PlaylistItemIndex = playlistPlugin.CurrentPlaylistItemIndex;
            }
            return(result);
        }
コード例 #4
0
        public static void RestorePlayerState(this MediaPlayer player, MediaPlayerState state)
        {
            if (state == null)
            {
                throw new ArgumentNullException("state");
            }
            player.StartupPosition = state.Position;
            player.AutoPlay        = !state.IsPaused;
            player.AutoLoad        = true;
            PlaylistPlugin playlistPlugin = player.Plugins.OfType <PlaylistPlugin>().FirstOrDefault();

            if (playlistPlugin != null)
            {
                playlistPlugin.StartupPlaylistItemIndex = state.PlaylistItemIndex;
            }
        }