mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 01:36:31 +02:00
[ImageResizer] Workaround for exception in wpf ui. (#30225)
* [ImageResizer] Workaround for exception in wpf ui. * Adding try catch to the other 3 places the SystemThemeWatcher is used. Rearranging code in Image Resizer, which might solve the issue.
This commit is contained in:
@@ -7,6 +7,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Common.UI;
|
||||
using ImageResizer.ViewModels;
|
||||
using ManagedCommon;
|
||||
using Microsoft.Win32;
|
||||
using Wpf.Ui.Controls;
|
||||
using AppResources = ImageResizer.Properties.Resources;
|
||||
@@ -18,7 +19,8 @@ namespace ImageResizer.Views
|
||||
public MainWindow(MainViewModel viewModel)
|
||||
{
|
||||
DataContext = viewModel;
|
||||
Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this);
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
if (OSVersionHelper.IsWindows11())
|
||||
{
|
||||
@@ -29,7 +31,15 @@ namespace ImageResizer.Views
|
||||
WindowBackdropType = WindowBackdropType.None;
|
||||
}
|
||||
|
||||
InitializeComponent();
|
||||
// workaround for #30177
|
||||
try
|
||||
{
|
||||
Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this, WindowBackdropType);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Exception in SystemThemeWatcher.Watch, issue 30177. {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> OpenPictureFiles()
|
||||
|
||||
Reference in New Issue
Block a user