File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ public sealed partial class MainWindow : WinUIEx.WindowEx
2020
2121 public nint WindowHandle { get ; }
2222 private bool CanWindowToFront { get ; set ; } = true ;
23+ private readonly object _canWindowToFrontLock = new ( ) ;
2324
2425 public MainWindow ( )
2526 {
@@ -343,15 +344,18 @@ x.tabItem.NavigationParameter.NavigationParameter is PaneNavigationArguments pan
343344 }
344345 }
345346
346- public bool SetCanWindowToFront ( bool canWindowToFront )
347- {
348- if ( CanWindowToFront != canWindowToFront )
349- {
350- CanWindowToFront = canWindowToFront ;
351- return true ;
352- }
353- return false ;
354- }
347+ public bool SetCanWindowToFront ( bool canWindowToFront )
348+ {
349+ lock ( _canWindowToFrontLock )
350+ {
351+ if ( CanWindowToFront != canWindowToFront )
352+ {
353+ CanWindowToFront = canWindowToFront ;
354+ return true ;
355+ }
356+ return false ;
357+ }
358+ }
355359
356360 private const int WM_WINDOWPOSCHANGING = 0x0046 ;
357361 private void WindowManager_WindowMessageReceived ( object ? sender , WinUIEx . Messaging . WindowMessageEventArgs e )
You can’t perform that action at this time.
0 commit comments