增加搜索功能

pull/708/head
初十 2 years ago
parent d0ba992d33
commit 4941e2df97

@ -188,19 +188,28 @@ namespace DownKyi.ViewModels
private async void ExcuteInputSearchCommand() { private async void ExcuteInputSearchCommand() {
await Task.Run(() => await Task.Run(() =>
{ {
if (InputSearchText == null || InputSearchText == string.Empty) { if (InputSearchText == null || InputSearchText == string.Empty)
PropertyChangeAsync(new Action(() =>
{ {
VideoSections = CaCheVideoSections; foreach (VideoSection section in VideoSections) {
})); var cache= CaCheVideoSections.FirstOrDefault(e=>e.Id==section.Id);
if (cache!=null)
{
section.VideoPages=cache.VideoPages;
}
}
} }
else else
{ {
foreach (VideoSection section in VideoSections) foreach (VideoSection section in VideoSections)
{ {
var pages= section.VideoPages.Where(e=>e.Name.Contains(InputSearchText)).ToList(); 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; section.VideoPages = pages;
} }
}
} }
}); });
} }
@ -694,7 +703,13 @@ namespace DownKyi.ViewModels
IsSelected = true, IsSelected = true,
VideoPages = pages VideoPages = pages
}); });
CaCheVideoSections = VideoSections; CaCheVideoSections.Add(new VideoSection
{
Id = 0,
Title = "default",
IsSelected = true,
VideoPages = pages
});
})); }));
} }
else else

Loading…
Cancel
Save