44using Microsoft . Extensions . Logging ;
55using Microsoft . UI ;
66using Microsoft . UI . Windowing ;
7+ using Microsoft . UI . Xaml ;
78using Microsoft . UI . Xaml . Controls ;
89using Microsoft . UI . Xaml . Media . Animation ;
910using System . IO ;
1516
1617namespace Files . App
1718{
18- public sealed partial class MainWindow : WinUIEx . WindowEx
19+ public sealed partial class MainWindow : Window
1920 {
2021 private static MainWindow ? _Instance ;
2122 public static MainWindow Instance => _Instance ??= new ( ) ;
@@ -28,18 +29,21 @@ public MainWindow()
2829 {
2930 InitializeComponent ( ) ;
3031
31- WindowHandle = WinUIEx . WindowExtensions . GetWindowHandle ( this ) ;
32- MinHeight = 316 ;
33- MinWidth = 416 ;
32+ WindowHandle = WinRT . Interop . WindowNative . GetWindowHandle ( this ) ;
3433 ExtendsContentIntoTitleBar = true ;
3534 Title = "Files" ;
36- PersistenceId = "FilesMainWindow" ;
3735 AppWindow . TitleBar . ButtonBackgroundColor = Colors . Transparent ;
3836 AppWindow . TitleBar . ButtonInactiveBackgroundColor = Colors . Transparent ;
3937 AppWindow . TitleBar . ButtonPressedBackgroundColor = Colors . Transparent ;
4038 AppWindow . TitleBar . ButtonHoverBackgroundColor = Colors . Transparent ;
4139 AppWindow . SetIcon ( AppLifecycleHelper . AppIconPath ) ;
4240
41+ if ( AppWindow . Presenter . TryCast < OverlappedPresenter > ( ) is { } presenter )
42+ {
43+ presenter . PreferredMinimumHeight = 316 ;
44+ presenter . PreferredMinimumWidth = 416 ;
45+ }
46+
4347 WinUIEx . WindowManager . Get ( this ) . WindowMessageReceived += WindowManager_WindowMessageReceived ;
4448 }
4549
@@ -201,8 +205,9 @@ public async Task InitializeApplicationAsync(object activatedEventArgs)
201205 Win32Helper . BringToForegroundEx ( new ( WindowHandle ) ) ;
202206 }
203207
204- if ( Windows . Win32 . PInvoke . IsIconic ( new ( WindowHandle ) ) )
205- WinUIEx . WindowExtensions . Restore ( Instance ) ; // Restore window if minimized
208+ if ( Windows . Win32 . PInvoke . IsIconic ( new ( WindowHandle ) ) &&
209+ AppWindow . Presenter . TryCast < OverlappedPresenter > ( ) is { } presenter )
210+ presenter . Restore ( ) ; // Restore window if minimized
206211 }
207212
208213 private Frame ? EnsureWindowIsInitialized ( )
0 commit comments