From ac4026571e798b3d5bd2edab0735f3f97b5c7b4a Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Sat, 2 Mar 2024 20:12:36 +0100 Subject: [PATCH] Printing/Pdf: Wait 1 sec for process to initialize --- Elwig/Helpers/Printing/Pdf.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Elwig/Helpers/Printing/Pdf.cs b/Elwig/Helpers/Printing/Pdf.cs index 1992493..fab4ee5 100644 --- a/Elwig/Helpers/Printing/Pdf.cs +++ b/Elwig/Helpers/Printing/Pdf.cs @@ -26,7 +26,7 @@ namespace Elwig.Helpers.Printing { private static Process? WinziPrintProc; public static bool IsReady => WinziPrintProc != null; - public static Task Init(Action? evtHandler = null) { + public static async Task Init(Action? evtHandler = null) { // NOTE: If the WinziPrint daemon is already running this will succeed, but the process will fail. // Should be no problem, as long as the daemon is not closed var p = new Process() { StartInfo = new() { @@ -38,9 +38,9 @@ namespace Elwig.Helpers.Printing { p.StartInfo.ArgumentList.Add("-d"); p.StartInfo.ArgumentList.Add(App.TempPath); p.Start(); + await Task.Delay(1000); WinziPrintProc = p; evtHandler?.Invoke(); - return Task.CompletedTask; } public static Task Cleanup() {