|
@@ -11,6 +11,7 @@ using PicView.Avalonia.Printing;
|
|
using PicView.Avalonia.UI;
|
|
using PicView.Avalonia.UI;
|
|
using PicView.Avalonia.ViewModels;
|
|
using PicView.Avalonia.ViewModels;
|
|
using PicView.Avalonia.Win32.Printing;
|
|
using PicView.Avalonia.Win32.Printing;
|
|
|
|
+using PicView.Core.DebugTools;
|
|
using PicView.Core.Localization;
|
|
using PicView.Core.Localization;
|
|
using PicView.Core.ViewModels;
|
|
using PicView.Core.ViewModels;
|
|
using R3;
|
|
using R3;
|
|
@@ -26,7 +27,11 @@ public partial class PrintPreviewWindow : Window
|
|
InitializeComponent();
|
|
InitializeComponent();
|
|
|
|
|
|
GenericWindowHelper.GenericWindowInitialize(this, TranslationManager.Translation.Print + " - PicView");
|
|
GenericWindowHelper.GenericWindowInitialize(this, TranslationManager.Translation.Print + " - PicView");
|
|
|
|
+ ThemeUpdates();
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ private void ThemeUpdates()
|
|
|
|
+ {
|
|
if (!Settings.Theme.Dark)
|
|
if (!Settings.Theme.Dark)
|
|
{
|
|
{
|
|
PrintPreviewView.Background = UIHelper.GetMenuBackgroundColor();
|
|
PrintPreviewView.Background = UIHelper.GetMenuBackgroundColor();
|
|
@@ -85,7 +90,7 @@ public partial class PrintPreviewWindow : Window
|
|
.AsObservable()
|
|
.AsObservable()
|
|
.DistinctUntilChanged()
|
|
.DistinctUntilChanged()
|
|
.Subscribe(_ => UpdatePrinter(vm.PrintPreview))
|
|
.Subscribe(_ => UpdatePrinter(vm.PrintPreview))
|
|
- .AddTo(vm.PrintPreview._disposables);
|
|
|
|
|
|
+ .AddTo(vm.PrintPreview.Disposables);
|
|
|
|
|
|
// Any setting change triggers preview update
|
|
// Any setting change triggers preview update
|
|
// ReSharper disable once InvokeAsExtensionMethod
|
|
// ReSharper disable once InvokeAsExtensionMethod
|
|
@@ -102,7 +107,7 @@ public partial class PrintPreviewWindow : Window
|
|
=> (orientation, top, bottom, left, right, scale, color, paper))
|
|
=> (orientation, top, bottom, left, right, scale, color, paper))
|
|
.ThrottleLast(TimeSpan.FromMilliseconds(100))
|
|
.ThrottleLast(TimeSpan.FromMilliseconds(100))
|
|
.Subscribe(_ => UpdatePreview(vm.PrintPreview))
|
|
.Subscribe(_ => UpdatePreview(vm.PrintPreview))
|
|
- .AddTo(vm.PrintPreview._disposables);
|
|
|
|
|
|
+ .AddTo(vm.PrintPreview.Disposables);
|
|
|
|
|
|
// Initial render
|
|
// Initial render
|
|
UpdatePrinter(vm.PrintPreview);
|
|
UpdatePrinter(vm.PrintPreview);
|
|
@@ -148,7 +153,9 @@ public partial class PrintPreviewWindow : Window
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
- Console.WriteLine($"[PrintPreview] Failed to reload paper sizes: {ex}");
|
|
|
|
|
|
+ DebugHelper.LogDebug(nameof(PrintPreviewView), nameof(UpdatePrinter),
|
|
|
|
+ "[PrintPreview] Failed to reload paper sizes");
|
|
|
|
+ DebugHelper.LogDebug(nameof(PrintPreviewView), nameof(UpdatePrinter), ex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -237,7 +244,7 @@ public partial class PrintPreviewWindow : Window
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
- Console.WriteLine($"[PrintPreview] UpdatePreview failed: {ex}");
|
|
|
|
|
|
+ DebugHelper.LogDebug(nameof(PrintPreviewView), nameof(UpdatePreview), ex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -274,7 +281,7 @@ public partial class PrintPreviewWindow : Window
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
- Console.WriteLine($"[PrintPreview] RunPrintAsync error: {ex}");
|
|
|
|
|
|
+ DebugHelper.LogDebug(nameof(PrintPreviewView), nameof(RunPrintAsync), ex);
|
|
}
|
|
}
|
|
finally
|
|
finally
|
|
{
|
|
{
|