mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[Peek] Handle ThemeListener ctor exceptions (#27110)
This commit is contained in:
@@ -27,15 +27,22 @@ namespace Peek.UI
|
|||||||
{
|
{
|
||||||
public MainWindowViewModel ViewModel { get; }
|
public MainWindowViewModel ViewModel { get; }
|
||||||
|
|
||||||
private ThemeListener themeListener;
|
private ThemeListener? themeListener;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.Activated += PeekWindow_Activated;
|
this.Activated += PeekWindow_Activated;
|
||||||
|
|
||||||
themeListener = new ThemeListener();
|
try
|
||||||
themeListener.ThemeChanged += (_) => HandleThemeChange();
|
{
|
||||||
|
themeListener = new ThemeListener();
|
||||||
|
themeListener.ThemeChanged += (_) => HandleThemeChange();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.LogError($"HandleThemeChange exception. Please install .NET 4.", e);
|
||||||
|
}
|
||||||
|
|
||||||
ViewModel = App.GetService<MainWindowViewModel>();
|
ViewModel = App.GetService<MainWindowViewModel>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user