File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 1313 Icon =" /App.ico"
1414 Title =" SourceGit"
1515 MinWidth =" 1280" MinHeight =" 720"
16- Width =" {Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherWidth, Mode=TwoWay}"
17- Height =" {Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherHeight, Mode=TwoWay}"
18- WindowState =" {Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherWindowState, Mode=TwoWay}"
1916 WindowStartupLocation =" CenterScreen" >
2017 <Grid x : Name =" MainLayout" >
2118 <Grid .RowDefinitions>
Original file line number Diff line number Diff line change @@ -12,19 +12,30 @@ public partial class Launcher : ChromelessWindow
1212 public Launcher ( )
1313 {
1414 InitializeComponent ( ) ;
15+
16+ var layout = ViewModels . Preference . Instance . Layout ;
17+ WindowState = layout . LauncherWindowState ;
18+
19+ if ( WindowState != WindowState . Maximized )
20+ {
21+ Width = layout . LauncherWidth ;
22+ Height = layout . LauncherHeight ;
23+ }
1524 }
1625
1726 protected override void OnPropertyChanged ( AvaloniaPropertyChangedEventArgs change )
1827 {
1928 base . OnPropertyChanged ( change ) ;
2029
21- if ( change . Property == WindowStateProperty )
30+ if ( change . Property == WindowStateProperty && MainLayout != null )
2231 {
2332 var state = ( WindowState ) change . NewValue ;
2433 if ( state == WindowState . Maximized )
2534 MainLayout . RowDefinitions [ 0 ] . Height = new GridLength ( OperatingSystem . IsMacOS ( ) ? 34 : 30 ) ;
2635 else
2736 MainLayout . RowDefinitions [ 0 ] . Height = new GridLength ( 38 ) ;
37+
38+ ViewModels . Preference . Instance . Layout . LauncherWindowState = state ;
2839 }
2940 }
3041
@@ -124,6 +135,10 @@ protected override void OnKeyDown(KeyEventArgs e)
124135
125136 protected override void OnClosing ( WindowClosingEventArgs e )
126137 {
138+ var pref = ViewModels . Preference . Instance ;
139+ pref . Layout . LauncherWidth = Width ;
140+ pref . Layout . LauncherHeight = Height ;
141+
127142 var vm = DataContext as ViewModels . Launcher ;
128143 vm . Quit ( ) ;
129144
You can’t perform that action at this time.
0 commit comments