Esempio n. 1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            string mediaPath = txtMediaPath.Text;

            if (File.Exists(mediaPath) && File.Exists(FFmpegPath))
            {
                VideoThumbnailer thumbnailer = new VideoThumbnailer(mediaPath, FFmpegPath, Options);
                thumbnailer.ProgressChanged += Thumbnailer_ProgressChanged;
                pbProgress.Value = 0;
                pbProgress.Maximum = Options.ScreenshotCount;
                pbProgress.Visible = true;
                btnStart.Visible = false;
                BackgroundWorker bw = new BackgroundWorker();
                bw.DoWork += (sender2, e2) => thumbnailer.TakeScreenshots();
                bw.RunWorkerCompleted += (sender3, e3) =>
                {
                    btnStart.Visible = true;
                    pbProgress.Visible = false;
                };
                bw.RunWorkerAsync();
            }
        }
Esempio n. 2
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            string mediaPath = txtMediaPath.Text;

            if (File.Exists(mediaPath) && File.Exists(FFmpegPath))
            {
                VideoThumbnailer thumbnailer = new VideoThumbnailer(mediaPath, FFmpegPath, Options);
                thumbnailer.ProgressChanged += Thumbnailer_ProgressChanged;
                pbProgress.Value = 0;
                pbProgress.Maximum = Options.ScreenshotCount;
                pbProgress.Visible = true;
                btnStart.Visible = false;

                new Thread(() =>
                {
                    List<VideoThumbnailInfo> screenshots = thumbnailer.TakeScreenshots();

                    if (screenshots != null && screenshots.Count > 0)
                    {
                        this.InvokeSafe(() =>
                        {
                            btnStart.Visible = true;
                            pbProgress.Visible = false;

                            if (Options.UploadScreenshots)
                            {
                                screenshots.ForEach(x => OnUploadRequested(x.Filepath));
                            }
                        });
                    }
                }).Start();
            }
        }