Example #1
0
        /// <summary>
        /// Gets a Media Player.
        /// </summary>
        /// <param name="playerID">The ID of the Media Player.</param>
        /// <returns>The Media Player object.</returns>
        public static MediaPlayer Get(int playerId)
        {
            //Get the player for the provided PlayerID.
            List <MediaPlayer> playerList = LoadListFromReader(DBMediaPlayer.Select(playerId));


            //Make sure there was data found for the provided PlayerID.
            if (playerList.Count > 0)
            {
                MediaPlayer player = playerList[0];
                //There was data found, so populate the Media Tracks for the Player.
                player.MediaTracks = MediaTrack.GetForPlayer(player.PlayerId);

                return(player);
            }
            //else
            //{
            //    //The instance of the player was not located, present an exception.
            //    throw new ArgumentException("The Player ID of '" + playerID.ToString() + "' was not found.");
            //}

            //return thePlayer;

            return(null);
        }
Example #2
0
        /// <summary>
        /// Gets a Media Player associated to a Module.
        /// </summary>
        /// <param name="moduleID">The ID of the Module.</param>
        /// <returns>The MediaPlayer object.</returns>
        public static MediaPlayer GetForModule(int moduleId)
        {
            //Gets the player for the provided ModuleID
            List <MediaPlayer> playerList = LoadListFromReader(DBMediaPlayer.SelectByModule(moduleId));

            //Make sure there was data found for the provided ModuleID
            if (playerList.Count > 0)
            {
                MediaPlayer mediaPlayer = playerList[0];
                //The Player exists, so populate the Media Tracks for the Player.
                mediaPlayer.MediaTracks = MediaTrack.GetForPlayer(mediaPlayer.PlayerId);
                return(mediaPlayer);
            }

            return(null);
        }