File tree Expand file tree Collapse file tree 4 files changed +11
-6
lines changed
Expand file tree Collapse file tree 4 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 88using Avalonia . Platform . Storage ;
99using FluentAvalonia . UI . Controls ;
1010using MsBox . Avalonia ;
11- using SkiaSharp ;
1211
1312namespace UnityHubNative . Net ;
1413
@@ -60,6 +59,14 @@ protected override void OnKeyDown(KeyEventArgs e)
6059
6160 if ( s_tabControl . SelectedIndex == 0 )
6261 {
62+ // try open project
63+ if ( e . Key == Key . Enter && TryGetSelectedProject ( out var unityProject ) )
64+ {
65+ OpenSelectedProject ( ) ;
66+ e . Handled = true ;
67+ return ;
68+ }
69+
6370 // focus on searchbar if typed a character
6471 if ( e . KeyModifiers is KeyModifiers . None or KeyModifiers . Shift && ( int ) e . Key >= ( int ) Key . A && ( int ) e . Key <= ( int ) Key . Z )
6572 {
@@ -289,7 +296,7 @@ public static void MoveSelectedProjectDown()
289296 WrapSelection = true ,
290297 SelectionMode = SelectionMode . AlwaysSelected | SelectionMode . Single ,
291298 SelectedIndex = 0 ,
292- } . OnSelectionChanged ( UnityProjectSelectedIndexChanged )
299+ } . AddOnSubmit ( OpenSelectedProject ) . OnSelectionChanged ( UnityProjectSelectedIndexChanged )
293300 } ,
294301 ] ) ,
295302 ] )
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class SubmitableListBox : ListBox
2626 protected override void OnPointerReleased ( PointerReleasedEventArgs e )
2727 {
2828 base . OnPointerReleased ( e ) ;
29- if ( ! e . Handled && e . InitialPressMouseButton == MouseButton . Left )
29+ if ( e . InitialPressMouseButton == MouseButton . Left )
3030 {
3131 OnSubmit ? . Invoke ( ) ;
3232 e . Handled = true ;
Original file line number Diff line number Diff line change @@ -290,9 +290,7 @@ public void OpenProject(UnityPlatform platform = UnityPlatform.CurrentPlatform)
290290 }
291291
292292 if ( UnityHubNativeNetApp . Config . closeAfterProjectOpen )
293- {
294293 MainWindow . Instance . Close ( ) ;
295- }
296294 }
297295
298296}
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ public UnityProjectView() : base()
6969
7070 private void OnPathLinkClicked ( ) => OsUtils . OpenExplorer ( unityProject . path ) ;
7171
72- public async void OpenProject ( )
72+ public void OpenProject ( )
7373 {
7474 if ( unityProject is null )
7575 return ;
You can’t perform that action at this time.
0 commit comments