mirror of
https://github.com/leiurayer/downkyi.git
synced 2026-10-20 00:17:44 +00:00
完成Publication页面
This commit is contained in:
@@ -198,6 +198,8 @@ namespace DownKyi
|
||||
/// <param name="callback"></param>
|
||||
public static void PropertyChangeAsync(Action callback)
|
||||
{
|
||||
if (Current == null) { return; }
|
||||
|
||||
Current.Dispatcher.Invoke(callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,11 +16,18 @@ namespace DownKyi.CustomControl
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
// Current修改的回调
|
||||
public delegate void CurrentChangedHandler(int current);
|
||||
public delegate bool CurrentChangedHandler(int old, int current);
|
||||
public event CurrentChangedHandler CurrentChanged;
|
||||
protected virtual void OnCurrentChanged(int current)
|
||||
protected virtual bool OnCurrentChanged(int old, int current)
|
||||
{
|
||||
CurrentChanged?.Invoke(current);
|
||||
if (CurrentChanged == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CurrentChanged.Invoke(old, current);
|
||||
}
|
||||
}
|
||||
|
||||
// Count修改的回调
|
||||
@@ -65,8 +72,6 @@ namespace DownKyi.CustomControl
|
||||
if (count == 1) { Visibility = Visibility.Hidden; }
|
||||
else { Visibility = Visibility.Visible; }
|
||||
|
||||
//SetView();
|
||||
|
||||
OnCountChanged(count);
|
||||
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Count"));
|
||||
@@ -90,13 +95,13 @@ namespace DownKyi.CustomControl
|
||||
}
|
||||
else
|
||||
{
|
||||
current = value;
|
||||
bool isSuccess = OnCurrentChanged(current, value);
|
||||
if (isSuccess)
|
||||
{
|
||||
current = value;
|
||||
|
||||
//SetView();
|
||||
|
||||
OnCurrentChanged(current);
|
||||
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Current"));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Current"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
<Compile Include="Services\SearchService.cs" />
|
||||
<Compile Include="ViewModels\PageViewModels\Favorites.cs" />
|
||||
<Compile Include="ViewModels\PageViewModels\FavoritesMedia.cs" />
|
||||
<Compile Include="ViewModels\PageViewModels\PublicationMedia.cs" />
|
||||
<Compile Include="ViewModels\PageViewModels\SpaceItem.cs" />
|
||||
<Compile Include="ViewModels\Settings\DisplayFileNamePart.cs" />
|
||||
<Compile Include="Models\ParseScopeDisplay.cs" />
|
||||
@@ -514,6 +515,8 @@
|
||||
<Resource Include="Resources\level\lv9.png" />
|
||||
<Resource Include="Resources\video-placeholder.png" />
|
||||
<Resource Include="Resources\channel.png" />
|
||||
<Resource Include="Resources\play.png" />
|
||||
<Resource Include="Resources\time.png" />
|
||||
<Content Include="打不开DownKyi请点我.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
<system:String x:Key="AllPublicationZones">全部</system:String>
|
||||
<system:String x:Key="Publication">投稿视频</system:String>
|
||||
<system:String x:Key="Channel">频道</system:String>
|
||||
<system:String x:Key="UserSpaceWait">请稍等,马上就好~</system:String>
|
||||
|
||||
<!-- PublicFavorites -->
|
||||
<system:String x:Key="PublicFavorites">收藏夹</system:String>
|
||||
@@ -71,6 +72,7 @@
|
||||
<!-- Publication -->
|
||||
<system:String x:Key="DownloadSelectedPublication">下载选中项</system:String>
|
||||
<system:String x:Key="DownloadAllPublication">下载全部</system:String>
|
||||
<system:String x:Key="PublicationWait">请稍等,马上就好~</system:String>
|
||||
|
||||
<!-- VideoDetail -->
|
||||
<system:String x:Key="CopyCover">复制封面图片</system:String>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 229 B |
Binary file not shown.
|
After Width: | Height: | Size: 269 B |
@@ -0,0 +1,71 @@
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace DownKyi.ViewModels.PageViewModels
|
||||
{
|
||||
public class PublicationMedia : BindableBase
|
||||
{
|
||||
public long Avid { get; set; }
|
||||
public string Bvid { get; set; }
|
||||
|
||||
private bool isSelected;
|
||||
public bool IsSelected
|
||||
{
|
||||
get => isSelected;
|
||||
set => SetProperty(ref isSelected, value);
|
||||
}
|
||||
|
||||
private BitmapImage cover;
|
||||
public BitmapImage Cover
|
||||
{
|
||||
get => cover;
|
||||
set => SetProperty(ref cover, value);
|
||||
}
|
||||
|
||||
private string title;
|
||||
public string Title
|
||||
{
|
||||
get => title;
|
||||
set => SetProperty(ref title, value);
|
||||
}
|
||||
|
||||
private string duration;
|
||||
public string Duration
|
||||
{
|
||||
get => duration;
|
||||
set => SetProperty(ref duration, value);
|
||||
}
|
||||
|
||||
private string playNumber;
|
||||
public string PlayNumber
|
||||
{
|
||||
get => playNumber;
|
||||
set => SetProperty(ref playNumber, value);
|
||||
}
|
||||
|
||||
private string createTime;
|
||||
public string CreateTime
|
||||
{
|
||||
get => createTime;
|
||||
set => SetProperty(ref createTime, value);
|
||||
}
|
||||
|
||||
// 视频标题点击事件
|
||||
private DelegateCommand<object> titleCommand;
|
||||
public DelegateCommand<object> TitleCommand => titleCommand ?? (titleCommand = new DelegateCommand<object>(ExecuteTitleCommand));
|
||||
|
||||
/// <summary>
|
||||
/// 视频标题点击事件
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
private void ExecuteTitleCommand(object parameter)
|
||||
{
|
||||
if (!(parameter is string tag)) { return; }
|
||||
|
||||
string url = "https://www.bilibili.com/video/" + tag;
|
||||
System.Diagnostics.Process.Start(url);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -119,6 +119,8 @@ namespace DownKyi.ViewModels
|
||||
//// 进入设置页面时显示的设置项
|
||||
SelectTabId = 0;
|
||||
regionManager.RequestNavigate("DownloadManagerContentRegion", ViewDownloadingViewModel.Tag, new NavigationParameters());
|
||||
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ namespace DownKyi.ViewModels
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
#region 命令申明
|
||||
|
||||
// 返回
|
||||
@@ -92,7 +91,6 @@ namespace DownKyi.ViewModels
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 业务逻辑
|
||||
|
||||
/// <summary>
|
||||
@@ -224,6 +222,8 @@ namespace DownKyi.ViewModels
|
||||
/// </summary>
|
||||
private void InitStatus()
|
||||
{
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
|
||||
|
||||
LoginQRCode = null;
|
||||
LoginQRCodeOpacity = 1;
|
||||
LoginQRCodeStatus = Visibility.Hidden;
|
||||
|
||||
@@ -212,6 +212,11 @@ namespace DownKyi.ViewModels
|
||||
}
|
||||
});
|
||||
|
||||
if (directory == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 通知用户添加到下载列表的结果
|
||||
if (i == 0)
|
||||
{
|
||||
@@ -230,6 +235,8 @@ namespace DownKyi.ViewModels
|
||||
{
|
||||
LogManager.Debug(Tag, "初始化页面元素");
|
||||
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
|
||||
|
||||
ContentVisibility = Visibility.Collapsed;
|
||||
NoDataVisibility = Visibility.Collapsed;
|
||||
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
using DownKyi.Events;
|
||||
using DownKyi.Images;
|
||||
using DownKyi.Core.BiliApi.VideoStream;
|
||||
using DownKyi.Core.Storage;
|
||||
using DownKyi.Core.Utils;
|
||||
using DownKyi.CustomControl;
|
||||
using DownKyi.Events;
|
||||
using DownKyi.Images;
|
||||
using DownKyi.Services;
|
||||
using DownKyi.Services.Download;
|
||||
using DownKyi.Utils;
|
||||
using DownKyi.ViewModels.PageViewModels;
|
||||
using DownKyi.ViewModels.UserSpace;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace DownKyi.ViewModels
|
||||
{
|
||||
@@ -20,6 +29,10 @@ namespace DownKyi.ViewModels
|
||||
{
|
||||
public const string Tag = "PagePublication";
|
||||
|
||||
private readonly IDialogService dialogService;
|
||||
|
||||
private CancellationTokenSource tokenSource;
|
||||
|
||||
private long mid = -1;
|
||||
|
||||
// 每页视频数量,暂时在此写死,以后在设置中增加选项
|
||||
@@ -27,6 +40,27 @@ namespace DownKyi.ViewModels
|
||||
|
||||
#region 页面属性申明
|
||||
|
||||
private GifImage loading;
|
||||
public GifImage Loading
|
||||
{
|
||||
get => loading;
|
||||
set => SetProperty(ref loading, value);
|
||||
}
|
||||
|
||||
private Visibility loadingVisibility;
|
||||
public Visibility LoadingVisibility
|
||||
{
|
||||
get => loadingVisibility;
|
||||
set => SetProperty(ref loadingVisibility, value);
|
||||
}
|
||||
|
||||
private Visibility noDataVisibility;
|
||||
public Visibility NoDataVisibility
|
||||
{
|
||||
get => noDataVisibility;
|
||||
set => SetProperty(ref noDataVisibility, value);
|
||||
}
|
||||
|
||||
private VectorImage arrowBack;
|
||||
public VectorImage ArrowBack
|
||||
{
|
||||
@@ -48,18 +82,11 @@ namespace DownKyi.ViewModels
|
||||
set => SetProperty(ref selectTabId, value);
|
||||
}
|
||||
|
||||
private int countPage;
|
||||
public int CountPage
|
||||
private bool isEnabled = true;
|
||||
public bool IsEnabled
|
||||
{
|
||||
get => countPage;
|
||||
set => SetProperty(ref countPage, value);
|
||||
}
|
||||
|
||||
private int currentPage;
|
||||
public int CurrentPage
|
||||
{
|
||||
get => currentPage;
|
||||
set => SetProperty(ref currentPage, value);
|
||||
get => isEnabled;
|
||||
set => SetProperty(ref isEnabled, value);
|
||||
}
|
||||
|
||||
private CustomPagerViewModel pager;
|
||||
@@ -69,16 +96,39 @@ namespace DownKyi.ViewModels
|
||||
set => SetProperty(ref pager, value);
|
||||
}
|
||||
|
||||
private ObservableCollection<PublicationMedia> medias;
|
||||
public ObservableCollection<PublicationMedia> Medias
|
||||
{
|
||||
get => medias;
|
||||
set => SetProperty(ref medias, value);
|
||||
}
|
||||
|
||||
private bool isSelectAll;
|
||||
public bool IsSelectAll
|
||||
{
|
||||
get => isSelectAll;
|
||||
set => SetProperty(ref isSelectAll, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public ViewPublicationViewModel(IEventAggregator eventAggregator) : base(eventAggregator)
|
||||
public ViewPublicationViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator)
|
||||
{
|
||||
this.dialogService = dialogService;
|
||||
|
||||
#region 属性初始化
|
||||
|
||||
// 初始化loading gif
|
||||
Loading = new GifImage(Properties.Resources.loading);
|
||||
Loading.StartAnimate();
|
||||
LoadingVisibility = Visibility.Collapsed;
|
||||
NoDataVisibility = Visibility.Collapsed;
|
||||
|
||||
ArrowBack = NavigationIcon.Instance().ArrowBack;
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
|
||||
|
||||
TabHeaders = new ObservableCollection<TabHeader>();
|
||||
Medias = new ObservableCollection<PublicationMedia>();
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -96,6 +146,9 @@ namespace DownKyi.ViewModels
|
||||
{
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorText");
|
||||
|
||||
// 结束任务
|
||||
tokenSource.Cancel();
|
||||
|
||||
NavigationParam parameter = new NavigationParam
|
||||
{
|
||||
ViewName = ParentView,
|
||||
@@ -107,7 +160,7 @@ namespace DownKyi.ViewModels
|
||||
|
||||
// 左侧tab点击事件
|
||||
private DelegateCommand<object> leftTabHeadersCommand;
|
||||
public DelegateCommand<object> LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand<object>(ExecuteLeftTabHeadersCommand));
|
||||
public DelegateCommand<object> LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand<object>(ExecuteLeftTabHeadersCommand, CanExecuteLeftTabHeadersCommand));
|
||||
|
||||
/// <summary>
|
||||
/// 左侧tab点击事件
|
||||
@@ -121,15 +174,251 @@ namespace DownKyi.ViewModels
|
||||
Pager = new CustomPagerViewModel(1, (int)Math.Ceiling(double.Parse(tabHeader.SubTitle) / VideoNumberInPage));
|
||||
Pager.CurrentChanged += OnCurrentChanged_Pager;
|
||||
Pager.CountChanged += OnCountChanged_Pager;
|
||||
Pager.Current = 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 左侧tab点击事件是否允许执行
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
/// <returns></returns>
|
||||
private bool CanExecuteLeftTabHeadersCommand(object parameter)
|
||||
{
|
||||
return IsEnabled;
|
||||
}
|
||||
|
||||
// 全选按钮点击事件
|
||||
private DelegateCommand<object> selectAllCommand;
|
||||
public DelegateCommand<object> SelectAllCommand => selectAllCommand ?? (selectAllCommand = new DelegateCommand<object>(ExecuteSelectAllCommand));
|
||||
|
||||
/// <summary>
|
||||
/// 全选按钮点击事件
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
private void ExecuteSelectAllCommand(object parameter)
|
||||
{
|
||||
if (IsSelectAll)
|
||||
{
|
||||
foreach (var item in Medias)
|
||||
{
|
||||
item.IsSelected = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in Medias)
|
||||
{
|
||||
item.IsSelected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 列表选择事件
|
||||
private DelegateCommand<object> mediasCommand;
|
||||
public DelegateCommand<object> MediasCommand => mediasCommand ?? (mediasCommand = new DelegateCommand<object>(ExecuteMediasCommand));
|
||||
|
||||
/// <summary>
|
||||
/// 列表选择事件
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
private void ExecuteMediasCommand(object parameter)
|
||||
{
|
||||
if (!(parameter is IList selectedMedia)) { return; }
|
||||
|
||||
if (selectedMedia.Count == Medias.Count)
|
||||
{
|
||||
IsSelectAll = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsSelectAll = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加选中项到下载列表事件
|
||||
private DelegateCommand addToDownloadCommand;
|
||||
public DelegateCommand AddToDownloadCommand => addToDownloadCommand ?? (addToDownloadCommand = new DelegateCommand(ExecuteAddToDownloadCommand));
|
||||
|
||||
/// <summary>
|
||||
/// 添加选中项到下载列表事件
|
||||
/// </summary>
|
||||
private void ExecuteAddToDownloadCommand()
|
||||
{
|
||||
AddToDownload(true);
|
||||
}
|
||||
|
||||
// 添加所有视频到下载列表事件
|
||||
private DelegateCommand addAllToDownloadCommand;
|
||||
public DelegateCommand AddAllToDownloadCommand => addAllToDownloadCommand ?? (addAllToDownloadCommand = new DelegateCommand(ExecuteAddAllToDownloadCommand));
|
||||
|
||||
/// <summary>
|
||||
/// 添加所有视频到下载列表事件
|
||||
/// </summary>
|
||||
private void ExecuteAddAllToDownloadCommand()
|
||||
{
|
||||
AddToDownload(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private async void AddToDownload(bool isOnlySelected)
|
||||
{
|
||||
// 收藏夹里只有视频
|
||||
AddToDownloadService addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO);
|
||||
|
||||
// 选择文件夹
|
||||
string directory = addToDownloadService.SetDirectory(dialogService);
|
||||
|
||||
// 视频计数
|
||||
int i = 0;
|
||||
await Task.Run(() =>
|
||||
{
|
||||
// 添加到下载
|
||||
foreach (var media in Medias)
|
||||
{
|
||||
// 只下载选中项,跳过未选中项
|
||||
if (isOnlySelected && !media.IsSelected) { continue; }
|
||||
|
||||
/// 有分P的就下载全部
|
||||
|
||||
// 开启服务
|
||||
VideoInfoService videoInfoService = new VideoInfoService(media.Bvid);
|
||||
|
||||
addToDownloadService.SetVideoInfoService(videoInfoService);
|
||||
addToDownloadService.GetVideo();
|
||||
addToDownloadService.ParseVideo(videoInfoService);
|
||||
// 下载
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, directory);
|
||||
}
|
||||
});
|
||||
|
||||
if (directory == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 通知用户添加到下载列表的结果
|
||||
if (i == 0)
|
||||
{
|
||||
eventAggregator.GetEvent<MessageEvent>().Publish(DictionaryResource.GetString("TipAddDownloadingZero"));
|
||||
}
|
||||
else
|
||||
{
|
||||
eventAggregator.GetEvent<MessageEvent>().Publish($"{DictionaryResource.GetString("TipAddDownloadingFinished1")}{i}{DictionaryResource.GetString("TipAddDownloadingFinished2")}");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCountChanged_Pager(int count) { }
|
||||
|
||||
private void OnCurrentChanged_Pager(int current)
|
||||
private bool OnCurrentChanged_Pager(int old, int current)
|
||||
{
|
||||
Console.WriteLine(current);
|
||||
if (!IsEnabled)
|
||||
{
|
||||
//Pager.Current = old;
|
||||
return false;
|
||||
}
|
||||
|
||||
Medias.Clear();
|
||||
LoadingVisibility = Visibility.Visible;
|
||||
NoDataVisibility = Visibility.Collapsed;
|
||||
|
||||
UpdatePublication(current);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private async void UpdatePublication(int current)
|
||||
{
|
||||
// 是否正在获取数据
|
||||
// 在所有的退出分支中都需要设为true
|
||||
IsEnabled = false;
|
||||
|
||||
var tab = TabHeaders[SelectTabId];
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
CancellationToken cancellationToken = tokenSource.Token;
|
||||
|
||||
var publications = Core.BiliApi.Users.UserSpace.GetPublication(mid, current, VideoNumberInPage, tab.Id);
|
||||
if (publications == null)
|
||||
{
|
||||
// 没有数据,UI提示
|
||||
LoadingVisibility = Visibility.Collapsed;
|
||||
NoDataVisibility = Visibility.Visible;
|
||||
return;
|
||||
}
|
||||
|
||||
var videos = publications.Vlist;
|
||||
if (videos == null)
|
||||
{
|
||||
// 没有数据,UI提示
|
||||
LoadingVisibility = Visibility.Collapsed;
|
||||
NoDataVisibility = Visibility.Visible;
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var video in videos)
|
||||
{
|
||||
// 查询、保存封面
|
||||
string coverUrl = video.Pic;
|
||||
BitmapImage cover;
|
||||
if (coverUrl == null || coverUrl == "")
|
||||
{
|
||||
cover = new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!coverUrl.ToLower().StartsWith("http"))
|
||||
{
|
||||
coverUrl = $"https:{video.Pic}";
|
||||
}
|
||||
|
||||
StorageCover storageCover = new StorageCover();
|
||||
cover = storageCover.GetCoverThumbnail(video.Aid, video.Bvid, -1, coverUrl, 200, 125);
|
||||
}
|
||||
|
||||
// 播放数
|
||||
string play = string.Empty;
|
||||
if (video.Play > 0)
|
||||
{
|
||||
play = Format.FormatNumber(video.Play);
|
||||
}
|
||||
else
|
||||
{
|
||||
play = "--";
|
||||
}
|
||||
|
||||
DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区
|
||||
DateTime dateCTime = startTime.AddSeconds(video.Created);
|
||||
string ctime = dateCTime.ToString("yyyy-MM-dd");
|
||||
|
||||
App.PropertyChangeAsync(new Action(() =>
|
||||
{
|
||||
PublicationMedia media = new PublicationMedia
|
||||
{
|
||||
Avid = video.Aid,
|
||||
Bvid = video.Bvid,
|
||||
Cover = cover,
|
||||
Duration = video.Length,
|
||||
Title = video.Title,
|
||||
PlayNumber = play,
|
||||
CreateTime = ctime
|
||||
};
|
||||
medias.Add(media);
|
||||
|
||||
LoadingVisibility = Visibility.Collapsed;
|
||||
NoDataVisibility = Visibility.Collapsed;
|
||||
}));
|
||||
|
||||
// 判断是否该结束线程,若为true,跳出循环
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}, (tokenSource = new CancellationTokenSource()).Token);
|
||||
IsEnabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -182,6 +471,7 @@ namespace DownKyi.ViewModels
|
||||
Pager = new CustomPagerViewModel(1, (int)Math.Ceiling(double.Parse(selectTab.SubTitle) / VideoNumberInPage));
|
||||
Pager.CurrentChanged += OnCurrentChanged_Pager;
|
||||
Pager.CountChanged += OnCountChanged_Pager;
|
||||
Pager.Current = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -131,6 +131,8 @@ namespace DownKyi.ViewModels
|
||||
// 进入设置页面时显示的设置项
|
||||
SelectTabId = 0;
|
||||
regionManager.RequestNavigate("SettingsContentRegion", ViewBasicViewModel.Tag, new NavigationParameters());
|
||||
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -122,6 +122,8 @@ namespace DownKyi.ViewModels
|
||||
// 进入设置页面时显示的设置项
|
||||
SelectTabId = 0;
|
||||
regionManager.RequestNavigate("ToolboxContentRegion", ViewBiliHelperViewModel.Tag, new NavigationParameters());
|
||||
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -665,6 +665,8 @@ namespace DownKyi.ViewModels
|
||||
{
|
||||
base.OnNavigatedTo(navigationContext);
|
||||
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
|
||||
|
||||
DownloadManage = ButtonIcon.Instance().DownloadManage;
|
||||
DownloadManage.Height = 24;
|
||||
DownloadManage.Width = 24;
|
||||
|
||||
@@ -6,7 +6,115 @@
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True">
|
||||
<UserControl.Resources />
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="MediaListStyle" TargetType="{x:Type ListBoxItem}">
|
||||
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||||
<StackPanel
|
||||
Name="nameItemPanel"
|
||||
Margin="15,15,15,5"
|
||||
Cursor="Hand"
|
||||
Orientation="Vertical">
|
||||
<Border
|
||||
Name="nameCover"
|
||||
Width="190"
|
||||
Height="119"
|
||||
HorizontalAlignment="Center"
|
||||
CornerRadius="5">
|
||||
<Border.Background>
|
||||
<!-- 长宽比:1.6 -->
|
||||
<ImageBrush ImageSource="{Binding Cover}" />
|
||||
</Border.Background>
|
||||
|
||||
<Grid Width="190" Height="119">
|
||||
<Image
|
||||
Name="nameChecked"
|
||||
Width="24"
|
||||
Height="24"
|
||||
Margin="0,10,10,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Source="/DownKyi;component/Resources/checked.png" />
|
||||
|
||||
<Border
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Background="#7F000000"
|
||||
CornerRadius="5 0 5 0">
|
||||
<TextBlock
|
||||
Name="nameDuration"
|
||||
Padding="6,0"
|
||||
Foreground="White"
|
||||
Text="{Binding Duration}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<TextBlock
|
||||
Name="nameTitle"
|
||||
Height="35"
|
||||
MaxWidth="190"
|
||||
Margin="0,10,0,0"
|
||||
Foreground="Black"
|
||||
Tag="{Binding Bvid}"
|
||||
Text="{Binding Title}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="Wrap"
|
||||
ToolTip="{Binding Title}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseLeftButtonUp">
|
||||
<i:InvokeCommandAction Command="{Binding TitleCommand}" CommandParameter="{Binding Bvid}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBlock>
|
||||
|
||||
<Grid Margin="0,3,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<Image
|
||||
Width="11"
|
||||
Height="11"
|
||||
Source="/DownKyi;component/Resources/play.png" />
|
||||
<TextBlock
|
||||
Margin="5,0,0,0"
|
||||
Foreground="#FF999999"
|
||||
Text="{Binding PlayNumber}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||
<Image
|
||||
Width="12"
|
||||
Height="11"
|
||||
Source="/DownKyi;component/Resources/time.png" />
|
||||
<TextBlock
|
||||
Margin="5,0,0,0"
|
||||
Foreground="#FF999999"
|
||||
Text="{Binding CreateTime}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="nameChecked" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="False">
|
||||
<Setter TargetName="nameChecked" Property="Visibility" Value="Hidden" />
|
||||
</Trigger>
|
||||
<Trigger SourceName="nameTitle" Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="nameTitle" Property="Foreground" Value="{DynamicResource BrushPrimary}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
@@ -49,7 +157,7 @@
|
||||
|
||||
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
|
||||
|
||||
<Grid Grid.Row="2" Visibility="{Binding ContentVisibility}">
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition />
|
||||
@@ -60,6 +168,7 @@
|
||||
Name="nameLeftTabHeaders"
|
||||
Grid.Column="0"
|
||||
BorderThickness="0"
|
||||
IsEnabled="{Binding IsEnabled}"
|
||||
ItemContainerStyle="{StaticResource LeftTabHeaderItemStyle}"
|
||||
ItemsSource="{Binding TabHeaders}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
@@ -80,14 +189,72 @@
|
||||
<RowDefinition Height="49" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ListBox Grid.Row="0" SelectionMode="Extended">
|
||||
<ListBox
|
||||
x:Name="nameMedias"
|
||||
Grid.Row="0"
|
||||
BorderThickness="0"
|
||||
ItemContainerStyle="{StaticResource MediaListStyle}"
|
||||
ItemsSource="{Binding Medias}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
SelectionMode="Extended">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding MediasCommand}" CommandParameter="{Binding ElementName=nameMedias, Path=SelectedItems}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel IsItemsHost="True" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.Style>
|
||||
<Style TargetType="ListBox">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBox">
|
||||
<Border
|
||||
x:Name="Bd"
|
||||
Padding="0"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<ScrollViewer Focusable="False">
|
||||
<ItemsPresenter />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ListBox.Style>
|
||||
</ListBox>
|
||||
|
||||
<!-- 加载gif -->
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Vertical"
|
||||
Visibility="{Binding LoadingVisibility}">
|
||||
<ContentControl
|
||||
Width="40"
|
||||
Height="40"
|
||||
Content="{Binding Loading}" />
|
||||
<TextBlock
|
||||
Margin="0,10,0,0"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource BrushTextDark}"
|
||||
Text="{DynamicResource PublicationWait}" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- 没有数据提示 -->
|
||||
<Image
|
||||
Grid.Row="0"
|
||||
Width="256"
|
||||
Height="256"
|
||||
Source="/DownKyi;component/Resources/no-data.png"
|
||||
Visibility="{Binding NoDataVisibility}" />
|
||||
|
||||
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
|
||||
|
||||
<Grid Grid.Row="2">
|
||||
@@ -104,7 +271,7 @@
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding SelectAllCommand}"
|
||||
CommandParameter="{Binding ElementName=nameVideoSections, Path=SelectedItem}"
|
||||
CommandParameter="{Binding ElementName=nameMedias, Path=SelectedItem}"
|
||||
Content="{DynamicResource SelectAll}"
|
||||
Foreground="{DynamicResource BrushTextDark}"
|
||||
IsChecked="{Binding IsSelectAll, Mode=TwoWay}"
|
||||
@@ -132,7 +299,7 @@
|
||||
Margin="0,0,10,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding AddAllCommand}"
|
||||
Command="{Binding AddAllToDownloadCommand}"
|
||||
Content="{DynamicResource DownloadAllPublication}"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource BrushText}"
|
||||
@@ -141,13 +308,5 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- 没有数据提示 -->
|
||||
<Image
|
||||
Grid.Row="2"
|
||||
Width="256"
|
||||
Height="256"
|
||||
Source="/DownKyi;component/Resources/no-data.png"
|
||||
Visibility="{Binding NoDataVisibility}" />
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -313,7 +313,7 @@
|
||||
Margin="0,10,0,0"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource BrushTextDark}"
|
||||
Text="{DynamicResource MySpaceWait}" />
|
||||
Text="{DynamicResource UserSpaceWait}" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- 没有数据提示 -->
|
||||
|
||||
Reference in New Issue
Block a user