Printing: Show message box when error in printing process occurs
This commit is contained in:
@ -74,12 +74,16 @@ namespace Elwig.Helpers.Printing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static async Task Print(string path, int copies = 1) {
|
public static async Task Print(string path, int copies = 1) {
|
||||||
var p = new Process() { StartInfo = new() { FileName = PdfToPrinter } };
|
try {
|
||||||
p.StartInfo.ArgumentList.Add(path);
|
var p = new Process() { StartInfo = new() { FileName = PdfToPrinter } };
|
||||||
p.StartInfo.ArgumentList.Add("/s");
|
p.StartInfo.ArgumentList.Add(path);
|
||||||
p.StartInfo.ArgumentList.Add($"copies={copies}");
|
p.StartInfo.ArgumentList.Add("/s");
|
||||||
p.Start();
|
p.StartInfo.ArgumentList.Add($"copies={copies}");
|
||||||
await p.WaitForExitAsync();
|
p.Start();
|
||||||
|
await p.WaitForExitAsync();
|
||||||
|
} catch (Exception e) {
|
||||||
|
MessageBox.Show("Beim Drucken ist ein Fehler aufgetreten:\n\n" + e.Message, "Fehler beim Drucken");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user