Fix threading issues with Shiftnet downloader routine

This commit is contained in:
Michael 2017-02-02 17:35:01 -05:00
parent d5ab22629b
commit bf100ab099

View file

@ -126,10 +126,12 @@ namespace ShiftOS.WinForms.Applications
var bytes = JsonConvert.DeserializeObject<byte[]>(msg.Contents);
string destPath = null;
string ext = Url.Split('.')[Url.Split('.').Length - 1];
FileSkimmerBackend.GetFile(new[] { ext }, FileOpenerStyle.Save, new Action<string>((file) =>
this.Invoke(new Action(() =>
{
destPath = file;
FileSkimmerBackend.GetFile(new[] { ext }, FileOpenerStyle.Save, new Action<string>((file) =>
{
destPath = file;
}));
}));
while (string.IsNullOrEmpty(destPath))
{
@ -143,7 +145,10 @@ namespace ShiftOS.WinForms.Applications
Progress = 0,
};
DownloadManager.StartDownload(d);
AppearanceManager.SetupWindow(new Downloader());
this.Invoke(new Action(() =>
{
AppearanceManager.SetupWindow(new Downloader());
}));
ServerManager.MessageReceived -= smr;
}
};