PagePublicFavorites开发工作中,20211023暂存

croire 3 years ago
parent 9e685be6a2
commit 653aff5a02

@ -87,6 +87,8 @@
<Compile Include="Images\LogoIcon.cs" /> <Compile Include="Images\LogoIcon.cs" />
<Compile Include="Images\NavigationIcon.cs" /> <Compile Include="Images\NavigationIcon.cs" />
<Compile Include="Images\NormalIcon.cs" /> <Compile Include="Images\NormalIcon.cs" />
<Compile Include="Models\Favorites.cs" />
<Compile Include="Models\FavoritesMedia.cs" />
<Compile Include="Models\ParseScopeDisplay.cs" /> <Compile Include="Models\ParseScopeDisplay.cs" />
<Compile Include="Models\Resolution.cs" /> <Compile Include="Models\Resolution.cs" />
<Compile Include="Models\TabHeader.cs" /> <Compile Include="Models\TabHeader.cs" />
@ -96,6 +98,8 @@
<Compile Include="Models\VideoSection.cs" /> <Compile Include="Models\VideoSection.cs" />
<Compile Include="Services\BangumiInfoService.cs" /> <Compile Include="Services\BangumiInfoService.cs" />
<Compile Include="Services\CheeseInfoService.cs" /> <Compile Include="Services\CheeseInfoService.cs" />
<Compile Include="Services\FavoritesService.cs" />
<Compile Include="Services\IFavoritesService.cs" />
<Compile Include="Services\IInfoService.cs" /> <Compile Include="Services\IInfoService.cs" />
<Compile Include="Services\IResolutionService.cs" /> <Compile Include="Services\IResolutionService.cs" />
<Compile Include="Services\ResolutionService.cs" /> <Compile Include="Services\ResolutionService.cs" />
@ -104,6 +108,7 @@
<Compile Include="Utils\ClipboardHooker.cs" /> <Compile Include="Utils\ClipboardHooker.cs" />
<Compile Include="Utils\DialogUtils.cs" /> <Compile Include="Utils\DialogUtils.cs" />
<Compile Include="Utils\DictionaryResource.cs" /> <Compile Include="Utils\DictionaryResource.cs" />
<Compile Include="Utils\NavigateToView.cs" />
<Compile Include="ViewModels\BaseViewModel.cs" /> <Compile Include="ViewModels\BaseViewModel.cs" />
<Compile Include="ViewModels\Dialogs\ViewDownloadSetterViewModel.cs" /> <Compile Include="ViewModels\Dialogs\ViewDownloadSetterViewModel.cs" />
<Compile Include="ViewModels\Dialogs\BaseDialogViewModel.cs" /> <Compile Include="ViewModels\Dialogs\BaseDialogViewModel.cs" />

