@@ -36,6 +36,8 @@ private void Form1_Load(object sender, EventArgs e)
36
36
Start ( ) ;
37
37
}
38
38
39
+
40
+
39
41
void Start ( )
40
42
{
41
43
SetStatus ( "Initializing ..." ) ;
@@ -110,9 +112,6 @@ void Start()
110
112
// preselect grid
111
113
gridRecent . Select ( ) ;
112
114
113
- // subscribe to columnwidthchange event, so that can save column sizes
114
- this . gridRecent . ColumnWidthChanged += new System . Windows . Forms . DataGridViewColumnEventHandler ( this . gridRecent_ColumnWidthChanged ) ;
115
-
116
115
// get previous version build info string
117
116
// this string is release tag for latest release when this app was compiled
118
117
using ( Stream stream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "UnityLauncher." + "PreviousVersion.txt" ) )
@@ -887,35 +886,6 @@ private void btnOpenLogFolder_Click(object sender, EventArgs e)
887
886
}
888
887
}
889
888
890
- private void gridRecent_ColumnWidthChanged ( object sender , DataGridViewColumnEventArgs e )
891
- {
892
- List < int > gridWidths ;
893
- if ( Properties . Settings . Default . gridColumnWidths != null )
894
- {
895
- gridWidths = new List < int > ( Properties . Settings . Default . gridColumnWidths ) ;
896
- }
897
- else
898
- {
899
- gridWidths = new List < int > ( ) ;
900
- }
901
-
902
- // restore data grid view widths
903
- var colum = gridRecent . Columns [ 0 ] ;
904
- for ( int i = 0 ; i < gridRecent . Columns . Count ; ++ i )
905
- {
906
- if ( Properties . Settings . Default . gridColumnWidths != null && Properties . Settings . Default . gridColumnWidths . Length > i )
907
- {
908
- gridWidths [ i ] = gridRecent . Columns [ i ] . Width ;
909
- }
910
- else
911
- {
912
- gridWidths . Add ( gridRecent . Columns [ i ] . Width ) ;
913
- }
914
- }
915
- Properties . Settings . Default . gridColumnWidths = gridWidths . ToArray ( ) ;
916
- Properties . Settings . Default . Save ( ) ;
917
- }
918
-
919
889
private void btnOpenUpdateWebsite_Click ( object sender , EventArgs e )
920
890
{
921
891
var selected = gridUnityUpdates ? . CurrentCell ? . RowIndex ;
@@ -1025,8 +995,16 @@ private void btnBrowseForProject_Click(object sender, EventArgs e)
1025
995
BrowseForExistingProjectFolder ( ) ;
1026
996
}
1027
997
998
+ private void Form1_FormClosing ( object sender , FormClosingEventArgs e )
999
+ {
1000
+ SaveSettingsOnExit ( ) ;
1001
+ }
1002
+
1028
1003
#endregion UI events
1029
1004
1005
+
1006
+
1007
+
1030
1008
// displays version selector to upgrade project
1031
1009
void UpgradeProject ( )
1032
1010
{
@@ -1237,5 +1215,37 @@ void BrowseForExistingProjectFolder()
1237
1215
gridRecent . Rows [ 0 ] . Selected = true ;
1238
1216
}
1239
1217
}
1240
- }
1241
- }
1218
+
1219
+ private void SaveSettingsOnExit ( )
1220
+ {
1221
+ // save list column widths
1222
+ List < int > gridWidths ;
1223
+ if ( Properties . Settings . Default . gridColumnWidths != null )
1224
+ {
1225
+ gridWidths = new List < int > ( Properties . Settings . Default . gridColumnWidths ) ;
1226
+ }
1227
+ else
1228
+ {
1229
+ gridWidths = new List < int > ( ) ;
1230
+ }
1231
+
1232
+ // restore data grid view widths
1233
+ var colum = gridRecent . Columns [ 0 ] ;
1234
+ for ( int i = 0 ; i < gridRecent . Columns . Count ; ++ i )
1235
+ {
1236
+ if ( Properties . Settings . Default . gridColumnWidths != null && Properties . Settings . Default . gridColumnWidths . Length > i )
1237
+ {
1238
+ gridWidths [ i ] = gridRecent . Columns [ i ] . Width ;
1239
+ }
1240
+ else
1241
+ {
1242
+ gridWidths . Add ( gridRecent . Columns [ i ] . Width ) ;
1243
+ }
1244
+ }
1245
+ Properties . Settings . Default . gridColumnWidths = gridWidths . ToArray ( ) ;
1246
+ Properties . Settings . Default . Save ( ) ;
1247
+ }
1248
+
1249
+
1250
+ } // class Form
1251
+ } // namespace
0 commit comments