diff --git a/UnityLauncher/App.config b/UnityLauncher/App.config index 276d37d..6be7e45 100644 --- a/UnityLauncher/App.config +++ b/UnityLauncher/App.config @@ -33,6 +33,13 @@ True + + + + + + \ No newline at end of file diff --git a/UnityLauncher/Form1.cs b/UnityLauncher/Form1.cs index e8dba52..165413c 100644 --- a/UnityLauncher/Form1.cs +++ b/UnityLauncher/Form1.cs @@ -88,6 +88,8 @@ void Start() // preselect grid gridRecent.Select(); + + this.gridRecent.ColumnWidthChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.gridRecent_ColumnWidthChanged); } void LoadSettings() @@ -101,6 +103,13 @@ void LoadSettings() lstRootFolders.Items.AddRange(Properties.Settings.Default.rootFolders.Cast().ToArray()); // update packages folder listbox lstPackageFolders.Items.AddRange(Properties.Settings.Default.packageFolders.Cast().ToArray()); + + // restore data grid view widths + int[] gridColumnWidths = Properties.Settings.Default.gridColumnWidths; + for ( int i=0; i< gridColumnWidths.Length; ++i ) + { + gridRecent.Columns[i].Width = gridColumnWidths[i]; + } } /// @@ -926,6 +935,27 @@ private void btnOpenLogFolder_Click(object sender, EventArgs e) LaunchExplorer(logfolder); } } + + private void gridRecent_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) + { + List gridWidths = new List(Properties.Settings.Default.gridColumnWidths); + // restore data grid view widths + var colum = gridRecent.Columns[0]; + int a = Properties.Settings.Default.gridColumnWidths.Length; + for (int i = 0; i < gridRecent.Columns.Count; ++i) + { + if (Properties.Settings.Default.gridColumnWidths.Length > i) + { + gridWidths[i] = gridRecent.Columns[i].Width; + } + else + { + gridWidths.Add(gridRecent.Columns[i].Width); + } + } + Properties.Settings.Default.gridColumnWidths = gridWidths.ToArray(); + Properties.Settings.Default.Save(); + } #endregion UI events void OpenReleaseNotes(string version) diff --git a/UnityLauncher/Properties/Settings.Designer.cs b/UnityLauncher/Properties/Settings.Designer.cs index 78dd54b..7566ab4 100644 --- a/UnityLauncher/Properties/Settings.Designer.cs +++ b/UnityLauncher/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace UnityLauncher.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -85,5 +85,22 @@ public bool closeAfterProject { this["closeAfterProject"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("\r\n\r\n 100\r\n")] + public int[] gridColumnWidths + { + get + { + return ((int[])(this["gridColumnWidths"])); + } + set + { + this["gridColumnWidths"] = value; + } + } } } diff --git a/UnityLauncher/Properties/Settings.settings b/UnityLauncher/Properties/Settings.settings index c70e9e9..e37ba75 100644 --- a/UnityLauncher/Properties/Settings.settings +++ b/UnityLauncher/Properties/Settings.settings @@ -21,5 +21,11 @@ True + + + <ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + </ArrayOfInt> + + \ No newline at end of file