@ -14,6 +14,54 @@
public NormalIcon() public NormalIcon()
{ {
Play = new VectorImage
{
Height = 16,
Width = 14.75,
Data = @"M869.03 707.93 l-465.29 281.31 q-86.66 49.32 -178.65 28.65 q-91.99 -20.66 -146.65 -103.31 q-36 -56 -36 -121.33
l0 -562.61 q2.67 -97.32 69.33 -162.64 q66.66 -65.32 167.98 -67.99 q66.66 0 123.99 34.66 l465.29 281.31
q83.99 53.33 105.99 143.32 q22 89.99 -30 173.98 q-29.33 46.66 -75.99 74.66 Z",
Fill = "#FF000000"
};
Like = new VectorImage
{
Height = 14,
Width = 16,
Data = @"M291.53 894.6 l0 -642.53 l4.66 0 l179.59 -220.4 q29.15 -29.15 69.97 -31.49 q40.81 -2.33 72.29 24.5
q16.33 16.32 25.66 37.31 q9.33 20.99 7 45.48 l-7 144.6 l274.04 0 q25.65 0 48.39 11.08 q22.74 11.08 39.07 32.07
q13.99 19.82 17.49 44.31 q3.5 24.49 -2.33 46.64 l-116.62 382.49 q-15.16 54.81 -57.14 88.63 q-41.98 33.81 -100.28 37.31
l-454.79 0 ZM225.06 894.6 l-93.29 0 q-34.98 2.33 -65.3 -14 q-30.32 -16.33 -47.81 -47.81 q-17.49 -31.49 -18.66 -64.13
l0 -385.99 q0 -36.15 17.49 -65.89 q17.49 -29.73 48.98 -46.05 q16.32 -8.17 32.65 -12.25 q16.33 -4.08 32.65 -6.41 l93.29 0
l0 642.53 Z",
Fill = "#FF000000"
};
Favorite = new VectorImage
{
Height = 16,
Width = 16,
Data = @"M772.12 303.28 q-37.33 -5.83 -66.49 -28 q-29.16 -22.16 -44.32 -55.99 l-83.99 -176.13 q-22.16 -43.16 -65.91 -43.16
q-43.74 0 -69.4 43.16 l-79.32 176.13 q-17.49 33.83 -46.07 55.99 q-28.58 22.17 -64.74 28 l-188.97 29.16
q-45.49 9.33 -58.9 48.99 q-13.42 39.66 18.09 75.82 l142.31 146.98 q25.66 24.49 35.57 58.32 q9.91 33.83 5.25 69.99
l-32.66 204.13 q-5.83 48.99 29.75 73.49 q35.57 24.5 79.9 3.5 l159.8 -87.48 q33.83 -19.83 71.74 -19.83
q37.91 0 71.74 19.83 l160.97 87.48 q43.16 21 77.57 -3.5 q34.41 -24.5 32.08 -73.49 l-37.33 -204.13
q-4.67 -36.16 5.25 -69.99 q9.91 -33.83 35.57 -58.32 l142.31 -146.98 q31.5 -36.16 18.09 -75.82
q-13.42 -39.66 -58.91 -48.99 l-188.97 -29.16 Z",
Fill = "#FF000000"
};
Share = new VectorImage
{
Height = 14,
Width = 16,
Data = @"M453.23 283.64 l0 -219.44 q1.16 -26.85 18.67 -45.53 q17.51 -18.68 44.36 -18.68 q23.34 0 40.85 15.17 l441.21 375.85
q25.68 22.18 25.68 56.61 q0 34.43 -25.68 57.78 l-441.21 375.85 q-19.84 16.34 -46.11 14 q-26.26 -2.34 -42.61 -22.18
q-15.17 -18.67 -15.17 -42.02 l0 -201.93 q-156.41 0 -249.79 61.87 q-93.38 61.87 -178.58 183.25 q-4.67 5.84 -14.01 5.25
q-9.34 -0.59 -10.51 -19.25 q-5.83 -241.62 87.54 -405.62 q93.38 -164 365.35 -171 Z",
Fill = "#FF000000"
};
CloudDownload = new VectorImage CloudDownload = new VectorImage
{ {
Height = 32, Height = 32,
@ -60,6 +108,11 @@
} }
public VectorImage Play { get; private set; }
public VectorImage Like { get; private set; }
public VectorImage Favorite { get; private set; }
public VectorImage Share { get; private set; }
public VectorImage CloudDownload { get; private set; } public VectorImage CloudDownload { get; private set; }
public VectorImage Folder { get; private set; } public VectorImage Folder { get; private set; }
public VectorImage Downloading { get; private set; } public VectorImage Downloading { get; private set; }

@ -62,6 +62,7 @@
<system:String x:Key="Parse">解析</system:String> <system:String x:Key="Parse">解析</system:String>
<system:String x:Key="ParseVideo">解析视频</system:String> <system:String x:Key="ParseVideo">解析视频</system:String>
<system:String x:Key="DownloadSelected">下载选中项</system:String> <system:String x:Key="DownloadSelected">下载选中项</system:String>
<system:String x:Key="AddAllToDownload">下载全部</system:String>
<!-- DownloadManager --> <!-- DownloadManager -->
<system:String x:Key="Downloading">正在下载</system:String> <system:String x:Key="Downloading">正在下载</system:String>
@ -173,6 +174,10 @@
<system:String x:Key="ExtractAudio">提取音频</system:String> <system:String x:Key="ExtractAudio">提取音频</system:String>
<system:String x:Key="ExtractVideo">提取视频</system:String> <system:String x:Key="ExtractVideo">提取视频</system:String>
<!-- PublicFavorites -->
<system:String x:Key="Favorites">收藏夹</system:String>
<system:String x:Key="FavoritesMediaCount">个内容</system:String>
<!-- Dialog --> <!-- Dialog -->
<system:String x:Key="Cancel">取消</system:String> <system:String x:Key="Cancel">取消</system:String>
<system:String x:Key="SelectDirectory">请选择文件夹</system:String> <system:String x:Key="SelectDirectory">请选择文件夹</system:String>

@ -0,0 +1,88 @@
using Prism.Mvvm;
using System.Windows.Media.Imaging;
namespace DownKyi.Models
{
public class Favorites : BindableBase
{
public string CoverUrl { get; set; }
public long UpperMid { get; set; }
private BitmapImage cover;
public BitmapImage Cover
{
get { return cover; }
set { SetProperty(ref cover, value); }
}
private string title;
public string Title
{
get { return title; }
set { SetProperty(ref title, value); }
}
private string createTime;
public string CreateTime
{
get { return createTime; }
set { SetProperty(ref createTime, value); }
}
private string playNumber;
public string PlayNumber
{
get { return playNumber; }
set { SetProperty(ref playNumber, value); }
}
private string likeNumber;
public string LikeNumber
{
get { return likeNumber; }
set { SetProperty(ref likeNumber, value); }
}
private string favoriteNumber;
public string FavoriteNumber
{
get { return favoriteNumber; }
set { SetProperty(ref favoriteNumber, value); }
}
private string shareNumber;
public string ShareNumber
{
get { return shareNumber; }
set { SetProperty(ref shareNumber, value); }
}
private string description;
public string Description
{
get { return description; }
set { SetProperty(ref description, value); }
}
private int mediaCount;
public int MediaCount
{
get { return mediaCount; }
set { SetProperty(ref mediaCount, value); }
}
private string upName;
public string UpName
{
get { return upName; }
set { SetProperty(ref upName, value); }
}
private BitmapImage upHeader;
public BitmapImage UpHeader
{
get { return upHeader; }
set { SetProperty(ref upHeader, value); }
}
}
}

@ -0,0 +1,13 @@
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DownKyi.Models
{
public class FavoritesMedia : BindableBase
{
}
}

@ -8,6 +8,7 @@ namespace DownKyi.Models
public class VideoInfoView : BindableBase public class VideoInfoView : BindableBase
{ {
public string CoverUrl { get; set; } public string CoverUrl { get; set; }
public long UpperMid { get; set; }
private BitmapImage cover; private BitmapImage cover;
public BitmapImage Cover public BitmapImage Cover

@ -178,13 +178,12 @@ namespace DownKyi.Services
{ {
if (bangumiSeason == null) { return null; } if (bangumiSeason == null) { return null; }
// 查询、保存封面 // 查询、保存封面
// 将SeasonId保存到avid字段中 // 将SeasonId保存到avid字段中
// 每集封面的cid保存到cid字段EpisodeId保存到bvid字段中 // 每集封面的cid保存到cid字段EpisodeId保存到bvid字段中
StorageCover storageCover = new StorageCover(); StorageCover storageCover = new StorageCover();
string coverUrl = bangumiSeason.Cover; string coverUrl = bangumiSeason.Cover;
string cover = storageCover.GetCover(bangumiSeason.SeasonId, "", -1, coverUrl); string cover = storageCover.GetCover(bangumiSeason.SeasonId, "bangumi", -1, coverUrl);
// 获取用户头像 // 获取用户头像
string upName; string upName;
@ -208,7 +207,7 @@ namespace DownKyi.Services
{ {
videoInfoView.CoverUrl = coverUrl; videoInfoView.CoverUrl = coverUrl;
videoInfoView.Cover = new BitmapImage(new Uri(cover)); videoInfoView.Cover = cover == null ? null : new BitmapImage(new Uri(cover));
videoInfoView.Title = bangumiSeason.Title; videoInfoView.Title = bangumiSeason.Title;
videoInfoView.VideoZone = DictionaryResource.GetString(BangumiType.Type[bangumiSeason.Type]); videoInfoView.VideoZone = DictionaryResource.GetString(BangumiType.Type[bangumiSeason.Type]);
@ -227,6 +226,8 @@ namespace DownKyi.Services
{ {
StorageHeader storageHeader = new StorageHeader(); StorageHeader storageHeader = new StorageHeader();
videoInfoView.UpHeader = storageHeader.GetHeaderThumbnail(header, 48, 48); videoInfoView.UpHeader = storageHeader.GetHeaderThumbnail(header, 48, 48);
videoInfoView.UpperMid = bangumiSeason.UpInfo.Mid;
} }
else else
{ {

@ -98,13 +98,12 @@ namespace DownKyi.Services
{ {
if (cheeseView == null) { return null; } if (cheeseView == null) { return null; }
// 查询、保存封面 // 查询、保存封面
// 将SeasonId保存到avid字段中 // 将SeasonId保存到avid字段中
// 每集封面的cid保存到cid字段EpisodeId保存到bvid字段中 // 每集封面的cid保存到cid字段EpisodeId保存到bvid字段中
StorageCover storageCover = new StorageCover(); StorageCover storageCover = new StorageCover();
string coverUrl = cheeseView.Cover; string coverUrl = cheeseView.Cover;
string cover = storageCover.GetCover(cheeseView.SeasonId, "", -1, coverUrl); string cover = storageCover.GetCover(cheeseView.SeasonId, "cheese", -1, coverUrl);
// 获取用户头像 // 获取用户头像
string upName; string upName;
@ -127,7 +126,7 @@ namespace DownKyi.Services
{ {
videoInfoView.CoverUrl = coverUrl; videoInfoView.CoverUrl = coverUrl;
videoInfoView.Cover = new BitmapImage(new Uri(cover)); videoInfoView.Cover = cover == null ? null : new BitmapImage(new Uri(cover));
videoInfoView.Title = cheeseView.Title; videoInfoView.Title = cheeseView.Title;
videoInfoView.VideoZone = DictionaryResource.GetString("Cheese"); videoInfoView.VideoZone = DictionaryResource.GetString("Cheese");
@ -147,6 +146,8 @@ namespace DownKyi.Services
{ {
StorageHeader storageHeader = new StorageHeader(); StorageHeader storageHeader = new StorageHeader();
videoInfoView.UpHeader = storageHeader.GetHeaderThumbnail(header, 48, 48); videoInfoView.UpHeader = storageHeader.GetHeaderThumbnail(header, 48, 48);
videoInfoView.UpperMid = cheeseView.UpInfo.Mid;
} }
else else
{ {

@ -0,0 +1,90 @@
using DownKyi.Core.BiliApi.Favorites;
using DownKyi.Core.Storage;
using DownKyi.Core.Utils;
using DownKyi.Models;
using System;
using System.Collections.Generic;
using System.Windows.Media.Imaging;
namespace DownKyi.Services
{
public class FavoritesService : IFavoritesService
{
/// <summary>
/// 获取收藏夹元数据
/// </summary>
/// <param name="mediaId"></param>
/// <returns></returns>
public Favorites GetFavorites(long mediaId)
{
var favoritesMetaInfo = FavoritesInfo.GetFavoritesInfo(mediaId);
if (favoritesMetaInfo == null) { return null; }
// 查询、保存封面
StorageCover storageCover = new StorageCover();
string coverUrl = favoritesMetaInfo.Cover;
string cover = storageCover.GetCover(favoritesMetaInfo.Id, "Favorites", favoritesMetaInfo.Mid, coverUrl);
// 获取用户头像
string upName;
string header;
if (favoritesMetaInfo.Upper != null)
{
upName = favoritesMetaInfo.Upper.Name;
StorageHeader storageHeader = new StorageHeader();
header = storageHeader.GetHeader(favoritesMetaInfo.Upper.Mid, favoritesMetaInfo.Upper.Name, favoritesMetaInfo.Upper.Face);
}
else
{
upName = "";
header = null;
}
// 为Favorites赋值
Favorites favorites = new Favorites();
App.PropertyChangeAsync(new Action(() =>
{
favorites.CoverUrl = coverUrl;
favorites.Cover = cover == null ? null : new BitmapImage(new Uri(cover));
favorites.Title = favoritesMetaInfo.Title;
DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区
DateTime dateTime = startTime.AddSeconds(favoritesMetaInfo.Ctime);
favorites.CreateTime = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
favorites.PlayNumber = Format.FormatNumber(favoritesMetaInfo.CntInfo.Play);
favorites.LikeNumber = Format.FormatNumber(favoritesMetaInfo.CntInfo.ThumbUp);
favorites.FavoriteNumber = Format.FormatNumber(favoritesMetaInfo.CntInfo.Collect);
favorites.ShareNumber = Format.FormatNumber(favoritesMetaInfo.CntInfo.Share);
favorites.Description = favoritesMetaInfo.Intro;
favorites.MediaCount = favoritesMetaInfo.MediaCount;
favorites.UpName = upName;
if (header != null)
{
StorageHeader storageHeader = new StorageHeader();
favorites.UpHeader = storageHeader.GetHeaderThumbnail(header, 48, 48);
favorites.UpperMid = favoritesMetaInfo.Upper.Mid;
}
else
{
favorites.UpHeader = null;
}
}));
return favorites;
}
/// <summary>
/// 获取收藏夹内容明细列表
/// </summary>
/// <param name="mediaId"></param>
/// <returns></returns>
public List<FavoritesMedia> GetFavoritesMediaList(long mediaId)
{
throw new NotImplementedException();
}
}
}

@ -0,0 +1,11 @@
using DownKyi.Models;
using System.Collections.Generic;
namespace DownKyi.Services
{
public interface IFavoritesService
{
Favorites GetFavorites(long mediaId);
List<FavoritesMedia> GetFavoritesMediaList(long mediaId);
}
}

@ -200,7 +200,7 @@ namespace DownKyi.Services
{ {
videoInfoView.CoverUrl = coverUrl; videoInfoView.CoverUrl = coverUrl;
videoInfoView.Cover = new BitmapImage(new Uri(cover)); videoInfoView.Cover = cover == null ? null : new BitmapImage(new Uri(cover));
videoInfoView.Title = videoView.Title; videoInfoView.Title = videoView.Title;
videoInfoView.VideoZone = videoZone; videoInfoView.VideoZone = videoZone;
@ -223,6 +223,8 @@ namespace DownKyi.Services
{ {
StorageHeader storageHeader = new StorageHeader(); StorageHeader storageHeader = new StorageHeader();
videoInfoView.UpHeader = storageHeader.GetHeaderThumbnail(header, 48, 48); videoInfoView.UpHeader = storageHeader.GetHeaderThumbnail(header, 48, 48);
videoInfoView.UpperMid = videoView.Owner.Mid;
} }
else else
{ {

@ -39,5 +39,6 @@
<SolidColorBrush x:Key="BrushText" Color="{DynamicResource ColorText}" /> <SolidColorBrush x:Key="BrushText" Color="{DynamicResource ColorText}" />
<SolidColorBrush x:Key="BrushTextDark" Color="{DynamicResource ColorTextDark}" /> <SolidColorBrush x:Key="BrushTextDark" Color="{DynamicResource ColorTextDark}" />
<SolidColorBrush x:Key="BrushTextGrey" Color="{DynamicResource ColorTextGrey}" /> <SolidColorBrush x:Key="BrushTextGrey" Color="{DynamicResource ColorTextGrey}" />
<SolidColorBrush x:Key="BrushTextGrey2" Color="{DynamicResource ColorTextGrey2}" />
</ResourceDictionary> </ResourceDictionary>

@ -39,5 +39,6 @@
<Color x:Key="ColorText">white</Color> <Color x:Key="ColorText">white</Color>
<Color x:Key="ColorTextDark">black</Color> <Color x:Key="ColorTextDark">black</Color>
<Color x:Key="ColorTextGrey">#FF999999</Color> <Color x:Key="ColorTextGrey">#FF999999</Color>
<Color x:Key="ColorTextGrey2">#FF757575</Color>
</ResourceDictionary> </ResourceDictionary>

@ -0,0 +1,52 @@
using DownKyi.Core.Logging;
using DownKyi.Core.Settings;
using DownKyi.Core.Settings.Models;
using DownKyi.Events;
using DownKyi.ViewModels;
using Prism.Events;
namespace DownKyi.Utils
{
public static class NavigateToView
{
public static string Tag = "NavigateToView";
/// <summary>
/// 导航到用户空间,
/// 如果传入的mid与本地登录的mid一致
/// 则进入我的用户空间。
/// </summary>
/// <param name="mid"></param>
public static void NavigateToViewUserSpace(IEventAggregator eventAggregator, string parentViewName, long mid)
{
UserInfoSettings userInfo = SettingsManager.GetInstance().GetUserInfo();
if (userInfo != null && userInfo.Mid == mid)
{
NavigationView(eventAggregator, ViewMySpaceViewModel.Tag, parentViewName, mid);
}
else
{
NavigationView(eventAggregator, ViewUserSpaceViewModel.Tag, parentViewName, mid);
}
}
/// <summary>
/// 导航到其他页面
/// </summary>
/// <param name="viewName"></param>
/// <param name="param"></param>
public static void NavigationView(IEventAggregator eventAggregator, string viewName, string parentViewName, object param)
{
LogManager.Debug(Tag, $"NavigationView: {viewName}, Parameter: {param}");
NavigationParam parameter = new NavigationParam
{
ViewName = viewName,
ParentViewName = parentViewName,
Parameter = param
};
eventAggregator.GetEvent<NavigationEvent>().Publish(parameter);
}
}
}

@ -317,106 +317,69 @@ namespace DownKyi.ViewModels
// 视频 // 视频
if (ParseEntrance.IsAvId(input)) if (ParseEntrance.IsAvId(input))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, $"{ParseEntrance.VideoUrl}{input.ToLower()}"); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, $"{ParseEntrance.VideoUrl}{input.ToLower()}");
} }
else if (ParseEntrance.IsAvUrl(input)) else if (ParseEntrance.IsAvUrl(input))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, input); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, input);
} }
else if (ParseEntrance.IsBvId(input)) else if (ParseEntrance.IsBvId(input))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, $"{ParseEntrance.VideoUrl}{input}"); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, $"{ParseEntrance.VideoUrl}{input}");
} }
else if (ParseEntrance.IsBvUrl(input)) else if (ParseEntrance.IsBvUrl(input))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, input); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, input);
} }
// 番剧(电影、电视剧) // 番剧(电影、电视剧)
else if (ParseEntrance.IsBangumiSeasonId(input)) else if (ParseEntrance.IsBangumiSeasonId(input))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, $"{ParseEntrance.BangumiUrl}{input.ToLower()}"); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, $"{ParseEntrance.BangumiUrl}{input.ToLower()}");
} }
else if (ParseEntrance.IsBangumiSeasonUrl(input)) else if (ParseEntrance.IsBangumiSeasonUrl(input))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, input); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, input);
} }
else if (ParseEntrance.IsBangumiEpisodeId(input)) else if (ParseEntrance.IsBangumiEpisodeId(input))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, $"{ParseEntrance.BangumiUrl}{input.ToLower()}"); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, $"{ParseEntrance.BangumiUrl}{input.ToLower()}");
} }
else if (ParseEntrance.IsBangumiEpisodeUrl(input)) else if (ParseEntrance.IsBangumiEpisodeUrl(input))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, input); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, input);
} }
else if (ParseEntrance.IsBangumiMediaId(input)) else if (ParseEntrance.IsBangumiMediaId(input))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, $"{ParseEntrance.BangumiMediaUrl}{input.ToLower()}"); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, $"{ParseEntrance.BangumiMediaUrl}{input.ToLower()}");
} }
else if (ParseEntrance.IsBangumiMediaUrl(input)) else if (ParseEntrance.IsBangumiMediaUrl(input))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, input); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, input);
} }
// 课程 // 课程
else if (ParseEntrance.IsCheeseSeasonUrl(input) || ParseEntrance.IsCheeseEpisodeUrl(input)) else if (ParseEntrance.IsCheeseSeasonUrl(input) || ParseEntrance.IsCheeseEpisodeUrl(input))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, input); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, input);
} }
// 用户参数传入mid // 用户参数传入mid
else if (ParseEntrance.IsUserId(input)) else if (ParseEntrance.IsUserId(input))
{ {
NavigateToViewUserSpace(ParseEntrance.GetUserId(input)); NavigateToView.NavigateToViewUserSpace(eventAggregator, ViewIndexViewModel.Tag, ParseEntrance.GetUserId(input));
} }
else if (ParseEntrance.IsUserUrl(input)) else if (ParseEntrance.IsUserUrl(input))
{ {
NavigateToViewUserSpace(ParseEntrance.GetUserId(input)); NavigateToView.NavigateToViewUserSpace(eventAggregator, ViewIndexViewModel.Tag, ParseEntrance.GetUserId(input));
} }
// 收藏夹 // 收藏夹
else if (ParseEntrance.IsFavoritesId(input)) else if (ParseEntrance.IsFavoritesId(input))
{ {
NavigationView(ViewPublicFavoritesViewModel.Tag, ParseEntrance.GetFavoritesId(input)); NavigateToView.NavigationView(eventAggregator, ViewPublicFavoritesViewModel.Tag, ViewIndexViewModel.Tag, ParseEntrance.GetFavoritesId(input));
} }
else if (ParseEntrance.IsFavoritesUrl(input)) else if (ParseEntrance.IsFavoritesUrl(input))
{ {
NavigationView(ViewPublicFavoritesViewModel.Tag, ParseEntrance.GetFavoritesId(input)); NavigateToView.NavigationView(eventAggregator, ViewPublicFavoritesViewModel.Tag, ViewIndexViewModel.Tag, ParseEntrance.GetFavoritesId(input));
} }
} }
/// <summary>
/// 导航到用户空间,
/// 如果传入的mid与本地登录的mid一致
/// 则进入我的用户空间。
/// </summary>
/// <param name="mid"></param>
private void NavigateToViewUserSpace(long mid)
{
var userInfo = SettingsManager.GetInstance().GetUserInfo();
if (userInfo != null && userInfo.Mid == mid)
{
NavigationView(ViewMySpaceViewModel.Tag, mid);
}
else
{
NavigationView(ViewUserSpaceViewModel.Tag, mid);
}
}
/// <summary>
/// 导航到其他页面
/// </summary>
/// <param name="viewName"></param>
/// <param name="param"></param>
private void NavigationView(string viewName, object param)
{
LogManager.Debug("OnClipboardUpdated", $"NavigationView: {viewName}, Parameter: {param}");
NavigationParam parameter = new NavigationParam
{
ViewName = viewName,
ParentViewName = ViewIndexViewModel.Tag,
Parameter = param
};
eventAggregator.GetEvent<NavigationEvent>().Publish(parameter);
}
} }
} }

