Compare commits

...

1 Commits

Author SHA1 Message Date
Shawn Yuan (from Dev Box)
b71bce9c6c Prevent from winuiEx crash 2026-02-06 15:22:08 +08:00
4 changed files with 16 additions and 2 deletions

View File

@@ -8,7 +8,6 @@
IsMaximizable="False"
IsMinimizable="False"
IsResizable="False"
IsShownInSwitchers="False"
IsTitleBarVisible="False"
mc:Ignorable="d">
<Grid Background="#1A000000">

View File

@@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading.Tasks;
using Microsoft.UI.Windowing;
using Windows.Graphics;
@@ -24,6 +25,17 @@ namespace PowerDisplay.PowerDisplayXAML
{
InitializeComponent();
NumberText.Text = displayText;
try
{
this.SetIsShownInSwitchers(false);
}
catch (NotImplementedException)
{
// WinUI will throw if explorer is not running, safely ignore
}
catch (Exception)
{
}
// Configure window style
ConfigureWindow();

View File

@@ -15,7 +15,6 @@
IsMaximizable="False"
IsMinimizable="False"
IsResizable="False"
IsShownInSwitchers="False"
IsTitleBarVisible="False">
<winuiex:WindowEx.SystemBackdrop>
<DesktopAcrylicBackdrop />

View File

@@ -71,6 +71,10 @@ namespace PowerDisplay
_hotkeyService.Initialize(this);
Logger.LogTrace("MainWindow constructor: HotkeyService initialized");
Logger.LogTrace("MainWindow constructor: Setting IsShownInSwitchers property");
this.SetIsShownInSwitchers(false);
Logger.LogTrace("MainWindow constructor: Set IsShownInSwitchers property successfully");
// Note: ViewModel handles all async initialization internally.
// We listen to InitializationCompleted event to know when data is ready.
// No duplicate initialization here - single responsibility in ViewModel.