From bf100ab099e7335711ea739cb10a4a9df4b89dc5 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 2 Feb 2017 17:35:01 -0500 Subject: [PATCH] Fix threading issues with Shiftnet downloader routine --- ShiftOS.WinForms/Applications/Shiftnet.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index 6f99d25..986eec6 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -126,10 +126,12 @@ namespace ShiftOS.WinForms.Applications var bytes = JsonConvert.DeserializeObject(msg.Contents); string destPath = null; string ext = Url.Split('.')[Url.Split('.').Length - 1]; - - FileSkimmerBackend.GetFile(new[] { ext }, FileOpenerStyle.Save, new Action((file) => + this.Invoke(new Action(() => { - destPath = file; + FileSkimmerBackend.GetFile(new[] { ext }, FileOpenerStyle.Save, new Action((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; } };