@ -4,7 +4,6 @@ using DownKyi.Core.Logging;
using DownKyi.Core.Settings; using DownKyi.Core.Settings;
using DownKyi.Core.Settings.Models; using DownKyi.Core.Settings.Models;
using DownKyi.Core.Storage; using DownKyi.Core.Storage;
using DownKyi.Events;
using DownKyi.Images; using DownKyi.Images;
using DownKyi.Utils; using DownKyi.Utils;
using Prism.Commands; using Prism.Commands;
@ -149,7 +148,7 @@ namespace DownKyi.ViewModels
{ {
if (UserName == null) if (UserName == null)
{ {
NavigationView(ViewLoginViewModel.Tag, null); NavigateToView.NavigationView(eventAggregator, ViewLoginViewModel.Tag, Tag, null);
} }
else else
{ {
@ -157,7 +156,7 @@ namespace DownKyi.ViewModels
var userInfo = SettingsManager.GetInstance().GetUserInfo(); var userInfo = SettingsManager.GetInstance().GetUserInfo();
if (userInfo != null && userInfo.Mid != -1) if (userInfo != null && userInfo.Mid != -1)
{ {
NavigationView(ViewMySpaceViewModel.Tag, userInfo.Mid); NavigateToView.NavigationView(eventAggregator, ViewMySpaceViewModel.Tag, Tag, userInfo.Mid);
} }
} }
} }
@ -171,7 +170,7 @@ namespace DownKyi.ViewModels
/// </summary> /// </summary>
private void ExecuteSettingsCommand() private void ExecuteSettingsCommand()
{ {
NavigationView(ViewSettingsViewModel.Tag, null); NavigateToView.NavigationView(eventAggregator, ViewSettingsViewModel.Tag, Tag, null);
} }
// 进入下载管理页面 // 进入下载管理页面
@ -183,7 +182,7 @@ namespace DownKyi.ViewModels
/// </summary> /// </summary>
private void ExecuteDownloadManagerCommand() private void ExecuteDownloadManagerCommand()
{ {
NavigationView(ViewDownloadManagerViewModel.Tag, null); NavigateToView.NavigationView(eventAggregator, ViewDownloadManagerViewModel.Tag, Tag, null);
} }
// 进入工具箱页面 // 进入工具箱页面
@ -195,7 +194,7 @@ namespace DownKyi.ViewModels
/// </summary> /// </summary>
private void ExecuteToolboxCommand() private void ExecuteToolboxCommand()
{ {
NavigationView(ViewToolboxViewModel.Tag, null); NavigateToView.NavigationView(eventAggregator, ViewToolboxViewModel.Tag, Tag, null);
} }
#endregion #endregion
@ -227,67 +226,67 @@ namespace DownKyi.ViewModels
// 视频 // 视频
if (ParseEntrance.IsAvId(InputText)) if (ParseEntrance.IsAvId(InputText))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, $"{ParseEntrance.VideoUrl}{InputText.ToLower()}"); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, $"{ParseEntrance.VideoUrl}{InputText.ToLower()}");
} }
else if (ParseEntrance.IsAvUrl(InputText)) else if (ParseEntrance.IsAvUrl(InputText))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, InputText); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, InputText);
} }
else if (ParseEntrance.IsBvId(InputText)) else if (ParseEntrance.IsBvId(InputText))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, $"{ParseEntrance.VideoUrl}{InputText}"); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, $"{ParseEntrance.VideoUrl}{InputText}");
} }
else if (ParseEntrance.IsBvUrl(InputText)) else if (ParseEntrance.IsBvUrl(InputText))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, InputText); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, InputText);
} }
// 番剧(电影、电视剧) // 番剧(电影、电视剧)
else if (ParseEntrance.IsBangumiSeasonId(InputText)) else if (ParseEntrance.IsBangumiSeasonId(InputText))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, $"{ParseEntrance.BangumiUrl}{InputText.ToLower()}"); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, $"{ParseEntrance.BangumiUrl}{InputText.ToLower()}");
} }
else if (ParseEntrance.IsBangumiSeasonUrl(InputText)) else if (ParseEntrance.IsBangumiSeasonUrl(InputText))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, InputText); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, InputText);
} }
else if (ParseEntrance.IsBangumiEpisodeId(InputText)) else if (ParseEntrance.IsBangumiEpisodeId(InputText))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, $"{ParseEntrance.BangumiUrl}{InputText.ToLower()}"); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, $"{ParseEntrance.BangumiUrl}{InputText.ToLower()}");
} }
else if (ParseEntrance.IsBangumiEpisodeUrl(InputText)) else if (ParseEntrance.IsBangumiEpisodeUrl(InputText))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, InputText); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, InputText);
} }
else if (ParseEntrance.IsBangumiMediaId(InputText)) else if (ParseEntrance.IsBangumiMediaId(InputText))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, $"{ParseEntrance.BangumiMediaUrl}{InputText.ToLower()}"); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, $"{ParseEntrance.BangumiMediaUrl}{InputText.ToLower()}");
} }
else if (ParseEntrance.IsBangumiMediaUrl(InputText)) else if (ParseEntrance.IsBangumiMediaUrl(InputText))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, InputText); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, InputText);
} }
// 课程 // 课程
else if (ParseEntrance.IsCheeseSeasonUrl(InputText) || ParseEntrance.IsCheeseEpisodeUrl(InputText)) else if (ParseEntrance.IsCheeseSeasonUrl(InputText) || ParseEntrance.IsCheeseEpisodeUrl(InputText))
{ {
NavigationView(ViewVideoDetailViewModel.Tag, InputText); NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, InputText);
} }
// 用户参数传入mid // 用户参数传入mid
else if (ParseEntrance.IsUserId(InputText)) else if (ParseEntrance.IsUserId(InputText))
{ {
NavigateToViewUserSpace(ParseEntrance.GetUserId(InputText)); NavigateToView.NavigateToViewUserSpace(eventAggregator, Tag, ParseEntrance.GetUserId(InputText));
} }
else if (ParseEntrance.IsUserUrl(InputText)) else if (ParseEntrance.IsUserUrl(InputText))
{ {
NavigateToViewUserSpace(ParseEntrance.GetUserId(InputText)); NavigateToView.NavigateToViewUserSpace(eventAggregator, Tag, ParseEntrance.GetUserId(InputText));
} }
// 收藏夹 // 收藏夹
else if (ParseEntrance.IsFavoritesId(InputText)) else if (ParseEntrance.IsFavoritesId(InputText))
{ {
NavigationView(ViewPublicFavoritesViewModel.Tag, ParseEntrance.GetFavoritesId(InputText)); NavigateToView.NavigationView(eventAggregator, ViewPublicFavoritesViewModel.Tag, Tag, ParseEntrance.GetFavoritesId(InputText));
} }
else if (ParseEntrance.IsFavoritesUrl(InputText)) else if (ParseEntrance.IsFavoritesUrl(InputText))
{ {
NavigationView(ViewPublicFavoritesViewModel.Tag, ParseEntrance.GetFavoritesId(InputText)); NavigateToView.NavigationView(eventAggregator, ViewPublicFavoritesViewModel.Tag, Tag, ParseEntrance.GetFavoritesId(InputText));
} }
// TODO 关键词搜索 // TODO 关键词搜索
else else
@ -297,43 +296,6 @@ namespace DownKyi.ViewModels
InputText = string.Empty; InputText = string.Empty;
} }
/// <summary>
/// 导航到用户空间,
/// 如果传入的mid与本地登录的mid一致
/// 则进入我的用户空间。
/// </summary>
/// <param name="mid"></param>
private void NavigateToViewUserSpace(long mid)
{
var userInfo = SettingsManager.GetInstance().GetUserInfo();
if (userInfo != null && userInfo.Mid == mid)
{
NavigationView(ViewMySpaceViewModel.Tag, mid);
}
else
{
NavigationView(ViewUserSpaceViewModel.Tag, mid);
}
}
/// <summary>
/// 导航到其他页面
/// </summary>
/// <param name="viewName"></param>
/// <param name="param"></param>
private void NavigationView(string viewName, object param)
{
LogManager.Debug(Tag, $"NavigationView: {viewName}, Parameter: {param}");
NavigationParam parameter = new NavigationParam
{
ViewName = viewName,
ParentViewName = Tag,
Parameter = param
};
eventAggregator.GetEvent<NavigationEvent>().Publish(parameter);
}
/// <summary> /// <summary>
/// 更新用户登录信息 /// 更新用户登录信息
/// </summary> /// </summary>

