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

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
unitycoder committed Feb 4, 2018
2 parents 8737e73 + 5cfc7de commit bf62bd2
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
7 changes: 7 additions & 0 deletions UnityLauncher/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
<setting name="closeAfterProject" serializeAs="String">
<value>True</value>
</setting>
<setting name="gridColumnWidths" serializeAs="Xml">
<value>
<ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
</ArrayOfInt>
</value>
</setting>
</UnityLauncher.Properties.Settings>
</userSettings>
</configuration>
30 changes: 30 additions & 0 deletions UnityLauncher/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ void Start()

// preselect grid
gridRecent.Select();

this.gridRecent.ColumnWidthChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.gridRecent_ColumnWidthChanged);
}

void LoadSettings()
Expand All @@ -100,6 +102,13 @@ void LoadSettings()
lstRootFolders.Items.AddRange(Properties.Settings.Default.rootFolders.Cast<string>().ToArray());
// update packages folder listbox
lstPackageFolders.Items.AddRange(Properties.Settings.Default.packageFolders.Cast<string>().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];
}
}

/// <summary>
Expand Down Expand Up @@ -964,6 +973,27 @@ private void btnOpenLogFolder_Click(object sender, EventArgs e)
LaunchExplorer(logfolder);
}
}

private void gridRecent_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
{
List<int> gridWidths = new List<int>(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


Expand Down
19 changes: 18 additions & 1 deletion UnityLauncher/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions UnityLauncher/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,11 @@
<Setting Name="closeAfterProject" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="gridColumnWidths" Type="System.String" Scope="User">
<Value Profile="(Default)">
&lt;ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;/ArrayOfInt&gt;
</Value>
</Setting>
</Settings>
</SettingsFile>

0 comments on commit bf62bd2

Please sign in to comment.