Crunchy-Downloader/CRD/Views/Utils/ContentDialogSeriesDetailsView.axaml.cs
Elwador 15c62193ca - Added **second endpoint settings** that can be freely adjusted
- 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
2025-09-06 17:39:20 +02:00

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
}
}
}
}