Beispiel #1
0
        /// <summary>
        /// Event for watching when videos finish
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MediaPlayer_MediaEnded(object sender, RoutedEventArgs e)
        {
            // Get the current video path
            string file = this.MediaPlayer.Source.LocalPath;

            // Try to stop it and set the source to null
            try
            {
                this.MediaPlayer.Stop();
            }
            catch { }
            this.MediaPlayer.Source = null;
            // Try to dump the file and set the string storing previous song to where we stored this
            try
            {
                if (videofile != null)
                {
                    if (videofile != string.Empty)
                    {
                        if (System.IO.Path.GetFileName(videofile) != System.IO.Path.GetFileName(this.MediaPlayer.Source.AbsoluteUri))
                        {
                            Task.Run(() => FileFunctions.DeleteTmpFile(file));
                        }
                    }
                }
                videofile = this.MediaPlayer.Source.OriginalString;
            }
            catch { }
            // Queue the next song and hit play
            SongFunctions.Queueevent(this, hidb, db, discordclient, conf);
            this.MediaPlayer.Play();
        }
Beispiel #2
0
 /// <summary>
 /// Function to trigger the next song
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PlayNext_Click(object sender, RoutedEventArgs e)
 {
     SongFunctions.Queueevent(this, hidb, db, discordclient, conf);
 }