Skip to content

Commit

Permalink
fix: 修复多分类错误应用解析项问题 Fixes: #79
Browse files Browse the repository at this point in the history
  • Loading branch information
yaobiao131 committed May 7, 2024
1 parent 760fda9 commit 4c54db3
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions DownKyi/ViewModels/ViewVideoDetailViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ public bool NoDataVisibility

#endregion

public ViewVideoDetailViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(
eventAggregator, dialogService)
public ViewVideoDetailViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator, dialogService)
{
// 初始化loading
Loading = true;
Expand All @@ -144,7 +143,7 @@ public ViewVideoDetailViewModel(IEventAggregator eventAggregator, IDialogService

#region 命令申明

// 返回
// 返回
private DelegateCommand? _backSpaceCommand;

public DelegateCommand BackSpaceCommand => _backSpaceCommand ??= new DelegateCommand(ExecuteBackSpace);
Expand All @@ -166,8 +165,7 @@ private void ExecuteBackSpace()
// 前往下载管理页面
private DelegateCommand? _downloadManagerCommand;

public DelegateCommand DownloadManagerCommand =>
_downloadManagerCommand ??= new DelegateCommand(ExecuteDownloadManagerCommand);
public DelegateCommand DownloadManagerCommand => _downloadManagerCommand ??= new DelegateCommand(ExecuteDownloadManagerCommand);

/// <summary>
/// 前往下载管理页面
Expand All @@ -186,8 +184,7 @@ private void ExecuteDownloadManagerCommand()
// 输入确认事件
private DelegateCommand? _inputCommand;

public DelegateCommand InputCommand =>
_inputCommand ??= new DelegateCommand(ExecuteInputCommand, CanExecuteInputCommand);
public DelegateCommand InputCommand => _inputCommand ??= new DelegateCommand(ExecuteInputCommand, CanExecuteInputCommand);


private DelegateCommand? _inputSearchCommand;
Expand All @@ -201,9 +198,9 @@ private async void ExecuteInputSearchCommand()
{
await Task.Run(() =>
{
if (InputSearchText == null || InputSearchText == string.Empty)
if (string.IsNullOrEmpty(InputSearchText))
{
foreach (VideoSection section in VideoSections)
foreach (var section in VideoSections)
{
var cache = CaCheVideoSections.FirstOrDefault(e => e.Id == section.Id);
if (cache != null)
Expand All @@ -214,7 +211,7 @@ await Task.Run(() =>
}
else
{
foreach (VideoSection section in VideoSections)
foreach (var section in VideoSections)
{
var cache = CaCheVideoSections.FirstOrDefault(e => e.Id == section.Id);
if (cache != null)
Expand All @@ -237,7 +234,7 @@ private async void ExecuteInputCommand()
{
await Task.Run(() =>
{
if (InputText == null || InputText == string.Empty)
if (string.IsNullOrEmpty(InputText))
{
return;
}
Expand Down Expand Up @@ -321,16 +318,15 @@ private void ExecuteUpperCommand()
// 视频章节选择事件
private DelegateCommand<object>? _videoSectionsCommand;

public DelegateCommand<object> VideoSectionsCommand =>
_videoSectionsCommand ??= new DelegateCommand<object>(ExecuteVideoSectionsCommand);
public DelegateCommand<object> VideoSectionsCommand => _videoSectionsCommand ??= new DelegateCommand<object>(ExecuteVideoSectionsCommand);

/// <summary>
/// 视频章节选择事件
/// </summary>
/// <param name="parameter"></param>
private void ExecuteVideoSectionsCommand(object parameter)
{
if (!(parameter is VideoSection section))
if (parameter is not VideoSection section)
{
return;
}
Expand Down Expand Up @@ -527,7 +523,7 @@ await Task.Run(() =>
{
foreach (var page in section.VideoPages)
{
if (selectedVideoPages.Find(v => v.Order == page.Order) != null)
if (selectedVideoPages.Find(v => v.Bvid == page.Bvid) != null)
{
UnityUpdateView(ParseVideo, _input, page);
}
Expand Down

0 comments on commit 4c54db3

Please sign in to comment.