37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
|
|
namespace WGneu {
|
|
public partial class App : Application {
|
|
|
|
public static bool IsPrintingReady => Documents.Html.IsReady && Documents.Pdf.IsReady;
|
|
|
|
public App() : base() {
|
|
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
|
}
|
|
|
|
public void App_Startup(object sender, EventArgs e) {
|
|
Task.Run(() => Documents.Html.Init(PrintingReadyChanged));
|
|
Task.Run(() => Documents.Pdf.Init(PrintingReadyChanged));
|
|
}
|
|
|
|
private void PrintingReadyChanged() {
|
|
Dispatcher.BeginInvoke(App_PrintingReadyChanged, this, new EventArgs());
|
|
}
|
|
|
|
private void App_PrintingReadyChanged(object sender, EventArgs e) {
|
|
foreach (Window w in Windows) {
|
|
foreach (var b in Utils.FindVisualChilds<Button>(w).Where(b => "Print".Equals(b.Tag))) {
|
|
b.IsEnabled = IsPrintingReady;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|