Skip to content

Commit 23e578f

Browse files
authored
enhance: double tap stash to apply (#1546)
1 parent 4b05cf1 commit 23e578f

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

src/ViewModels/StashesPage.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@ public ContextMenu MakeContextMenu(Models.Stash stash)
147147
apply.Icon = App.CreateMenuIcon("Icons.CheckCircled");
148148
apply.Click += (_, ev) =>
149149
{
150-
if (_repo.CanCreatePopup())
151-
_repo.ShowPopup(new ApplyStash(_repo, stash));
152-
150+
Apply(stash);
153151
ev.Handled = true;
154152
};
155153

@@ -158,9 +156,7 @@ public ContextMenu MakeContextMenu(Models.Stash stash)
158156
drop.Icon = App.CreateMenuIcon("Icons.Clear");
159157
drop.Click += (_, ev) =>
160158
{
161-
if (_repo.CanCreatePopup())
162-
_repo.ShowPopup(new DropStash(_repo, stash));
163-
159+
Drop(stash);
164160
ev.Handled = true;
165161
};
166162

@@ -310,6 +306,12 @@ public void ClearSearchFilter()
310306
SearchFilter = string.Empty;
311307
}
312308

309+
public void Apply(Models.Stash stash)
310+
{
311+
if (stash != null && _repo.CanCreatePopup())
312+
_repo.ShowPopup(new ApplyStash(_repo, stash));
313+
}
314+
313315
public void Drop(Models.Stash stash)
314316
{
315317
if (stash != null && _repo.CanCreatePopup())

src/Views/StashesPage.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
ItemsSource="{Binding VisibleStashes}"
6666
SelectedItem="{Binding SelectedStash, Mode=TwoWay}"
6767
SelectionMode="Single"
68+
DoubleTapped="OnStashListDoubleTapped"
6869
KeyDown="OnStashListKeyDown"
6970
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
7071
ScrollViewer.VerticalScrollBarVisibility="Auto">

src/Views/StashesPage.axaml.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ private void OnMainLayoutSizeChanged(object sender, SizeChangedEventArgs e)
2323
layout.StashesLeftWidth = new GridLength(maxLeft, GridUnitType.Pixel);
2424
}
2525

26+
private void OnStashListDoubleTapped(object _, TappedEventArgs e)
27+
{
28+
if (DataContext is not ViewModels.StashesPage vm)
29+
return;
30+
31+
vm.Apply(vm.SelectedStash);
32+
e.Handled = true;
33+
}
34+
2635
private void OnStashListKeyDown(object sender, KeyEventArgs e)
2736
{
2837
if (e.Key is not (Key.Delete or Key.Back))

0 commit comments

Comments
 (0)