1
- using System ;
1
+ using Microsoft . UI . Xaml ;
2
+ using System ;
2
3
using System . Collections . Generic ;
3
4
using System . Linq ;
4
5
using System . Text ;
5
6
using System . Threading . Tasks ;
6
- using Microsoft . UI . Xaml ;
7
+ using Windows . UI . ViewManagement ;
7
8
using WinUIEx ;
8
9
9
10
namespace AtlasToolbox . Utils
@@ -20,17 +21,23 @@ public static void HideApp(object sender, WindowEventArgs e)
20
21
e . Handled = true ;
21
22
App . m_window . Hide ( ) ;
22
23
}
24
+
23
25
public static void CloseApp ( object sender , WindowEventArgs e )
24
26
{
25
27
// Get & save the current app size
26
-
27
- // TODO: Check if the window is maximised, if it is then don't save the size
28
28
int width , height ;
29
+ ApplicationView applicationView = ApplicationView . GetForCurrentView ( ) ;
29
30
MainWindow mWindow = App . m_window as MainWindow ;
30
- mWindow . GetWindowSize ( out width , out height ) ;
31
- RegistryHelper . SetValue ( @"HKLM\SOFTWARE\AtlasOS\Toolbox" , "AppWidth" , width , Microsoft . Win32 . RegistryValueKind . String ) ;
32
- RegistryHelper . SetValue ( @"HKLM\SOFTWARE\AtlasOS\Toolbox" , "AppHeight" , height , Microsoft . Win32 . RegistryValueKind . String ) ;
33
31
32
+ // Check if app is fullscreen
33
+ // if true then don't save screen size
34
+ if ( ! applicationView . IsFullScreenMode )
35
+ {
36
+ mWindow . GetWindowSize ( out width , out height ) ;
37
+ RegistryHelper . SetValue ( @"HKLM\SOFTWARE\AtlasOS\Toolbox" , "AppWidth" , width , Microsoft . Win32 . RegistryValueKind . String ) ;
38
+ RegistryHelper . SetValue ( @"HKLM\SOFTWARE\AtlasOS\Toolbox" , "AppHeight" , height , Microsoft . Win32 . RegistryValueKind . String ) ;
39
+ }
40
+ // Exit the app
34
41
App . Current . Exit ( ) ;
35
42
}
36
43
}
0 commit comments