|
|
@ -10,6 +10,7 @@ using DownKyi.Services.Download;
|
|
|
|
using DownKyi.Utils;
|
|
|
|
using DownKyi.Utils;
|
|
|
|
using DownKyi.ViewModels.Dialogs;
|
|
|
|
using DownKyi.ViewModels.Dialogs;
|
|
|
|
using DownKyi.ViewModels.PageViewModels;
|
|
|
|
using DownKyi.ViewModels.PageViewModels;
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using Prism.Commands;
|
|
|
|
using Prism.Commands;
|
|
|
|
using Prism.Events;
|
|
|
|
using Prism.Events;
|
|
|
|
using Prism.Regions;
|
|
|
|
using Prism.Regions;
|
|
|
@ -17,7 +18,9 @@ using Prism.Services.Dialogs;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using System.Runtime.Serialization.Formatters.Binary;
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Windows;
|
|
|
|
using System.Windows;
|
|
|
@ -46,7 +49,13 @@ namespace DownKyi.ViewModels
|
|
|
|
get => inputText;
|
|
|
|
get => inputText;
|
|
|
|
set => SetProperty(ref inputText, value);
|
|
|
|
set => SetProperty(ref inputText, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private string inputSearchText;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string InputSearchText
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => inputSearchText;
|
|
|
|
|
|
|
|
set => SetProperty(ref inputSearchText, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
private GifImage loading;
|
|
|
|
private GifImage loading;
|
|
|
|
public GifImage Loading
|
|
|
|
public GifImage Loading
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -81,7 +90,7 @@ namespace DownKyi.ViewModels
|
|
|
|
get => videoSections;
|
|
|
|
get => videoSections;
|
|
|
|
set => SetProperty(ref videoSections, value);
|
|
|
|
set => SetProperty(ref videoSections, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public ObservableCollection<VideoSection> CaCheVideoSections { get; set; }
|
|
|
|
private bool isSelectAll;
|
|
|
|
private bool isSelectAll;
|
|
|
|
public bool IsSelectAll
|
|
|
|
public bool IsSelectAll
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -125,7 +134,7 @@ namespace DownKyi.ViewModels
|
|
|
|
DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary");
|
|
|
|
DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary");
|
|
|
|
|
|
|
|
|
|
|
|
VideoSections = new ObservableCollection<VideoSection>();
|
|
|
|
VideoSections = new ObservableCollection<VideoSection>();
|
|
|
|
|
|
|
|
CaCheVideoSections = new ObservableCollection<VideoSection>();
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -172,6 +181,41 @@ namespace DownKyi.ViewModels
|
|
|
|
private DelegateCommand inputCommand;
|
|
|
|
private DelegateCommand inputCommand;
|
|
|
|
public DelegateCommand InputCommand => inputCommand ?? (inputCommand = new DelegateCommand(ExecuteInputCommand, CanExecuteInputCommand));
|
|
|
|
public DelegateCommand InputCommand => inputCommand ?? (inputCommand = new DelegateCommand(ExecuteInputCommand, CanExecuteInputCommand));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private DelegateCommand inputSearchCommand;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DelegateCommand InputSearchCommand => inputSearchCommand ?? (inputSearchCommand = new DelegateCommand(ExcuteInputSearchCommand));
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 搜索视频输入时间
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
private async void ExcuteInputSearchCommand() {
|
|
|
|
|
|
|
|
await Task.Run(() =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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 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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 处理输入事件
|
|
|
|
/// 处理输入事件
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -582,6 +626,7 @@ namespace DownKyi.ViewModels
|
|
|
|
NoDataVisibility = Visibility.Collapsed;
|
|
|
|
NoDataVisibility = Visibility.Collapsed;
|
|
|
|
|
|
|
|
|
|
|
|
VideoSections.Clear();
|
|
|
|
VideoSections.Clear();
|
|
|
|
|
|
|
|
CaCheVideoSections.Clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -642,6 +687,7 @@ namespace DownKyi.ViewModels
|
|
|
|
PropertyChangeAsync(new Action(() =>
|
|
|
|
PropertyChangeAsync(new Action(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
VideoSections.Clear();
|
|
|
|
VideoSections.Clear();
|
|
|
|
|
|
|
|
CaCheVideoSections.Clear();
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
// 添加新数据
|
|
|
|
// 添加新数据
|
|
|
@ -660,17 +706,27 @@ namespace DownKyi.ViewModels
|
|
|
|
IsSelected = true,
|
|
|
|
IsSelected = true,
|
|
|
|
VideoPages = pages
|
|
|
|
VideoPages = pages
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
CaCheVideoSections.Add(new VideoSection
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = 0,
|
|
|
|
|
|
|
|
Title = "default",
|
|
|
|
|
|
|
|
IsSelected = true,
|
|
|
|
|
|
|
|
VideoPages = pages
|
|
|
|
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
//这里如果浅拷贝会导致用于查询的CaCheVideoSections数据变化,所以这样处理
|
|
|
|
|
|
|
|
var videoSectionsStr = JsonConvert.SerializeObject(videoSections);
|
|
|
|
|
|
|
|
var videoSectionsData = JsonConvert.DeserializeObject<List<VideoSection>>(videoSectionsStr);
|
|
|
|
PropertyChangeAsync(new Action(() =>
|
|
|
|
PropertyChangeAsync(new Action(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
VideoSections.AddRange(videoSections);
|
|
|
|
VideoSections.AddRange(videoSections);
|
|
|
|
|
|
|
|
CaCheVideoSections.AddRange(videoSectionsData);
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 解析视频流
|
|
|
|
/// 解析视频流
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|