Skip to content

Commit a4a389f

Browse files
committed
keep current row selected when press Open project
1 parent d37fba5 commit a4a389f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: UnityLauncherPro/Tools.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public static void LaunchProject(Project proj)
140140
if (proj == null) return;
141141
if (Directory.Exists(proj.Path) == false) return;
142142

143-
Console.WriteLine("launch project " + proj.Title+" "+proj.Version);
143+
Console.WriteLine("launch project " + proj.Title + " " + proj.Version);
144144

145145
// there is no assets path, probably we want to create new project then
146146
var assetsFolder = Path.Combine(proj.Path, "Assets");
@@ -663,10 +663,12 @@ public static string ReadCustomLaunchArguments(string projectPath, string launch
663663
return results;
664664
}
665665

666-
public static void SetFocusToGrid(DataGrid targetGrid, int index = 0)
666+
public static void SetFocusToGrid(DataGrid targetGrid, int index = -1)
667667
{
668-
//e.Handled = true; // if enabled, we enter to first row initially
669668
if (targetGrid.Items.Count < 1) return;
669+
if (index == -1 && targetGrid.SelectedIndex > -1) index = targetGrid.SelectedIndex; // keep current row selected
670+
if (index == -1) index = 0;
671+
670672
targetGrid.Focus();
671673
DataGridRow row = (DataGridRow)targetGrid.ItemContainerGenerator.ContainerFromIndex(index);
672674
if (row == null)

0 commit comments

Comments
 (0)