private void btnStart_Click(object sender, EventArgs e) { string mediaPath = txtMediaPath.Text; if (File.Exists(mediaPath) && File.Exists(FFmpegPath)) { Options.LastVideoPath = mediaPath; pbProgress.Value = 0; pbProgress.Maximum = Options.ThumbnailCount; pbProgress.Visible = true; btnStart.Visible = false; new Thread(() => { List <VideoThumbnailInfo> thumbnails = null; try { VideoThumbnailer thumbnailer = new VideoThumbnailer(mediaPath, FFmpegPath, Options); thumbnailer.ProgressChanged += Thumbnailer_ProgressChanged; thumbnails = thumbnailer.TakeThumbnails(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "ShareXYZ - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.InvokeSafe(() => { if (thumbnails != null) { OnThumbnailsTaken(thumbnails); } btnStart.Visible = true; pbProgress.Visible = false; }); } }).Start(); } }
private void btnStart_Click(object sender, EventArgs e) { string mediaPath = txtMediaPath.Text; if (File.Exists(mediaPath) && File.Exists(FFmpegPath)) { Options.LastVideoPath = mediaPath; pbProgress.Value = 0; pbProgress.Maximum = Options.ThumbnailCount; pbProgress.Visible = true; btnStart.Visible = false; new Thread(() => { List<VideoThumbnailInfo> thumbnails = null; try { VideoThumbnailer thumbnailer = new VideoThumbnailer(mediaPath, FFmpegPath, Options); thumbnailer.ProgressChanged += Thumbnailer_ProgressChanged; thumbnails = thumbnailer.TakeThumbnails(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "ShareXYZ - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.InvokeSafe(() => { if (thumbnails != null) { OnThumbnailsTaken(thumbnails); } btnStart.Visible = true; pbProgress.Visible = false; }); } }).Start(); } }