From ec68f26d9b3eebf79dbe4481681d096a204d700d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E5=BD=AA?= <1315508912@qq.com> Date: Wed, 27 Dec 2023 21:23:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=85=A8=E9=80=89?= =?UTF-8?q?=E6=97=A0=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98=20Fixed:=20#11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/ViewVideoDetailViewModel.cs | 28 +++++++++++++++++++ DownKyi/Views/ViewVideoDetail.axaml | 6 ++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/DownKyi/ViewModels/ViewVideoDetailViewModel.cs b/DownKyi/ViewModels/ViewVideoDetailViewModel.cs index adfd5cc..794214b 100644 --- a/DownKyi/ViewModels/ViewVideoDetailViewModel.cs +++ b/DownKyi/ViewModels/ViewVideoDetailViewModel.cs @@ -5,6 +5,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; +using Avalonia.Controls; using DownKyi.Core.BiliApi.BiliUtils; using DownKyi.Core.BiliApi.VideoStream; using DownKyi.Core.Logging; @@ -416,6 +417,33 @@ public class ViewVideoDetailViewModel : ViewModelBase } } + // 全选事件 + private DelegateCommand? _selectAllCommand; + public DelegateCommand SelectAllCommand => _selectAllCommand ??= new DelegateCommand(ExecuteSelectAllCommand); + + /// + /// 全选事件 + /// + /// + private void ExecuteSelectAllCommand(object parameter) + { + if (parameter is not DataGrid dataGrid) + { + return; + } + + if (IsSelectAll) + { + dataGrid.SelectAll(); + } + else + { + dataGrid.SelectedIndex = -1; + selectedVideoPages.Clear(); + } + } + + // 解析视频流事件 private DelegateCommand? _parseCommand; diff --git a/DownKyi/Views/ViewVideoDetail.axaml b/DownKyi/Views/ViewVideoDetail.axaml index 3c3fd0c..6f30b9a 100644 --- a/DownKyi/Views/ViewVideoDetail.axaml +++ b/DownKyi/Views/ViewVideoDetail.axaml @@ -430,11 +430,13 @@ Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Top" - CommandParameter="{Binding ElementName=NameVideoSections, Path=SelectedItem}" + Command="{Binding SelectAllCommand}" + CommandParameter="{Binding ElementName=NameVideoPages,Path=$self}" Content="{DynamicResource SelectAll}" Foreground="{DynamicResource BrushTextDark}" IsChecked="{Binding IsSelectAll, Mode=TwoWay}" - Theme="{StaticResource CheckBoxStyle}" /> + Theme="{StaticResource CheckBoxStyle}"> +