Beispiel #1
0
        /// <summary>
        /// Adds a file to the playlist
        /// </summary>
        /// <param name="filePath"></param>
        public void AddFileToPlaylist(string filePath, int index)
        {
            // create audio file object
            AudioFile audioFile = MediaFile.GetMediaFileByFilename(filePath) as AudioFile;

            // if successful, add to collection
            if (audioFile != null)
            {
                // check if the file should be added to the end of the playlist or somewhere in the middle
                if (index < AudioFiles.Count)
                {
                    AudioFiles.Insert(index, audioFile);
                }
                else
                {
                    AudioFiles.Add(audioFile);
                }
            }
        }