From 4941e2df97aa63094ed818445fa756f7c394ce58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=9D=E5=8D=81?= <392706283@qq.com> Date: Thu, 6 Apr 2023 20:41:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=90=9C=E7=B4=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/ViewVideoDetailViewModel.cs | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/DownKyi/ViewModels/ViewVideoDetailViewModel.cs b/src/DownKyi/ViewModels/ViewVideoDetailViewModel.cs index 0090ae3..7e87fd2 100644 --- a/src/DownKyi/ViewModels/ViewVideoDetailViewModel.cs +++ b/src/DownKyi/ViewModels/ViewVideoDetailViewModel.cs @@ -188,18 +188,27 @@ namespace DownKyi.ViewModels private async void ExcuteInputSearchCommand() { await Task.Run(() => { - if (InputSearchText == null || InputSearchText == string.Empty) { - PropertyChangeAsync(new Action(() => - { - VideoSections = CaCheVideoSections; - })); + if (InputSearchText == null || InputSearchText == string.Empty) + { + foreach (VideoSection section in VideoSections) { + var cache= CaCheVideoSections.FirstOrDefault(e=>e.Id==section.Id); + if (cache!=null) + { + section.VideoPages=cache.VideoPages; + } + } } else { foreach (VideoSection section in VideoSections) { - var pages= section.VideoPages.Where(e=>e.Name.Contains(InputSearchText)).ToList(); - section.VideoPages = pages; + var cache = CaCheVideoSections.FirstOrDefault(e => e.Id == section.Id); + if (cache != null) + { + var pages = cache.VideoPages.Where(e => e.Name.Contains(InputSearchText)).ToList(); + section.VideoPages = pages; + } + } } }); @@ -694,7 +703,13 @@ namespace DownKyi.ViewModels IsSelected = true, VideoPages = pages }); - CaCheVideoSections = VideoSections; + CaCheVideoSections.Add(new VideoSection + { + Id = 0, + Title = "default", + IsSelected = true, + VideoPages = pages + }); })); } else