mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Installer must run in foreground thread
This commit is contained in:
parent
380f438444
commit
137ad5683d
2 changed files with 14 additions and 19 deletions
|
@ -30,7 +30,6 @@ You should have received a copy of the GNU General Public License
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace ShareX.HelpersLib
|
namespace ShareX.HelpersLib
|
||||||
|
@ -127,11 +126,12 @@ private void RunInstallerWithDelay(int delay = 1000)
|
||||||
{
|
{
|
||||||
if (RunInstallerInBackground)
|
if (RunInstallerInBackground)
|
||||||
{
|
{
|
||||||
Task.Run(() =>
|
Thread thread = new Thread(() =>
|
||||||
{
|
{
|
||||||
Thread.Sleep(delay);
|
Thread.Sleep(delay);
|
||||||
RunInstaller();
|
RunInstaller();
|
||||||
});
|
});
|
||||||
|
thread.Start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,7 +51,7 @@ public VideoThumbnailerForm(string ffmpegPath, VideoThumbnailOptions options)
|
||||||
pgOptions.SelectedObject = Options;
|
pgOptions.SelectedObject = Options;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnStart_Click(object sender, EventArgs e)
|
private async void btnStart_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string mediaPath = txtMediaPath.Text;
|
string mediaPath = txtMediaPath.Text;
|
||||||
|
|
||||||
|
@ -64,10 +64,10 @@ private void btnStart_Click(object sender, EventArgs e)
|
||||||
pbProgress.Visible = true;
|
pbProgress.Visible = true;
|
||||||
btnStart.Visible = false;
|
btnStart.Visible = false;
|
||||||
|
|
||||||
Task.Run(() =>
|
List<VideoThumbnailInfo> thumbnails = null;
|
||||||
{
|
|
||||||
List<VideoThumbnailInfo> thumbnails = null;
|
|
||||||
|
|
||||||
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
VideoThumbnailer thumbnailer = new VideoThumbnailer(mediaPath, FFmpegPath, Options);
|
VideoThumbnailer thumbnailer = new VideoThumbnailer(mediaPath, FFmpegPath, Options);
|
||||||
|
@ -78,20 +78,15 @@ private void btnStart_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ex.ShowError();
|
ex.ShowError();
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
this.InvokeSafe(() =>
|
|
||||||
{
|
|
||||||
if (thumbnails != null)
|
|
||||||
{
|
|
||||||
OnThumbnailsTaken(thumbnails);
|
|
||||||
}
|
|
||||||
|
|
||||||
btnStart.Visible = true;
|
|
||||||
pbProgress.Visible = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (thumbnails != null)
|
||||||
|
{
|
||||||
|
OnThumbnailsTaken(thumbnails);
|
||||||
|
}
|
||||||
|
|
||||||
|
btnStart.Visible = true;
|
||||||
|
pbProgress.Visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue