Skip to content

Commit 47910b3

Browse files
committed
refactor: use Repository.Node.Open
Signed-off-by: leo <[email protected]>
1 parent 731e5a7 commit 47910b3

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/Views/Welcome.axaml.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Avalonia.Controls.Primitives;
55
using Avalonia.Input;
66
using Avalonia.Interactivity;
7-
using Avalonia.VisualTree;
87

98
namespace SourceGit.Views
109
{
@@ -16,9 +15,7 @@ protected override void OnPointerPressed(PointerPressedEventArgs e)
1615
{
1716
if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed &&
1817
DataContext is ViewModels.RepositoryNode { IsRepository: false } node)
19-
{
2018
ViewModels.Welcome.Instance.ToggleNodeIsExpanded(node);
21-
}
2219

2320
e.Handled = true;
2421
}
@@ -41,10 +38,7 @@ protected override void OnKeyDown(KeyEventArgs e)
4138
{
4239
if (e.Key == Key.Enter)
4340
{
44-
var parent = this.FindAncestorOfType<Launcher>();
45-
if (parent is { DataContext: ViewModels.Launcher launcher })
46-
launcher.OpenRepositoryInTab(node, null);
47-
41+
node.Open();
4842
e.Handled = true;
4943
}
5044
}
@@ -376,15 +370,9 @@ private void OnDoubleTappedTreeNode(object sender, TappedEventArgs e)
376370
if (sender is Grid { DataContext: ViewModels.RepositoryNode node })
377371
{
378372
if (node.IsRepository)
379-
{
380-
var parent = this.FindAncestorOfType<Launcher>();
381-
if (parent is { DataContext: ViewModels.Launcher launcher })
382-
launcher.OpenRepositoryInTab(node, null);
383-
}
373+
node.Open();
384374
else
385-
{
386375
ViewModels.Welcome.Instance.ToggleNodeIsExpanded(node);
387-
}
388376

389377
e.Handled = true;
390378
}

0 commit comments

Comments
 (0)