Skip to content

Commit

Permalink
Scope delete hotkey to downloads view
Browse files Browse the repository at this point in the history
  • Loading branch information
legend2ks committed Oct 18, 2024
1 parent 5a39df8 commit fc2c13d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions YoutubeApp/Views/DownloadsView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ public DownloadsView()
InitializeComponent();
if (!Design.IsDesignMode)
DataContext = App.Host.Services.GetRequiredService<DownloadsViewModel>();

HotKeyManager.SetHotKey(RemoveButton, new KeyGesture(Key.Delete));
}

private void HeaderOnScrollChanged(object? sender, ScrollChangedEventArgs e)
Expand All @@ -35,5 +33,13 @@ protected override void OnLoaded(RoutedEventArgs e)

((ScrollViewer)DownloadList.Scroll!).ScrollChanged += DownloadListOnScrollChanged;
HeaderSV.ScrollChanged += HeaderOnScrollChanged;
HotKeyManager.SetHotKey(RemoveButton, new KeyGesture(Key.Delete));
}

protected override void OnUnloaded(RoutedEventArgs e)
{
base.OnUnloaded(e);

HotKeyManager.SetHotKey(RemoveButton, null!);
}
}

0 comments on commit fc2c13d

Please sign in to comment.