private void play_VideoExited(object sender, MplayerEvent e)
        {
            btnPlay.Image = MediaPlayer.Properties.Resources.play;
            this._play.Stop();
            this.ResetTime();

            if (this._playOnceAndClose == true)
            {
                try
                {

                    this.Invoke(new MethodInvoker(Close));
                }
                catch (Exception ex)
                {
                    Logging.Instance.WriteLine(ex);
                }
            }
        }
        private void _play_CurrentPosition(object sender, MplayerEvent e)
        {
            // handle current postion event.  Display the current postion and update trackbar.

            SetExactTime(e.Value);

            float videoLength = (float)this._play.CurrentPlayingFileLength();
            if (videoLength == 0f)
            {
                return;
            }

            int percent = (int)(((float)this._currentTime / videoLength) * 100);

            if (percent >= 100)
            {
                percent = 100;
            }

            if (this._trackBarMousePushedDown == false)
            {
                this.Invoke((MethodInvoker)delegate
                {
                    trackBar1.Value = percent;
                });
            }
        }
 void VideoExited(object sender, MplayerEvent e)
 {
     //If we're at the end of the file, raise the event that the track's finished.
     //we need to do this check because the 'VideoExited' event is raised whenever the video is stopped, not just when it's reached
     //the end.
     if (CurrentTrack.Length.TotalSeconds - CurrentPlayPosition.TotalSeconds <= 2)
     {
         if (this.TrackFinished != null)
         {
             this.TrackFinished(this, new EventArgs());
         }
     }
     else
     {
         Stop();
     }
 }