Printing/Pdf: Wait 1 sec for process to initialize

This commit is contained in:
2024-03-02 20:12:36 +01:00
parent fb28ce5006
commit ac4026571e

View File

@ -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() {