@ -1,10 +1,18 @@
using Prism.Commands; using DownKyi.Core.Logging;
using DownKyi.Events;
using DownKyi.Images;
using DownKyi.Models;
using DownKyi.Services;
using DownKyi.Utils;
using Prism.Commands;
using Prism.Events; using Prism.Events;
using Prism.Mvvm; using Prism.Mvvm;
using Prism.Regions; using Prism.Regions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace DownKyi.ViewModels namespace DownKyi.ViewModels
{ {
@ -12,28 +20,234 @@ namespace DownKyi.ViewModels
{ {
public const string Tag = "PagePublicFavorites"; public const string Tag = "PagePublicFavorites";
// 收藏夹id #region 页面属性申明
private long favoritesId;
private VectorImage arrowBack;
public VectorImage ArrowBack
{
get { return arrowBack; }
set { SetProperty(ref arrowBack, value); }
}
private VectorImage play;
public VectorImage Play
{
get { return play; }
set { SetProperty(ref play, value); }
}
private VectorImage like;
public VectorImage Like
{
get { return like; }
set { SetProperty(ref like, value); }
}
private VectorImage favorite;
public VectorImage Favorite
{
get { return favorite; }
set { SetProperty(ref favorite, value); }
}
private VectorImage share;
public VectorImage Share
{
get { return share; }
set { SetProperty(ref share, value); }
}
private Favorites favorites;
public Favorites Favorites
{
get { return favorites; }
set { SetProperty(ref favorites, value); }
}
private List<FavoritesMedia> favoritesMedia;
public List<FavoritesMedia> FavoritesMedia
{
get { return favoritesMedia; }
set { SetProperty(ref favoritesMedia, value); }
}
private Visibility contentVisibility;
public Visibility ContentVisibility
{
get { return contentVisibility; }
set { SetProperty(ref contentVisibility, value); }
}
private Visibility noDataVisibility;
public Visibility NoDataVisibility
{
get { return noDataVisibility; }
set { SetProperty(ref noDataVisibility, value); }
}
#endregion
public ViewPublicFavoritesViewModel(IEventAggregator eventAggregator) : base(eventAggregator) public ViewPublicFavoritesViewModel(IEventAggregator eventAggregator) : base(eventAggregator)
{ {
#region 属性初始化
ArrowBack = NavigationIcon.Instance().ArrowBack;
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
Play = NormalIcon.Instance().Play;
Play.Fill = DictionaryResource.GetColor("ColorTextGrey2");
Like = NormalIcon.Instance().Like;
Like.Fill = DictionaryResource.GetColor("ColorTextGrey2");
Favorite = NormalIcon.Instance().Favorite;
Favorite.Fill = DictionaryResource.GetColor("ColorTextGrey2");
Share = NormalIcon.Instance().Share;
Share.Fill = DictionaryResource.GetColor("ColorTextGrey2");
#endregion
}
#region 命令申明
// 返回
private DelegateCommand backSpaceCommand;
public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace));
/// <summary>
/// 返回
/// </summary>
private void ExecuteBackSpace()
{
NavigationParam parameter = new NavigationParam
{
ViewName = ParentView,
ParentViewName = null,
Parameter = null
};
eventAggregator.GetEvent<NavigationEvent>().Publish(parameter);
}
// 复制封面事件
private DelegateCommand copyCoverCommand;
public DelegateCommand CopyCoverCommand => copyCoverCommand ?? (copyCoverCommand = new DelegateCommand(ExecuteCopyCoverCommand));
/// <summary>
/// 复制封面事件
/// </summary>
private void ExecuteCopyCoverCommand()
{
// 复制封面图片到剪贴板
Clipboard.SetImage(Favorites.Cover);
LogManager.Info(Tag, "复制封面图片到剪贴板");
}
// 复制封面URL事件
private DelegateCommand copyCoverUrlCommand;
public DelegateCommand CopyCoverUrlCommand => copyCoverUrlCommand ?? (copyCoverUrlCommand = new DelegateCommand(ExecuteCopyCoverUrlCommand));
/// <summary>
/// 复制封面URL事件
/// </summary>
private void ExecuteCopyCoverUrlCommand()
{
// 复制封面url到剪贴板
Clipboard.SetText(Favorites.CoverUrl);
LogManager.Info(Tag, "复制封面url到剪贴板");
}
// 前往UP主页事件
private DelegateCommand upperCommand;
public DelegateCommand UpperCommand => upperCommand ?? (upperCommand = new DelegateCommand(ExecuteUpperCommand));
/// <summary>
/// 前往UP主页事件
/// </summary>
private void ExecuteUpperCommand()
{
NavigateToView.NavigateToViewUserSpace(eventAggregator, Tag, Favorites.UpperMid);
}
// 添加选中项到下载列表事件
private DelegateCommand addToDownloadCommand;
public DelegateCommand AddToDownloadCommand => addToDownloadCommand ?? (addToDownloadCommand = new DelegateCommand(ExecuteAddToDownloadCommand));
/// <summary>
/// 添加选中项到下载列表事件
/// </summary>
private void ExecuteAddToDownloadCommand()
{
}
// 添加所有视频到下载列表事件
private DelegateCommand addAllToDownloadCommand;
public DelegateCommand AddAllToDownloadCommand => addAllToDownloadCommand ?? (addAllToDownloadCommand = new DelegateCommand(ExecuteAddAllToDownloadCommand));
/// <summary>
/// 添加所有视频到下载列表事件
/// </summary>
private void ExecuteAddAllToDownloadCommand()
{
}
#endregion
/// <summary>
/// 初始化页面元素
/// </summary>
private void InitView()
{
LogManager.Debug(Tag, "初始化页面元素");
ContentVisibility = Visibility.Collapsed;
NoDataVisibility = Visibility.Collapsed;
}
/// <summary>
/// 更新页面
/// </summary>
private void UpdateView(IFavoritesService favoritesService, long favoritesId)
{
Favorites = favoritesService.GetFavorites(favoritesId);
if (Favorites == null)
{
LogManager.Debug(Tag, "Favorites is null.");
ContentVisibility = Visibility.Collapsed;
NoDataVisibility = Visibility.Visible;
return;
}
else
{
ContentVisibility = Visibility.Visible;
NoDataVisibility = Visibility.Collapsed;
}
} }
/// <summary> /// <summary>
/// 接收收藏夹id参数 /// 接收收藏夹id参数
/// </summary> /// </summary>
/// <param name="navigationContext"></param> /// <param name="navigationContext"></param>
public override void OnNavigatedTo(NavigationContext navigationContext) public override async void OnNavigatedTo(NavigationContext navigationContext)
{ {
base.OnNavigatedTo(navigationContext); base.OnNavigatedTo(navigationContext);
InitView();
// 根据传入参数不同执行不同任务 // 根据传入参数不同执行不同任务
long parameter = navigationContext.Parameters.GetValue<long>("Parameter"); long parameter = navigationContext.Parameters.GetValue<long>("Parameter");
if (parameter == 0) if (parameter == 0)
{ {
return; return;
} }
favoritesId = parameter;
await Task.Run(new Action(() =>
{
UpdateView(new FavoritesService(), parameter);
}));
} }
} }
} }

