Skip to content
This repository was archived by the owner on May 19, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Grid columns width changes are now saved in user settings.
  • Loading branch information
geo-at-github committed Jan 27, 2018
commit 10ccaf6f18a195fe13e5c5e6e17b7ac4c28ecc9e
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 @@ -88,6 +88,8 @@ void Start()

// preselect grid
gridRecent.Select();

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

void LoadSettings()
Expand All @@ -101,6 +103,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 @@ -923,6 +932,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

void OpenReleaseNotes(string version)
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>