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