桌面端原材料入场记录完善
This commit is contained in:
@@ -17,7 +17,7 @@ public static class HtmlToPdfRenderer
|
||||
{
|
||||
var tcs = new TaskCompletionSource<string>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
|
||||
Application.Current.Dispatcher.InvokeAsync(async () =>
|
||||
Application.Current?.Dispatcher.InvokeAsync(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -30,6 +30,11 @@ public static class HtmlToPdfRenderer
|
||||
}
|
||||
});
|
||||
|
||||
if (Application.Current == null)
|
||||
{
|
||||
tcs.TrySetException(new InvalidOperationException("WPF Application 未初始化,无法生成 PDF"));
|
||||
}
|
||||
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user