Skip to content

Commit c204190

Browse files
committed
projects: if press up/down key in searchbox, selection moves in grid, if no items selected from search then select first as default, updates: clear search field on refresh, #BUILD
1 parent c4a3242 commit c204190

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

Diff for: UnityLauncherPro/MainWindow.xaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,9 @@
868868
<Button Style="{StaticResource CustomButton}" x:Name="btnOpenCrashLogs" Margin="10,0,0,0" BorderBrush="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="BtnOpenCrashLogs_Click" ToolTip="Browse Crash logs folder">
869869
<Label Content="_Crash Logs" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}}}" />
870870
</Button>
871+
<Button Style="{StaticResource CustomButton}" x:Name="btnAssetPackages" Margin="10,0,0,0" BorderBrush="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" ToolTip="Browse AssetStore downloads folder" Click="BtnAssetPackages_Click">
872+
<Label Content="A_sset packages" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}}}" />
873+
</Button>
871874
<Button Style="{StaticResource CustomButton}" x:Name="btnCrashDumps" Margin="10,0,0,0" BorderBrush="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" ToolTip="Browse Crash dumps folder" Click="BtnCrashDumps_Click">
872875
<Label Content="Crash _Dumps" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}}}" />
873876
</Button>
@@ -877,9 +880,6 @@
877880
<Button Style="{StaticResource CustomButton}" x:Name="btnGICache" Margin="10,0,0,0" BorderBrush="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" ToolTip="Browse Unity GI Cache folder" Click="BtnGICache_Click">
878881
<Label Content="_GI Cache" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}}}" />
879882
</Button>
880-
<Button Style="{StaticResource CustomButton}" x:Name="btnAssetPackages" Margin="10,0,0,0" BorderBrush="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" ToolTip="Browse AssetStore downloads folder" Click="BtnAssetPackages_Click">
881-
<Label Content="A_sset packages" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}}}" />
882-
</Button>
883883
</StackPanel>
884884
</Border>
885885
<!-- tools -->

Diff for: UnityLauncherPro/MainWindow.xaml.cs

+14-4
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,9 @@ private void OnRectangleMouseDown(object sender, MouseButtonEventArgs e)
624624
private void OnSearchTextChanged(object sender, TextChangedEventArgs e)
625625
{
626626
FilterRecentProjects();
627+
628+
// if nothing selected, select first item
629+
if (gridRecent.SelectedIndex < 0) gridRecent.SelectedIndex = 0;
627630
}
628631

629632
private void BtnAddProjectFolder_Click(object sender, RoutedEventArgs e)
@@ -687,7 +690,7 @@ private void OnGetUnityUpdatesClick(object sender, RoutedEventArgs e)
687690

688691
// refresh installations, if already added some new ones
689692
UpdateUnityInstallationsList();
690-
693+
txtSearchBoxUpdates.Text = "";
691694
CallGetUnityUpdates();
692695

693696
button.IsEnabled = true;
@@ -727,9 +730,9 @@ private void OnWindowKeyDown(object sender, KeyEventArgs e)
727730
txtSearchBox.Text = "";
728731
break;
729732
case Key.Up:
733+
case Key.Down:
730734
case Key.Left:
731735
case Key.Right:
732-
case Key.Down:
733736
break;
734737
case Key.F2: // edit arguments or project name
735738
if (chkEnableProjectRename.IsChecked == false) return; //if rename not enabled
@@ -991,7 +994,11 @@ private void TxtSearchBox_PreviewKeyDown(object sender, KeyEventArgs e)
991994
break;
992995
case Key.Tab:
993996
case Key.Up:
994-
Tools.SetFocusToGrid(gridRecent);
997+
//Tools.SetFocusToGrid(gridRecent);
998+
var currentIndex = gridRecent.SelectedIndex - 1;
999+
//Console.WriteLine(currentIndex);
1000+
if (currentIndex < 0) currentIndex = gridRecent.Items.Count - 1;
1001+
gridRecent.SelectedIndex = currentIndex;
9951002
e.Handled = true;
9961003
break;
9971004
case Key.Down:
@@ -1002,8 +1009,11 @@ private void TxtSearchBox_PreviewKeyDown(object sender, KeyEventArgs e)
10021009
//}
10031010
//else
10041011
//{
1005-
Tools.SetFocusToGrid(gridRecent);
1012+
//Tools.SetFocusToGrid(gridRecent);
10061013
// }
1014+
1015+
// if in searchbox, then move selected index up or down
1016+
gridRecent.SelectedIndex = ++gridRecent.SelectedIndex % gridRecent.Items.Count;
10071017
e.Handled = true; // to stay in first row
10081018
break;
10091019
default:

0 commit comments

Comments
 (0)