mirror of
https://github.com/Crunchy-DL/Crunchy-Downloader.git
synced 2026-04-25 10:43:01 +00:00
- Added basic **poster (tall and wide) download** for history series - Changed **download list** so that episode titles are highlighted if possibly all dubs/subs are available
35 lines
No EOL
1.3 KiB
C#
35 lines
No EOL
1.3 KiB
C#
using System.Linq;
|
|
using Avalonia.Controls;
|
|
using Avalonia.VisualTree;
|
|
using CRD.ViewModels.Utils;
|
|
using Image = CRD.Utils.Structs.Image;
|
|
|
|
namespace CRD.Views.Utils;
|
|
|
|
public partial class ContentDialogSeriesDetailsView : UserControl{
|
|
public ContentDialogSeriesDetailsView(){
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void ImageSelectionChanged(object? sender, SelectionChangedEventArgs e){
|
|
if (DataContext is ContentDialogSeriesDetailsViewModel viewModel && sender is ListBox listBox){
|
|
_ = viewModel.DownloadImage((Image)listBox.SelectedItem );
|
|
}
|
|
}
|
|
|
|
private void ListBox_PointerWheelChanged(object sender, Avalonia.Input.PointerWheelEventArgs e){
|
|
var listBox = sender as ListBox;
|
|
var scrollViewer = listBox?.GetVisualDescendants().OfType<ScrollViewer>().FirstOrDefault();
|
|
|
|
if (scrollViewer != null){
|
|
// Determine if the ListBox is at its bounds (top or bottom)
|
|
bool atTop = scrollViewer.Offset.Y <= 0 && e.Delta.Y > 0;
|
|
bool atBottom = scrollViewer.Offset.Y >= scrollViewer.Extent.Height - scrollViewer.Viewport.Height && e.Delta.Y < 0;
|
|
|
|
if (atTop || atBottom){
|
|
e.Handled = true; // Stop the event from propagating to the parent
|
|
}
|
|
}
|
|
}
|
|
|
|
} |