From 66a423145ff30416045b973eebcd27ee7a7408c2 Mon Sep 17 00:00:00 2001 From: unitycoder Date: Thu, 10 May 2018 20:55:38 +0800 Subject: [PATCH] set selectedindex after inserting new project fixes #58 --- UnityLauncher/Form1.Designer.cs | 76 +++++++++++++++++++-------------- UnityLauncher/Form1.cs | 2 + UnityLauncher/Form1.resx | 30 ++++++------- 3 files changed, 58 insertions(+), 50 deletions(-) diff --git a/UnityLauncher/Form1.Designer.cs b/UnityLauncher/Form1.Designer.cs index 8708904..8a2c0a9 100644 --- a/UnityLauncher/Form1.Designer.cs +++ b/UnityLauncher/Form1.Designer.cs @@ -52,9 +52,6 @@ private void InitializeComponent() this.btnExploreUnity = new System.Windows.Forms.Button(); this.btnLaunchUnity = new System.Windows.Forms.Button(); this.gridUnityList = new System.Windows.Forms.DataGridView(); - this._unityVersion = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this._unityPath = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this._unityInstallDate = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tabPackages = new System.Windows.Forms.TabPage(); this.btnAddAssetStoreFolder = new System.Windows.Forms.Button(); this.btnExplorePackageFolder = new System.Windows.Forms.Button(); @@ -95,6 +92,10 @@ private void InitializeComponent() this.btnAddPackFolder = new System.Windows.Forms.Button(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this._unityVersion = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this._unityPath = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this._unityInstallDate = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this._Platforms = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tabControl1.SuspendLayout(); this.tabProjects.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gridRecent)).BeginInit(); @@ -104,6 +105,7 @@ private void InitializeComponent() this.tabUpdates.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gridUnityUpdates)).BeginInit(); this.tabSettings.SuspendLayout(); + this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // // tabControl1 @@ -377,13 +379,14 @@ private void InitializeComponent() this.gridUnityList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this._unityVersion, this._unityPath, - this._unityInstallDate}); + this._unityInstallDate, + this._Platforms}); this.gridUnityList.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.gridUnityList.Location = new System.Drawing.Point(3, 27); this.gridUnityList.MultiSelect = false; this.gridUnityList.Name = "gridUnityList"; this.gridUnityList.ReadOnly = true; - this.gridUnityList.RowHeadersWidth = 18; + this.gridUnityList.RowHeadersWidth = 15; this.gridUnityList.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.gridUnityList.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.gridUnityList.ShowCellErrors = false; @@ -394,30 +397,6 @@ private void InitializeComponent() this.gridUnityList.TabIndex = 10; this.gridUnityList.KeyDown += new System.Windows.Forms.KeyEventHandler(this.unityGridView_KeyDown); // - // _unityVersion - // - this._unityVersion.HeaderText = "Version"; - this._unityVersion.MinimumWidth = 150; - this._unityVersion.Name = "_unityVersion"; - this._unityVersion.ReadOnly = true; - this._unityVersion.Width = 150; - // - // _unityPath - // - this._unityPath.HeaderText = "Path"; - this._unityPath.MinimumWidth = 300; - this._unityPath.Name = "_unityPath"; - this._unityPath.ReadOnly = true; - this._unityPath.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this._unityPath.Width = 300; - // - // _unityInstallDate - // - this._unityInstallDate.HeaderText = "Installed"; - this._unityInstallDate.Name = "_unityInstallDate"; - this._unityInstallDate.ReadOnly = true; - this._unityInstallDate.Width = 150; - // // tabPackages // this.tabPackages.Controls.Add(this.btnAddAssetStoreFolder); @@ -887,6 +866,36 @@ private void InitializeComponent() this.toolStripStatusLabel1.Text = "toolStripStatusLabel1"; this.toolStripStatusLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // + // _unityVersion + // + this._unityVersion.HeaderText = "Version"; + this._unityVersion.MinimumWidth = 120; + this._unityVersion.Name = "_unityVersion"; + this._unityVersion.ReadOnly = true; + this._unityVersion.Width = 120; + // + // _unityPath + // + this._unityPath.HeaderText = "Path"; + this._unityPath.MinimumWidth = 300; + this._unityPath.Name = "_unityPath"; + this._unityPath.ReadOnly = true; + this._unityPath.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this._unityPath.Width = 300; + // + // _unityInstallDate + // + this._unityInstallDate.HeaderText = "Installed"; + this._unityInstallDate.Name = "_unityInstallDate"; + this._unityInstallDate.ReadOnly = true; + this._unityInstallDate.Width = 120; + // + // _Platforms + // + this._Platforms.HeaderText = "Platforms"; + this._Platforms.Name = "_Platforms"; + this._Platforms.ReadOnly = true; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -918,6 +927,8 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.gridUnityUpdates)).EndInit(); this.tabSettings.ResumeLayout(false); this.tabSettings.PerformLayout(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); this.ResumeLayout(false); } @@ -982,12 +993,13 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox chkShowLauncherArgumentsColumn; private System.Windows.Forms.LinkLabel linkArgumentsDocs; private System.Windows.Forms.LinkLabel linkProjectGithub; - private System.Windows.Forms.DataGridViewTextBoxColumn _unityVersion; - private System.Windows.Forms.DataGridViewTextBoxColumn _unityPath; - private System.Windows.Forms.DataGridViewTextBoxColumn _unityInstallDate; private System.Windows.Forms.Button btnCheckUpdates; private System.Windows.Forms.Button btnRefreshProjectList; private System.Windows.Forms.Button btnBrowseForProject; + private System.Windows.Forms.DataGridViewTextBoxColumn _unityVersion; + private System.Windows.Forms.DataGridViewTextBoxColumn _unityPath; + private System.Windows.Forms.DataGridViewTextBoxColumn _unityInstallDate; + private System.Windows.Forms.DataGridViewTextBoxColumn _Platforms; } } diff --git a/UnityLauncher/Form1.cs b/UnityLauncher/Form1.cs index b06c2af..0dc56b4 100644 --- a/UnityLauncher/Form1.cs +++ b/UnityLauncher/Form1.cs @@ -215,6 +215,7 @@ bool ScanUnityInstallations() unityList.Add(unityVersion, unityExe); var dataFolder = Path.Combine(directories[i], "Editor", "Data"); DateTime? installDate = Tools.GetLastModifiedTime(dataFolder); + // TODO add platforms: PC|iOS|tvOS|Android|UWP|WebGL|Facebook|XBox|PSVita|PS4 gridUnityList.Rows.Add(unityVersion, unityExe, installDate); } } // have unity.exe @@ -1213,6 +1214,7 @@ void BrowseForExistingProjectFolder() gridRecent.Rows.Insert(0, projectName, projectVersion, projectPath, lastUpdated, customArgs, gitBranch); gridRecent.Rows[0].Cells[1].Style.ForeColor = HaveExactVersionInstalled(projectVersion) ? Color.Green : Color.Red; gridRecent.Rows[0].Selected = true; + gridRecent.CurrentCell = gridRecent[0, 0]; // reset position to first item } } diff --git a/UnityLauncher/Form1.resx b/UnityLauncher/Form1.resx index 1124349..cb55b8b 100644 --- a/UnityLauncher/Form1.resx +++ b/UnityLauncher/Form1.resx @@ -117,26 +117,20 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 14, 20 - - - True - - + True - + True - + True - + True - - True + + 14, 20 True @@ -156,22 +150,22 @@ True - + True - + True - + True - + True - + True - + True