@ -137,8 +137,6 @@ namespace DownKyi.ViewModels
/// </summary> /// </summary>
private void ExecuteBackSpace() private void ExecuteBackSpace()
{ {
InitView();
NavigationParam parameter = new NavigationParam NavigationParam parameter = new NavigationParam
{ {
ViewName = ParentView, ViewName = ParentView,
@ -242,6 +240,18 @@ namespace DownKyi.ViewModels
LogManager.Info(Tag, "复制封面url到剪贴板"); LogManager.Info(Tag, "复制封面url到剪贴板");
} }
// 前往UP主页事件
private DelegateCommand upperCommand;
public DelegateCommand UpperCommand => upperCommand ?? (upperCommand = new DelegateCommand(ExecuteUpperCommand));
/// <summary>
/// 前往UP主页事件
/// </summary>
private void ExecuteUpperCommand()
{
NavigateToView.NavigateToViewUserSpace(eventAggregator, Tag, VideoInfoView.UpperMid);
}
// 视频章节选择事件 // 视频章节选择事件
private DelegateCommand<object> videoSectionsCommand; private DelegateCommand<object> videoSectionsCommand;
public DelegateCommand<object> VideoSectionsCommand => videoSectionsCommand ?? (videoSectionsCommand = new DelegateCommand<object>(ExecuteVideoSectionsCommand)); public DelegateCommand<object> VideoSectionsCommand => videoSectionsCommand ?? (videoSectionsCommand = new DelegateCommand<object>(ExecuteVideoSectionsCommand));
@ -614,6 +624,7 @@ namespace DownKyi.ViewModels
{ {
LoadingVisibility = Visibility.Collapsed; LoadingVisibility = Visibility.Collapsed;
ContentVisibility = Visibility.Visible; ContentVisibility = Visibility.Visible;
NoDataVisibility = Visibility.Collapsed;
} }
var videoSections = videoInfoService.GetVideoSections(); var videoSections = videoInfoService.GetVideoSections();

@ -2,9 +2,296 @@
x:Class="DownKyi.Views.ViewPublicFavorites" x:Class="DownKyi.Views.ViewPublicFavorites"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:prism="http://prismlibrary.com/" xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"> prism:ViewModelLocator.AutoWireViewModel="True">
<Grid> <Grid>
<TextBlock>公开访问的收藏夹</TextBlock> <Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="1" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="0"
Margin="10,5,0,5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Command="{Binding BackSpaceCommand}"
Style="{StaticResource ImageBtnStyle}">
<StackPanel Orientation="Horizontal">
<ContentControl Width="24" Height="24">
<Path
Width="{Binding ArrowBack.Width}"
Height="{Binding ArrowBack.Height}"
Data="{Binding ArrowBack.Data}"
Fill="{Binding ArrowBack.Fill}"
Stretch="None" />
</ContentControl>
<TextBlock
VerticalAlignment="Center"
FontSize="16"
Foreground="{DynamicResource BrushTextDark}"
Text="{DynamicResource Favorites}" />
</StackPanel>
</Button>
</Grid>
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
<Grid Grid.Row="2" Visibility="{Binding ContentVisibility}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="320" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- 左侧 -->
<StackPanel
Grid.Column="0"
Margin="10,10,10,10"
Orientation="Vertical">
<Image Source="{Binding Favorites.Cover}">
<Image.ContextMenu>
<ContextMenu>
<MenuItem Command="{Binding CopyCoverCommand}" Header="{DynamicResource CopyCover}" />
<MenuItem Command="{Binding CopyCoverUrlCommand}" Header="{DynamicResource CopyCoverUrl}" />
<!-- TODO 复制封面到文件 -->
</ContextMenu>
</Image.ContextMenu>
</Image>
<TextBlock
Margin="0,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="18"
FontWeight="Bold"
Foreground="{DynamicResource BrushTextDark}"
Text="{Binding Favorites.Title}"
TextTrimming="CharacterEllipsis"
ToolTip="{Binding Favorites.Title}" />
<ScrollViewer
MaxHeight="80"
Margin="0,10,0,0"
VerticalScrollBarVisibility="Auto">
<TextBox
Background="{x:Null}"
BorderBrush="{x:Null}"
BorderThickness="0"
FontSize="12"
Foreground="{DynamicResource BrushTextDark}"
IsReadOnly="True"
Text="{Binding Favorites.Description}"
TextWrapping="WrapWithOverflow" />
</ScrollViewer>
<Grid Margin="0,15,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
HorizontalAlignment="Left"
FontSize="12"
Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding Favorites.CreateTime}" />
<StackPanel
Grid.Column="1"
HorizontalAlignment="Right"
Orientation="Horizontal">
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding Favorites.MediaCount}" />
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushTextGrey}"
Text="{DynamicResource FavoritesMediaCount}" />
<StackPanel.Style>
<Style TargetType="{x:Type StackPanel}">
<Style.Triggers>
<DataTrigger Binding="{Binding Favorites.MediaCount}" Value="0">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding Favorites.MediaCount}" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
</StackPanel>
</Grid>
<Grid Margin="0,15,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel
Grid.Column="0"
HorizontalAlignment="Center"
Orientation="Vertical">
<ContentControl Width="16" Height="16">
<Path
Width="{Binding Play.Width}"
Height="{Binding Play.Height}"
Data="{Binding Play.Data}"
Fill="{Binding Play.Fill}"
Stretch="UniformToFill" />
</ContentControl>
<TextBlock
Margin="0,5,0,0"
HorizontalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource BrushTextGrey2}"
Text="{Binding Favorites.PlayNumber}" />
</StackPanel>
<StackPanel
Grid.Column="1"
HorizontalAlignment="Center"
Orientation="Vertical">
<ContentControl Width="16" Height="16">
<Path
Width="{Binding Like.Width}"
Height="{Binding Like.Height}"
Data="{Binding Like.Data}"
Fill="{Binding Like.Fill}"
Stretch="UniformToFill" />
</ContentControl>
<TextBlock
Margin="0,5,0,0"
HorizontalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource BrushTextGrey2}"
Text="{Binding Favorites.LikeNumber}" />
</StackPanel>
<StackPanel
Grid.Column="2"
HorizontalAlignment="Center"
Orientation="Vertical">
<ContentControl Width="16" Height="16">
<Path
Width="{Binding Favorite.Width}"
Height="{Binding Favorite.Height}"
Data="{Binding Favorite.Data}"
Fill="{Binding Favorite.Fill}"
Stretch="UniformToFill" />
</ContentControl>
<TextBlock
Margin="0,5,0,0"
HorizontalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource BrushTextGrey2}"
Text="{Binding Favorites.FavoriteNumber}" />
</StackPanel>
<StackPanel
Grid.Column="3"
HorizontalAlignment="Center"
Orientation="Vertical">
<ContentControl Width="16" Height="16">
<Path
Width="{Binding Share.Width}"
Height="{Binding Share.Height}"
Data="{Binding Share.Data}"
Fill="{Binding Share.Fill}"
Stretch="UniformToFill" />
</ContentControl>
<TextBlock
Margin="0,5,0,0"
HorizontalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource BrushTextGrey2}"
Text="{Binding Favorites.ShareNumber}" />
</StackPanel>
</Grid>
<StackPanel
Margin="0,20,0,0"
Cursor="Hand"
Orientation="Horizontal"
ToolTip="{Binding Favorites.UpName}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<i:InvokeCommandAction Command="{Binding UpperCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<Image
Width="48"
Height="48"
Source="{Binding Favorites.UpHeader}">
<Image.Clip>
<EllipseGeometry
Center="24,24"
RadiusX="24"
RadiusY="24" />
</Image.Clip>
</Image>
<TextBlock
Margin="15,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="14"
Foreground="{DynamicResource BrushPrimary}"
Text="{Binding Favorites.UpName}"
TextTrimming="CharacterEllipsis" />
</StackPanel>
<TextBlock
Height="1"
Margin="0,20,0,0"
Background="{DynamicResource BrushBorder}" />
<Button
Height="40"
Margin="0,20,0,0"
HorizontalAlignment="Stretch"
Command="{Binding AddToDownloadCommand}"
Content="{DynamicResource DownloadSelected}"
FontSize="12"
Foreground="{DynamicResource BrushText}"
Style="{StaticResource BtnStyle}" />
<Button
Height="40"
Margin="0,20,0,0"
HorizontalAlignment="Stretch"
Command="{Binding AddAllToDownloadCommand}"
Content="{DynamicResource AddAllToDownload}"
FontSize="12"
Foreground="{DynamicResource BrushText}"
Style="{StaticResource BtnStyle}" />
</StackPanel>
<!-- 右侧内容区 -->
<ContentControl Grid.Column="1" prism:RegionManager.RegionName="SettingsContentRegion" />
</Grid>
<!-- 没有数据提示 -->
<Image
Grid.Row="2"
Width="256"
Height="256"
Source="/DownKyi;component/Resources/no-data.png"
Visibility="{Binding NoDataVisibility}" />
</Grid> </Grid>
</UserControl> </UserControl>

@ -243,7 +243,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
Command="{Binding DownloadManagerCommand}" Command="{Binding DownloadManagerCommand}"
Style="{StaticResource ImageBtnStyle}" Style="{StaticResource ImageBtnStyle}"
ToolTip="{DynamicResource DownloadManage}"> ToolTip="{DynamicResource DownloadManager}">
<ContentControl> <ContentControl>
<Path <Path
Width="{Binding DownloadManage.Width}" Width="{Binding DownloadManage.Width}"
@ -281,7 +281,7 @@
<ContextMenu> <ContextMenu>
<MenuItem Command="{Binding CopyCoverCommand}" Header="{DynamicResource CopyCover}" /> <MenuItem Command="{Binding CopyCoverCommand}" Header="{DynamicResource CopyCover}" />
<MenuItem Command="{Binding CopyCoverUrlCommand}" Header="{DynamicResource CopyCoverUrl}" /> <MenuItem Command="{Binding CopyCoverUrlCommand}" Header="{DynamicResource CopyCoverUrl}" />
<!-- 复制封面到文件 --> <!-- TODO 复制封面到文件 -->
</ContextMenu> </ContextMenu>
</Image.ContextMenu> </Image.ContextMenu>
</Image> </Image>
@ -335,12 +335,17 @@
Grid.Row="2" Grid.Row="2"
VerticalAlignment="Center" VerticalAlignment="Center"
Orientation="Horizontal"> Orientation="Horizontal">
<StackPanel Margin="0,0,10,0" Orientation="Horizontal">
<TextBlock <TextBlock
Margin="0,0,10,0" FontSize="12"
Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding VideoInfoView.PlayNumber}" />
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushTextGrey}" Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding VideoInfoView.PlayNumber, StringFormat={}{0}播放}"> Text="{DynamicResource Play}" />
<TextBlock.Style> <StackPanel.Style>
<Style TargetType="{x:Type TextBlock}"> <Style TargetType="{x:Type StackPanel}">
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding VideoInfoView.PlayNumber}" Value="0"> <DataTrigger Binding="{Binding VideoInfoView.PlayNumber}" Value="0">
<Setter Property="Visibility" Value="Collapsed" /> <Setter Property="Visibility" Value="Collapsed" />
@ -350,14 +355,20 @@
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</TextBlock.Style> </StackPanel.Style>
</TextBlock> </StackPanel>
<StackPanel Margin="0,0,10,0" Orientation="Horizontal">
<TextBlock <TextBlock
Margin="0,0,10,0" FontSize="12"
Foreground="{DynamicResource BrushTextGrey}" Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding VideoInfoView.DanmakuNumber, StringFormat={}{0}弹幕}"> Text="{Binding VideoInfoView.DanmakuNumber}" />
<TextBlock.Style> <TextBlock
<Style TargetType="{x:Type TextBlock}"> FontSize="12"
Foreground="{DynamicResource BrushTextGrey}"
Text="{DynamicResource Danmaku}" />
<StackPanel.Style>
<Style TargetType="{x:Type StackPanel}">
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding VideoInfoView.DanmakuNumber}" Value="0"> <DataTrigger Binding="{Binding VideoInfoView.DanmakuNumber}" Value="0">
<Setter Property="Visibility" Value="Collapsed" /> <Setter Property="Visibility" Value="Collapsed" />
@ -367,14 +378,20 @@
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</TextBlock.Style> </StackPanel.Style>
</TextBlock> </StackPanel>
<StackPanel Margin="0,0,10,0" Orientation="Horizontal">
<TextBlock <TextBlock
Margin="0,0,10,0" FontSize="12"
Foreground="{DynamicResource BrushTextGrey}" Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding VideoInfoView.LikeNumber, StringFormat={}{0}点赞}"> Text="{Binding VideoInfoView.LikeNumber}" />
<TextBlock.Style> <TextBlock
<Style TargetType="{x:Type TextBlock}"> FontSize="12"
Foreground="{DynamicResource BrushTextGrey}"
Text="{DynamicResource Like}" />
<StackPanel.Style>
<Style TargetType="{x:Type StackPanel}">
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding VideoInfoView.LikeNumber}" Value="0"> <DataTrigger Binding="{Binding VideoInfoView.LikeNumber}" Value="0">
<Setter Property="Visibility" Value="Collapsed" /> <Setter Property="Visibility" Value="Collapsed" />
@ -384,14 +401,20 @@
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</TextBlock.Style> </StackPanel.Style>
</TextBlock> </StackPanel>
<StackPanel Margin="0,0,10,0" Orientation="Horizontal">
<TextBlock <TextBlock
Margin="0,0,10,0" FontSize="12"
Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding VideoInfoView.CoinNumber}" />
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushTextGrey}" Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding VideoInfoView.CoinNumber, StringFormat={}{0}投币}"> Text="{DynamicResource Coin}" />
<TextBlock.Style> <StackPanel.Style>
<Style TargetType="{x:Type TextBlock}"> <Style TargetType="{x:Type StackPanel}">
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding VideoInfoView.CoinNumber}" Value="0"> <DataTrigger Binding="{Binding VideoInfoView.CoinNumber}" Value="0">
<Setter Property="Visibility" Value="Collapsed" /> <Setter Property="Visibility" Value="Collapsed" />
@ -401,14 +424,20 @@
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</TextBlock.Style> </StackPanel.Style>
</TextBlock> </StackPanel>
<StackPanel Margin="0,0,10,0" Orientation="Horizontal">
<TextBlock <TextBlock
Margin="0,0,10,0" FontSize="12"
Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding VideoInfoView.FavoriteNumber}" />
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushTextGrey}" Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding VideoInfoView.FavoriteNumber, StringFormat={}{0}收藏}"> Text="{DynamicResource Favorite}" />
<TextBlock.Style> <StackPanel.Style>
<Style TargetType="{x:Type TextBlock}"> <Style TargetType="{x:Type StackPanel}">
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding VideoInfoView.FavoriteNumber}" Value="0"> <DataTrigger Binding="{Binding VideoInfoView.FavoriteNumber}" Value="0">
<Setter Property="Visibility" Value="Collapsed" /> <Setter Property="Visibility" Value="Collapsed" />
@ -418,14 +447,20 @@
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</TextBlock.Style> </StackPanel.Style>
</TextBlock> </StackPanel>
<StackPanel Margin="0,0,10,0" Orientation="Horizontal">
<TextBlock <TextBlock
Margin="0,0,10,0" FontSize="12"
Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding VideoInfoView.ShareNumber}" />
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushTextGrey}" Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding VideoInfoView.ShareNumber, StringFormat={}{0}分享}"> Text="{DynamicResource Share}" />
<TextBlock.Style> <StackPanel.Style>
<Style TargetType="{x:Type TextBlock}"> <Style TargetType="{x:Type StackPanel}">
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding VideoInfoView.ShareNumber}" Value="0"> <DataTrigger Binding="{Binding VideoInfoView.ShareNumber}" Value="0">
<Setter Property="Visibility" Value="Collapsed" /> <Setter Property="Visibility" Value="Collapsed" />
@ -435,14 +470,20 @@
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</TextBlock.Style> </StackPanel.Style>
</TextBlock> </StackPanel>
<StackPanel Margin="0,0,10,0" Orientation="Horizontal">
<TextBlock <TextBlock
Margin="0,0,10,0" FontSize="12"
Foreground="{DynamicResource BrushTextGrey}" Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding VideoInfoView.ReplyNumber, StringFormat={}{0}评论}"> Text="{Binding VideoInfoView.ReplyNumber}" />
<TextBlock.Style> <TextBlock
<Style TargetType="{x:Type TextBlock}"> FontSize="12"
Foreground="{DynamicResource BrushTextGrey}"
Text="{DynamicResource Reply}" />
<StackPanel.Style>
<Style TargetType="{x:Type StackPanel}">
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding VideoInfoView.ReplyNumber}" Value="0"> <DataTrigger Binding="{Binding VideoInfoView.ReplyNumber}" Value="0">
<Setter Property="Visibility" Value="Collapsed" /> <Setter Property="Visibility" Value="Collapsed" />
@ -452,8 +493,8 @@
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</TextBlock.Style> </StackPanel.Style>
</TextBlock> </StackPanel>
</StackPanel> </StackPanel>
</Grid> </Grid>
@ -464,7 +505,7 @@
ToolTip="{Binding VideoInfoView.UpName}"> ToolTip="{Binding VideoInfoView.UpName}">
<i:Interaction.Triggers> <i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp"> <i:EventTrigger EventName="MouseLeftButtonUp">
<i:InvokeCommandAction Command="{Binding}" /> <i:InvokeCommandAction Command="{Binding UpperCommand}" />
</i:EventTrigger> </i:EventTrigger>
</i:Interaction.Triggers> </i:Interaction.Triggers>
@ -482,6 +523,7 @@
<TextBlock <TextBlock
Margin="0,2,0,0" Margin="0,2,0,0"
HorizontalAlignment="Center" HorizontalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource BrushTextDark}" Foreground="{DynamicResource BrushTextDark}"
Text="{Binding VideoInfoView.UpName}" Text="{Binding VideoInfoView.UpName}"
TextTrimming="CharacterEllipsis" /> TextTrimming="CharacterEllipsis" />
@ -496,6 +538,7 @@
Background="{x:Null}" Background="{x:Null}"
BorderBrush="{x:Null}" BorderBrush="{x:Null}"
BorderThickness="0" BorderThickness="0"
FontSize="12"
Foreground="{DynamicResource BrushTextDark}" Foreground="{DynamicResource BrushTextDark}"
IsReadOnly="True" IsReadOnly="True"
Text="{Binding VideoInfoView.Description}" Text="{Binding VideoInfoView.Description}"

Loading…
Cancel
Save