From 481623e07418dd740e23df2a77a30f7ef272d618 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 6 Feb 2017 15:33:18 -0500 Subject: [PATCH] OSFT-ifying part 1.1: fix threading issue --- ShiftOS_TheReturn/Commands.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 455da27..1976ce3 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -54,7 +54,10 @@ namespace ShiftOS.Engine [Command("show")] public static bool ShowInfo(Dictionary args) { - Infobox.Show(args["title"].ToString(), args["msg"].ToString()); + Desktop.InvokeOnWorkerThread(new Action(() => + { + Infobox.Show(args["title"].ToString(), args["msg"].ToString()); + })); return true; } @@ -71,7 +74,11 @@ namespace ShiftOS.Engine Console.WriteLine($"{SaveSystem.CurrentSave.Username} says {resultFriendly}."); TerminalBackend.IsForwardingConsoleWrites = false; }; - Infobox.PromptYesNo(args["title"].ToString(), args["msg"].ToString(), callback); + Desktop.InvokeOnWorkerThread(new Action(() => + { + Infobox.PromptYesNo(args["title"].ToString(), args["msg"].ToString(), callback); + + })); return true; } @@ -87,8 +94,11 @@ namespace ShiftOS.Engine Console.WriteLine($"{SaveSystem.CurrentSave.Username} says \"{result}\"."); TerminalBackend.IsForwardingConsoleWrites = false; }; - Infobox.PromptText(args["title"].ToString(), args["msg"].ToString(), callback); - return true; + Desktop.InvokeOnWorkerThread(new Action(() => + { + Infobox.PromptText(args["title"].ToString(), args["msg"].ToString(), callback); + })); + return true; } }