Skip to content

Commit bae40cf

Browse files
updated Avalonia to 11.3.0 && fixed last project selection navigation issue
1 parent 2cdbf6c commit bae40cf

File tree

4 files changed

+31
-7
lines changed

4 files changed

+31
-7
lines changed

UnityHubNative.Net/MainWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace UnityHubNative.Net;
1313

14-
class MainWindow : Window
14+
sealed class MainWindow : Window
1515
{
1616
const string InstallUnityUrl = "https://unity.com/releases/editor/archive";
1717

@@ -99,7 +99,7 @@ protected override void OnOpened(EventArgs e)
9999
{
100100
base.OnOpened(e);
101101
if (s_unityProjectsParent.SelectedItem != null)
102-
s_unityProjectsParent.ContainerFromIndex(0)!.Focus();
102+
s_unityProjectsParent.ContainerFromIndex(s_unityInstallationsParent.SelectedIndex)!.Focus();
103103
}
104104

105105
public static void ReloadEverything()

UnityHubNative.Net/SubmitableListBox.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
using System.Diagnostics;
12
using Avalonia.Controls;
23
using Avalonia.Input;
34

45
namespace UnityHubNative.Net;
56

6-
class SubmitableListBox : ListBox
7+
sealed class SubmitableListBox : ListBox
78
{
89
static readonly KeyGesture[] DefaultSubmitGesture =
910
[
@@ -23,6 +24,8 @@ class SubmitableListBox : ListBox
2324

2425
protected override Type StyleKeyOverride => typeof(ListBox);
2526

27+
private bool _firstTime = true;
28+
2629
protected override void OnPointerReleased(PointerReleasedEventArgs e)
2730
{
2831
base.OnPointerReleased(e);
@@ -42,7 +45,18 @@ protected override void OnKeyDown(KeyEventArgs e)
4245
e.Handled = true;
4346
return;
4447
}
45-
base.OnKeyDown(e);
48+
if (_firstTime)
49+
{
50+
_firstTime = false;
51+
var lastSelectedIndex = SelectedIndex;
52+
base.OnKeyDown(e);
53+
if (SelectedIndex == 1)
54+
SelectedIndex = lastSelectedIndex + 1;
55+
else if (SelectedIndex == ItemCount - 1)
56+
SelectedIndex = lastSelectedIndex == 0 ? ItemCount - 1 : lastSelectedIndex - 1;
57+
}
58+
else
59+
base.OnKeyDown(e);
4660
}
4761

4862
public SubmitableListBox AddOnSubmit(Action callback)

UnityHubNative.Net/UnityHubNative.Net.csproj

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
</PropertyGroup>
3636

3737
<ItemGroup>
38-
<PackageReference Include="Avalonia" Version="11.3.0-beta1" />
39-
<PackageReference Include="Avalonia.Desktop" Version="11.3.0-beta1" />
38+
<PackageReference Include="Avalonia" Version="11.3.0" />
39+
<PackageReference Include="Avalonia.Desktop" Version="11.3.0" />
4040
<PackageReference Include="FluentAvaloniaUI" Version="2.4.0-preview1" />
4141
<PackageReference Include="MessageBox.Avalonia" Version="3.2.0" />
42-
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.0-beta1" />
42+
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.0" />
4343
<!--<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.2.4" />-->
4444
<!--<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.5" />-->
4545
<!--<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.4" />-->
@@ -62,4 +62,12 @@
6262
<AvaloniaXamlIlDebuggerLaunch>False</AvaloniaXamlIlDebuggerLaunch>
6363
<AvaloniaXamlReportImportance>Normal</AvaloniaXamlReportImportance>
6464
</PropertyGroup>
65+
66+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
67+
<IsAotCompatible>True</IsAotCompatible>
68+
</PropertyGroup>
69+
70+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
71+
<IsAotCompatible>True</IsAotCompatible>
72+
</PropertyGroup>
6573
</Project>

Windows/UnityHubNative.Net.Windows.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<AssemblyName>UnityHubNative.Net</AssemblyName>
1010
<DefineConstants>$(DefineConstants);OS_WINDOWS</DefineConstants>
1111
<ApplicationIcon>res/icon.ico</ApplicationIcon>
12+
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
1213
</PropertyGroup>
1314

1415
<!--for optimization-->
@@ -24,6 +25,7 @@
2425
<PropertyGroup Label="Avalonia">
2526
<AvaloniaNameGeneratorAttachDevTools>True</AvaloniaNameGeneratorAttachDevTools>
2627
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
28+
<PlatformTarget>x64</PlatformTarget>
2729
</PropertyGroup>
2830

2931
<ItemGroup>

0 commit comments

Comments
 (0)