App: Remove IsPrintingReady

This commit is contained in:
2024-03-04 21:43:13 +01:00
parent e9d0eec3bd
commit 77cf47e154
6 changed files with 12 additions and 39 deletions

View File

@ -60,7 +60,6 @@ namespace Elwig {
public static IList<IEventScale> EventScales => Scales.Where(s => s is IEventScale).Cast<IEventScale>().ToList();
public static ClientParameters Client { get; set; }
public static bool IsPrintingReady => Html.IsReady && Pdf.IsReady;
public static Dispatcher MainDispatcher { get; private set; }
public App() : base() {
@ -119,8 +118,8 @@ namespace Elwig {
return Task.CompletedTask;
});
Utils.RunBackground("HTML Initialization", () => Html.Init(PrintingReadyChanged));
Utils.RunBackground("PDF Initialization", () => Pdf.Init(PrintingReadyChanged));
Utils.RunBackground("HTML Initialization", () => Html.Init());
Utils.RunBackground("PDF Initialization", () => Pdf.Init());
Utils.RunBackground("JSON Schema Initialization", BillingData.Init);
if (Config.UpdateAuto && Config.UpdateUrl != null) {
@ -181,21 +180,6 @@ namespace Elwig {
BranchMobileNr = entry.Item8;
}
private void PrintingReadyChanged() {
Dispatcher.BeginInvoke(OnPrintingReadyChanged, new EventArgs());
}
protected void OnPrintingReadyChanged(EventArgs evt) {
foreach (Window w in Windows) {
foreach (var b in ControlUtils.FindAllChildren<Button>(w).Where(b => b.Tag?.ToString() == "Print")) {
b.IsEnabled = IsPrintingReady;
}
foreach (var i in ControlUtils.FindAllChildren<MenuItem>(w).Where(i => i.Tag?.ToString() == "Print")) {
i.IsEnabled = IsPrintingReady;
}
}
}
public static async Task HintContextChange() {
foreach (Window w in CurrentApp.Windows) {
if (w is not ContextWindow c) continue;