Using Html/Pdf Initializer
This commit is contained in:
@ -5,11 +5,32 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user