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

Added double click and closing after opening a project #20

Merged
merged 4 commits into from
Jan 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions UnityLauncher/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<setting name="closeAfterExplorer" serializeAs="String">
<value>True</value>
</setting>
<setting name="closeAfterProject" serializeAs="String">
<value>True</value>
</setting>
</UnityLauncher.Properties.Settings>
</userSettings>
</configuration>
23 changes: 19 additions & 4 deletions UnityLauncher/Form1.Designer.cs

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

21 changes: 21 additions & 0 deletions UnityLauncher/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ void LoadSettings()
// update settings window
chkMinimizeToTaskbar.Checked = Properties.Settings.Default.minimizeToTaskbar;
chkQuitAfterCommandline.Checked = Properties.Settings.Default.closeAfterExplorer;
ChkQuitAfterOpen.Checked = Properties.Settings.Default.closeAfterProject;

// update installations folder listbox
lstRootFolders.Items.AddRange(Properties.Settings.Default.rootFolders.Cast<string>().ToArray());
Expand Down Expand Up @@ -328,6 +329,11 @@ void LaunchProject(string projectPath, string version, bool openProject = true)
myProcess.StartInfo.Arguments = pars;
}
myProcess.Start();

if (Properties.Settings.Default.closeAfterProject)
{
Environment.Exit(0);
}
}
catch (Exception ex)
{
Expand Down Expand Up @@ -734,6 +740,15 @@ private void gridRecent_KeyDown(object sender, KeyEventArgs e)
}
}

//Checks if you are doubleclicking the current cell
private void GridRecent_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
if(e.Button == MouseButtons.Left && e.RowIndex == gridRecent.CurrentCell.RowIndex)
{
LaunchSelectedProject();
}
}

// set basefolder of all unity installations
private void btn_setinstallfolder_Click(object sender, EventArgs e)
{
Expand Down Expand Up @@ -812,6 +827,12 @@ private void btnAddRegister_Click(object sender, EventArgs e)
AddContextMenuRegistry();
}

private void ChkQuitAfterOpen_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.closeAfterProject = ChkQuitAfterOpen.Checked;
Properties.Settings.Default.Save();
}

private void chkQuitAfterCommandline_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.closeAfterExplorer = chkQuitAfterCommandline.Checked;
Expand Down
12 changes: 12 additions & 0 deletions UnityLauncher/Properties/Settings.Designer.cs

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

3 changes: 3 additions & 0 deletions UnityLauncher/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
<Setting Name="closeAfterExplorer" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="closeAfterProject" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>