Skip to content

Commit a2cbdf1

Browse files
all dialogues now have consistent look & button margins on new project dialogue fixed
1 parent fb87f19 commit a2cbdf1

File tree

3 files changed

+43
-18
lines changed

3 files changed

+43
-18
lines changed

UnityHubNative.Net/AboutDialogue.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
using Avalonia;
12
using Avalonia.Controls;
23
using Avalonia.Input;
34
using Avalonia.Layout;
45
using Avalonia.Media;
5-
using UnityHubNative.Net;
66

77
namespace UnityHubNative.Net;
88

@@ -13,7 +13,12 @@ sealed class AboutDialogue : Window
1313
public AboutDialogue()
1414
{
1515
Content = CreateContent();
16-
_btn!.Focus();
16+
17+
SizeToContent = SizeToContent.WidthAndHeight;
18+
WindowStartupLocation = WindowStartupLocation.CenterOwner;
19+
CanResize = false;
20+
SystemDecorations = SystemDecorations.BorderOnly;
21+
ExtendClientAreaToDecorationsHint = true;
1722

1823
if (UnityHubNativeNetApp.Config.transparent)
1924
{
@@ -22,18 +27,19 @@ public AboutDialogue()
2227
Background = new SolidColorBrush(Colors.Transparent, UnityHubNativeNetApp.Config.blurIntensity);
2328
#endif
2429
}
30+
}
2531

26-
CanResize = false;
27-
SizeToContent = SizeToContent.WidthAndHeight;
28-
WindowStartupLocation = WindowStartupLocation.CenterOwner;
29-
Focusable = true;
32+
protected override void OnOpened(EventArgs e)
33+
{
34+
base.OnOpened(e);
35+
_btn.Focus();
3036
}
3137

3238
private object? CreateContent()
3339
{
3440
return new DockPanel
3541
{
36-
Margin = new(5)
42+
Margin = WindowDecorationMargin + new Thickness(5)
3743
}.AddChildren
3844
([
3945
new TextBlock

UnityHubNative.Net/CreateNewProjectDialogue.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public CreateNewProjectDialogue()
2525
Content = CreateContent();
2626
UpdateVersionSelectionViews();
2727
UpdateTemplateViews();
28+
2829
SizeToContent = SizeToContent.WidthAndHeight;
2930
WindowStartupLocation = WindowStartupLocation.CenterOwner;
3031
CanResize = false;
@@ -92,6 +93,7 @@ protected override async void OnOpened(EventArgs e)
9293
new Button
9394
{
9495
Content = "Choose",
96+
Margin = new(2)
9597
}.OnClick(OnChooseLocationClicked).SetDock(Dock.Right),
9698
_pathTextBox = new TextBox
9799
{
@@ -131,13 +133,15 @@ protected override async void OnOpened(EventArgs e)
131133
{
132134
Content = "Create",
133135
IsEnabled = false,
136+
Margin = new(2),
134137
VerticalAlignment = VerticalAlignment.Center,
135138
}.OnClick(OnCreateClicked).SetTooltip("Create the Unity Project with the specified attributes").SetDock(Dock.Right),
136139
new Button
137140
{
138141
Content = "Cancel",
139142
HotKey = new(Key.Escape),
140143
VerticalAlignment = VerticalAlignment.Center,
144+
Margin = new(2),
141145
}.OnClick(OnCancelClicked).SetTooltip("Cancel the creation of a new Unity Project").SetDock(Dock.Right),
142146
]).SetDock(Dock.Bottom),
143147
_templatesParent = new ListBox

UnityHubNative.Net/OpenWithDialogue.cs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Avalonia;
12
using Avalonia.Controls;
23
using Avalonia.Input;
34
using Avalonia.Media;
@@ -24,27 +25,40 @@ public OpenWithDialogue(UnityProject unityProject)
2425
{
2526
_unityProject = unityProject;
2627
Title = "Open With Specific Editor";
27-
TransparencyLevelHint =
28-
[
29-
WindowTransparencyLevel.AcrylicBlur,
30-
WindowTransparencyLevel.Blur,
31-
];
3228
Content = CreateContent();
33-
_platformOptionsComboBox!.SelectedIndex = 0;
34-
_unityVersionListBox!.Focus();
35-
CanResize = false;
29+
3630
SizeToContent = SizeToContent.WidthAndHeight;
31+
WindowStartupLocation = WindowStartupLocation.CenterOwner;
32+
CanResize = false;
33+
SystemDecorations = SystemDecorations.BorderOnly;
34+
ExtendClientAreaToDecorationsHint = true;
35+
36+
if (UnityHubNativeNetApp.Config.transparent)
37+
{
38+
TransparencyLevelHint =
39+
[
40+
WindowTransparencyLevel.AcrylicBlur,
41+
WindowTransparencyLevel.Blur,
42+
];
3743
#if Windows
38-
Background = Brushes.Transparent;
44+
Background = new SolidColorBrush(Colors.Transparent, UnityHubNativeNetApp.Config.blurIntensity);
3945
#endif
40-
WindowStartupLocation = WindowStartupLocation.CenterOwner;
46+
}
47+
}
48+
49+
protected override void OnOpened(EventArgs e)
50+
{
51+
base.OnOpened(e);
52+
_platformOptionsComboBox.SelectedIndex = 0;
53+
_unityVersionListBox.SelectedIndex = 0;
54+
_unityVersionListBox.ContainerFromIndex(0)!.Focus();
4155
}
4256

4357
private Control CreateContent() => new Border
4458
{
4559
Child = new DockPanel
4660
{
47-
Margin = new(5),
61+
Margin = WindowDecorationMargin + new Thickness(5),
4862
Background = Brushes.Transparent,
4963
}.AddChildren
5064
([
@@ -83,6 +97,7 @@ public OpenWithDialogue(UnityProject unityProject)
8397
WrapSelection = true,
8498
AutoScrollToSelectedItem = true,
8599
HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Right,
100+
IsTextSearchEnabled = true,
86101
}.AddItems(GetPlatformItems()).SetDock(Dock.Top),
87102
new Button
88103
{

0 commit comments

Comments
 (0)