示例#1
0
 private void SetExactTime(int newTime)
 {
     this.Invoke((MethodInvoker) delegate
     {
         this._currentTime     = newTime;
         lblVideoPosition.Text = TimeConversion.ConvertTimeHHMMSS(this._currentTime);
     });
 }
示例#2
0
 private void SetTime(int timeInSecondsAdded)
 {
     this.Invoke((MethodInvoker) delegate
     {
         this._currentTime    += timeInSecondsAdded;
         lblVideoPosition.Text = TimeConversion.ConvertTimeHHMMSS(this._currentTime);
     });
 }
示例#3
0
        private async void btnPlay_Click(object sender, EventArgs e)
        {

            if (this._play.CurrentStatus != MediaStatus.Stopped)
            {
                if (this._play.CurrentStatus == MediaStatus.Paused)
                {
                    // Is currently paused so start playing file and set the image to the pause image.
                    btnPlay.Image = MediaPlayer.Properties.Resources.pause;
                }
                if (this._play.CurrentStatus == MediaStatus.Playing)
                {
                    // Is currently playing a file so pause it and set the image to the play image.
                    btnPlay.Image = MediaPlayer.Properties.Resources.play;
                }

                this._play.Pause();

                return;
                
            }

            if (this._filePath == String.Empty || this._filePath == null)
            {

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    this._filePath = openFileDialog1.FileName;
                }
                else
                {
                    MessageBox.Show("You must select a video file.", "Select a file", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            _videoSettings = new Discover(this._filePath, MediaPlayer.Properties.Settings.Default.MPlayerPath);
            await _videoSettings.ExecuteAsync();
            this._play.Play(this._filePath);
            lblVideoLength.Text = TimeConversion.ConvertTimeHHMMSS(_videoSettings.Length);

            btnPlay.Image = MediaPlayer.Properties.Resources.pause;

            comboBoxAudioTracks.DisplayMember = "Name";
            comboBoxAudioTracks.ValueMember = "ID";
            comboBoxAudioTracks.DataSource = _videoSettings.AudioTracks;


            comboBoxSubtitles.DisplayMember = "Name";
            comboBoxSubtitles.ValueMember = "ID";
            comboBoxSubtitles.DataSource = _videoSettings.SubtitleList;

        }
示例#4
0
 private void ResetTime()
 {
     try
     {
         this.Invoke((MethodInvoker) delegate
         {
             this._currentTime     = 0;
             lblVideoPosition.Text = TimeConversion.ConvertTimeHHMMSS(this._currentTime);
             trackBar1.Value       = 0;
         });
     }
     catch (Exception ex)
     {
         Logging.Instance.WriteLine(ex);
     }
 }