Skip to content
This repository was archived by the owner on May 19, 2021. It is now read-only.

Commit bf62bd2

Browse files
committedFeb 4, 2018
2 parents 8737e73 + 5cfc7de commit bf62bd2

File tree

4 files changed

+61
-1
lines changed

4 files changed

+61
-1
lines changed
 

‎UnityLauncher/App.config

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@
3333
<setting name="closeAfterProject" serializeAs="String">
3434
<value>True</value>
3535
</setting>
36+
<setting name="gridColumnWidths" serializeAs="Xml">
37+
<value>
38+
<ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
39+
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
40+
</ArrayOfInt>
41+
</value>
42+
</setting>
3643
</UnityLauncher.Properties.Settings>
3744
</userSettings>
3845
</configuration>

‎UnityLauncher/Form1.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ void Start()
8787

8888
// preselect grid
8989
gridRecent.Select();
90+
91+
this.gridRecent.ColumnWidthChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.gridRecent_ColumnWidthChanged);
9092
}
9193

9294
void LoadSettings()
@@ -100,6 +102,13 @@ void LoadSettings()
100102
lstRootFolders.Items.AddRange(Properties.Settings.Default.rootFolders.Cast<string>().ToArray());
101103
// update packages folder listbox
102104
lstPackageFolders.Items.AddRange(Properties.Settings.Default.packageFolders.Cast<string>().ToArray());
105+
106+
// restore data grid view widths
107+
int[] gridColumnWidths = Properties.Settings.Default.gridColumnWidths;
108+
for ( int i=0; i< gridColumnWidths.Length; ++i )
109+
{
110+
gridRecent.Columns[i].Width = gridColumnWidths[i];
111+
}
103112
}
104113

105114
/// <summary>
@@ -964,6 +973,27 @@ private void btnOpenLogFolder_Click(object sender, EventArgs e)
964973
LaunchExplorer(logfolder);
965974
}
966975
}
976+
977+
private void gridRecent_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
978+
{
979+
List<int> gridWidths = new List<int>(Properties.Settings.Default.gridColumnWidths);
980+
// restore data grid view widths
981+
var colum = gridRecent.Columns[0];
982+
int a = Properties.Settings.Default.gridColumnWidths.Length;
983+
for (int i = 0; i < gridRecent.Columns.Count; ++i)
984+
{
985+
if (Properties.Settings.Default.gridColumnWidths.Length > i)
986+
{
987+
gridWidths[i] = gridRecent.Columns[i].Width;
988+
}
989+
else
990+
{
991+
gridWidths.Add(gridRecent.Columns[i].Width);
992+
}
993+
}
994+
Properties.Settings.Default.gridColumnWidths = gridWidths.ToArray();
995+
Properties.Settings.Default.Save();
996+
}
967997
#endregion UI events
968998

969999

‎UnityLauncher/Properties/Settings.Designer.cs

Lines changed: 18 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎UnityLauncher/Properties/Settings.settings

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,11 @@
2121
<Setting Name="closeAfterProject" Type="System.Boolean" Scope="User">
2222
<Value Profile="(Default)">True</Value>
2323
</Setting>
24+
<Setting Name="gridColumnWidths" Type="System.String" Scope="User">
25+
<Value Profile="(Default)">
26+
&lt;ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
27+
&lt;/ArrayOfInt&gt;
28+
</Value>
29+
</Setting>
2430
</Settings>
2531
</SettingsFile>

0 commit comments

Comments
 (0)
This repository has been archived.