mirror of
https://github.com/leiurayer/downkyi.git
synced 2024-04-21 12:41:55 +00:00
完成稍后再看页面和历史记录页面;修复一些问题
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using DownKyi.Core.BiliApi.History.Models;
|
||||
using DownKyi.Core.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
namespace DownKyi.Core.BiliApi.History
|
||||
{
|
||||
/// <summary>
|
||||
/// 历史记录
|
||||
/// </summary>
|
||||
public static class History
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取历史记录列表(视频、直播、专栏)
|
||||
/// startId和startTime必须同时使用才有效,分别对应结果中的max和view_at,默认为0
|
||||
/// </summary>
|
||||
/// <param name="startId">历史记录开始目标ID</param>
|
||||
/// <param name="startTime">历史记录开始时间</param>
|
||||
/// <param name="ps">每页项数</param>
|
||||
/// <param name="business">历史记录ID类型</param>
|
||||
/// <returns></returns>
|
||||
public static HistoryData GetHistory(long startId, long startTime, int ps = 30, HistoryBusiness business = HistoryBusiness.ARCHIVE)
|
||||
{
|
||||
string businessStr = string.Empty;
|
||||
switch (business)
|
||||
{
|
||||
case HistoryBusiness.ARCHIVE:
|
||||
businessStr = "archive";
|
||||
break;
|
||||
case HistoryBusiness.PGC:
|
||||
businessStr = "pgc";
|
||||
break;
|
||||
case HistoryBusiness.LIVE:
|
||||
businessStr = "live";
|
||||
break;
|
||||
case HistoryBusiness.ARTICLE_LIST:
|
||||
businessStr = "article-list";
|
||||
break;
|
||||
case HistoryBusiness.ARTICLE:
|
||||
businessStr = "article";
|
||||
break;
|
||||
}
|
||||
|
||||
string url = $"https://api.bilibili.com/x/web-interface/history/cursor?max={startId}&view_at={startTime}&ps={ps}&business={businessStr}";
|
||||
string referer = "https://www.bilibili.com";
|
||||
string response = WebClient.RequestWeb(url, referer);
|
||||
|
||||
try
|
||||
{
|
||||
var history = JsonConvert.DeserializeObject<HistoryOrigin>(response);
|
||||
if (history == null || history.Data == null) { return null; }
|
||||
return history.Data;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Debugging.Console.PrintLine("GetHistory()发生异常: {0}", e);
|
||||
LogManager.Error("History", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace DownKyi.Core.BiliApi.History.Models
|
||||
{
|
||||
public enum HistoryBusiness
|
||||
{
|
||||
ARCHIVE = 1, // 稿件
|
||||
PGC, // 番剧(影视)
|
||||
LIVE, // 直播
|
||||
ARTICLE_LIST, // 文集
|
||||
ARTICLE, // 文章
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using DownKyi.Core.BiliApi.Models;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace DownKyi.Core.BiliApi.History.Models
|
||||
{
|
||||
public class HistoryCursor : BaseModel
|
||||
{
|
||||
[JsonProperty("max")]
|
||||
public long Max { get; set; }
|
||||
[JsonProperty("view_at")]
|
||||
public long ViewAt { get; set; }
|
||||
[JsonProperty("business")]
|
||||
public string Business { get; set; }
|
||||
[JsonProperty("ps")]
|
||||
public int Ps { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using DownKyi.Core.BiliApi.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DownKyi.Core.BiliApi.History.Models
|
||||
{
|
||||
// https://api.bilibili.com/x/web-interface/history/cursor?max={startId}&view_at={startTime}&ps={ps}&business={businessStr}
|
||||
public class HistoryOrigin : BaseModel
|
||||
{
|
||||
//[JsonProperty("code")]
|
||||
//public int Code { get; set; }
|
||||
//[JsonProperty("message")]
|
||||
//public string Message { get; set; }
|
||||
//[JsonProperty("ttl")]
|
||||
//public int Ttl { get; set; }
|
||||
[JsonProperty("data")]
|
||||
public HistoryData Data { get; set; }
|
||||
}
|
||||
|
||||
public class HistoryData : BaseModel
|
||||
{
|
||||
[JsonProperty("cursor")]
|
||||
public HistoryCursor Cursor { get; set; }
|
||||
//public List<HistoryDataTab> tab { get; set; }
|
||||
[JsonProperty("list")]
|
||||
public List<HistoryList> List { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using DownKyi.Core.BiliApi.Models;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace DownKyi.Core.BiliApi.History.Models
|
||||
{
|
||||
public class HistoryList : BaseModel
|
||||
{
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; }
|
||||
// long_title
|
||||
[JsonProperty("cover")]
|
||||
public string Cover { get; set; }
|
||||
// covers
|
||||
[JsonProperty("uri")]
|
||||
public string Uri { get; set; }
|
||||
[JsonProperty("history")]
|
||||
public HistoryListHistory History { get; set; }
|
||||
[JsonProperty("videos")]
|
||||
public int Videos { get; set; }
|
||||
[JsonProperty("author_name")]
|
||||
public string AuthorName { get; set; }
|
||||
[JsonProperty("author_face")]
|
||||
public string AuthorFace { get; set; }
|
||||
[JsonProperty("author_mid")]
|
||||
public long AuthorMid { get; set; }
|
||||
[JsonProperty("view_at")]
|
||||
public long ViewAt { get; set; }
|
||||
[JsonProperty("progress")]
|
||||
public long Progress { get; set; }
|
||||
// badge
|
||||
[JsonProperty("show_title")]
|
||||
public string ShowTitle { get; set; }
|
||||
[JsonProperty("duration")]
|
||||
public long Duration { get; set; }
|
||||
// current
|
||||
// total
|
||||
[JsonProperty("new_desc")]
|
||||
public string NewDesc { get; set; }
|
||||
// is_finish
|
||||
// is_fav
|
||||
// kid
|
||||
[JsonProperty("tag_name")]
|
||||
public string TagName { get; set; }
|
||||
// live_status
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using DownKyi.Core.BiliApi.Models;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace DownKyi.Core.BiliApi.History.Models
|
||||
{
|
||||
public class HistoryListHistory : BaseModel
|
||||
{
|
||||
[JsonProperty("oid")]
|
||||
public long Oid { get; set; }
|
||||
[JsonProperty("epid")]
|
||||
public long Epid { get; set; }
|
||||
[JsonProperty("bvid")]
|
||||
public string Bvid { get; set; }
|
||||
[JsonProperty("page")]
|
||||
public int Page { get; set; }
|
||||
[JsonProperty("cid")]
|
||||
public long Cid { get; set; }
|
||||
[JsonProperty("part")]
|
||||
public string Part { get; set; }
|
||||
[JsonProperty("business")]
|
||||
public string Business { get; set; }
|
||||
[JsonProperty("dt")]
|
||||
public int Dt { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using DownKyi.Core.BiliApi.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DownKyi.Core.BiliApi.History.Models
|
||||
{
|
||||
// https://api.bilibili.com/x/v2/history/toview
|
||||
public class ToViewOrigin : BaseModel
|
||||
{
|
||||
//[JsonProperty("code")]
|
||||
//public int Code { get; set; }
|
||||
//[JsonProperty("message")]
|
||||
//public string Message { get; set; }
|
||||
//[JsonProperty("ttl")]
|
||||
//public int Ttl { get; set; }
|
||||
[JsonProperty("data")]
|
||||
public ToViewData Data { get; set; }
|
||||
}
|
||||
|
||||
public class ToViewData : BaseModel
|
||||
{
|
||||
[JsonProperty("count")]
|
||||
public int Count { get; set; }
|
||||
[JsonProperty("list")]
|
||||
public List<ToViewList> List { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using DownKyi.Core.BiliApi.Models;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace DownKyi.Core.BiliApi.History.Models
|
||||
{
|
||||
public class ToViewList : BaseModel
|
||||
{
|
||||
[JsonProperty("aid")]
|
||||
public long Aid { get; set; }
|
||||
// videos
|
||||
// tid
|
||||
// tname
|
||||
// copyright
|
||||
[JsonProperty("pic")]
|
||||
public string Pic { get; set; }
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; }
|
||||
// pubdate
|
||||
// ctime
|
||||
// desc
|
||||
// state
|
||||
// duration
|
||||
// rights
|
||||
[JsonProperty("owner")]
|
||||
public VideoOwner Owner { get; set; }
|
||||
// stat
|
||||
// dynamic
|
||||
// dimension
|
||||
// short_link_v2
|
||||
// first_frame
|
||||
// page
|
||||
// count
|
||||
[JsonProperty("cid")]
|
||||
public long Cid { get; set; }
|
||||
// progress
|
||||
[JsonProperty("add_at")]
|
||||
public long AddAt { get; set; }
|
||||
[JsonProperty("bvid")]
|
||||
public string Bvid { get; set; }
|
||||
// uri
|
||||
// viewed
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using DownKyi.Core.BiliApi.History.Models;
|
||||
using DownKyi.Core.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DownKyi.Core.BiliApi.History
|
||||
{
|
||||
/// <summary>
|
||||
/// 稍后再看
|
||||
/// </summary>
|
||||
public static class ToView
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取稍后再看视频列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<ToViewList> GetToView()
|
||||
{
|
||||
string url = "https://api.bilibili.com/x/v2/history/toview";
|
||||
string referer = "https://www.bilibili.com";
|
||||
string response = WebClient.RequestWeb(url, referer);
|
||||
|
||||
try
|
||||
{
|
||||
var toView = JsonConvert.DeserializeObject<ToViewOrigin>(response);
|
||||
if (toView == null || toView.Data == null) { return null; }
|
||||
return toView.Data.List;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Debugging.Console.PrintLine("GetToView()发生异常: {0}", e);
|
||||
LogManager.Error("ToView", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,6 +151,15 @@
|
||||
<Compile Include="BiliApi\Favorites\Models\FavStatus.cs" />
|
||||
<Compile Include="BiliApi\Favorites\Models\FavUpper.cs" />
|
||||
<Compile Include="BiliApi\Favorites\Models\MediaStatus.cs" />
|
||||
<Compile Include="BiliApi\History\History.cs" />
|
||||
<Compile Include="BiliApi\History\Models\HistoryBusiness.cs" />
|
||||
<Compile Include="BiliApi\History\Models\HistoryCursor.cs" />
|
||||
<Compile Include="BiliApi\History\Models\HistoryData.cs" />
|
||||
<Compile Include="BiliApi\History\Models\HistoryList.cs" />
|
||||
<Compile Include="BiliApi\History\Models\HistoryListHistory.cs" />
|
||||
<Compile Include="BiliApi\History\Models\ToViewData.cs" />
|
||||
<Compile Include="BiliApi\History\Models\ToViewList.cs" />
|
||||
<Compile Include="BiliApi\History\ToView.cs" />
|
||||
<Compile Include="BiliApi\Login\LoginHelper.cs" />
|
||||
<Compile Include="BiliApi\Models\BaseModel.cs" />
|
||||
<Compile Include="BiliApi\BiliUtils\BvId.cs" />
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace DownKyi.Core.Storage
|
||||
public BitmapImage GetHeaderThumbnail(long mid, string name, string url, int width, int height)
|
||||
{
|
||||
string header = GetHeader(mid, name, url);
|
||||
if(header == null) { return null; }
|
||||
|
||||
return GetHeaderThumbnail(header, width, height);
|
||||
}
|
||||
|
||||
@@ -170,6 +170,8 @@ namespace DownKyi
|
||||
containerRegistry.RegisterForNavigation<ViewMySpace>(ViewMySpaceViewModel.Tag);
|
||||
containerRegistry.RegisterForNavigation<ViewMyFavorites>(ViewMyFavoritesViewModel.Tag);
|
||||
containerRegistry.RegisterForNavigation<ViewMyBangumiFollow>(ViewMyBangumiFollowViewModel.Tag);
|
||||
containerRegistry.RegisterForNavigation<ViewMyToViewVideo>(ViewMyToViewVideoViewModel.Tag);
|
||||
containerRegistry.RegisterForNavigation<ViewMyHistory>(ViewMyHistoryViewModel.Tag);
|
||||
|
||||
// downloadManager pages
|
||||
containerRegistry.RegisterForNavigation<ViewDownloading>(ViewDownloadingViewModel.Tag);
|
||||
|
||||
@@ -104,8 +104,10 @@
|
||||
<Compile Include="ViewModels\PageViewModels\Favorites.cs" />
|
||||
<Compile Include="ViewModels\PageViewModels\FavoritesMedia.cs" />
|
||||
<Compile Include="ViewModels\PageViewModels\ChannelMedia.cs" />
|
||||
<Compile Include="ViewModels\PageViewModels\HistoryMedia.cs" />
|
||||
<Compile Include="ViewModels\PageViewModels\PublicationMedia.cs" />
|
||||
<Compile Include="ViewModels\PageViewModels\SpaceItem.cs" />
|
||||
<Compile Include="ViewModels\PageViewModels\ToViewMedia.cs" />
|
||||
<Compile Include="ViewModels\Settings\DisplayFileNamePart.cs" />
|
||||
<Compile Include="Models\ParseScopeDisplay.cs" />
|
||||
<Compile Include="ViewModels\PageViewModels\TabHeader.cs" />
|
||||
@@ -155,7 +157,9 @@
|
||||
<Compile Include="ViewModels\Dialogs\ViewParsingSelectorViewModel.cs" />
|
||||
<Compile Include="ViewModels\ViewMyBangumiFollowViewModel.cs" />
|
||||
<Compile Include="ViewModels\ViewMyFavoritesViewModel.cs" />
|
||||
<Compile Include="ViewModels\ViewMyHistoryViewModel.cs" />
|
||||
<Compile Include="ViewModels\ViewMySpaceViewModel.cs" />
|
||||
<Compile Include="ViewModels\ViewMyToViewVideoViewModel.cs" />
|
||||
<Compile Include="ViewModels\ViewPublicationViewModel.cs" />
|
||||
<Compile Include="ViewModels\ViewPublicFavoritesViewModel.cs" />
|
||||
<Compile Include="ViewModels\ViewSettingsViewModel.cs" />
|
||||
@@ -226,9 +230,15 @@
|
||||
<Compile Include="Views\ViewMyFavorites.xaml.cs">
|
||||
<DependentUpon>ViewMyFavorites.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ViewMyHistory.xaml.cs">
|
||||
<DependentUpon>ViewMyHistory.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ViewMySpace.xaml.cs">
|
||||
<DependentUpon>ViewMySpace.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ViewMyToViewVideo.xaml.cs">
|
||||
<DependentUpon>ViewMyToViewVideo.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ViewPublication.xaml.cs">
|
||||
<DependentUpon>ViewPublication.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -415,10 +425,18 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ViewMyHistory.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ViewMySpace.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ViewMyToViewVideo.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ViewPublication.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -266,6 +266,73 @@
|
||||
q-13.21 7.16 -14.32 22.57 l0 259.85 q1.11 15.42 14.32 22.57 q13.21 7.16 26.42 -1.65 l186.09 -129.92 Z",
|
||||
Fill = "#FF000000"
|
||||
};
|
||||
|
||||
PlatformIpad = new VectorImage
|
||||
{
|
||||
Height = 16,
|
||||
Width = 16,
|
||||
Data = @"M804.57 0 q40 0 73.72 19.43 q33.71 19.43 53.14 53.15 q19.43 33.72 19.43 73.71 l0 731.42 q0 40 -19.43 73.71
|
||||
q-19.43 33.72 -53.14 53.14 q-33.72 19.43 -73.72 19.43 l-585.14 0 q-40 0 -73.72 -19.43 q-33.72 -19.43 -53.15 -53.14
|
||||
q-19.43 -33.71 -19.43 -73.71 l0 -731.42 q0 -40 19.43 -73.71 q19.43 -33.72 53.15 -53.15 q33.72 -19.43 73.72 -19.43
|
||||
l585.14 0 ZM512 877.71 q-22.86 0 -38.86 16 q-16 16 -16 38.86 q0 22.86 16 38.86 q16 16 38.86 16 q22.86 0 38.86 -16
|
||||
q16 -16 16 -38.86 q0 -22.86 -16 -38.86 q-16 -16 -38.86 -16 ZM804.57 73.14 l-585.14 0 q-27.43 0 -48.57 18.28
|
||||
q-21.15 18.28 -24.57 46.86 l0 8 l0 621.71 q0 27.43 18.28 48.57 q18.29 21.14 46.86 24.57 l8 0 l585.14 0
|
||||
q27.43 0 48.57 -18.28 q21.14 -18.28 24.57 -46.86 l0 -8 l0 -621.71 q0 -30.86 -21.14 -52 q-21.14 -21.14 -52 -21.14 Z",
|
||||
Fill = "#FF000000"
|
||||
};
|
||||
|
||||
PlatformMobile = new VectorImage
|
||||
{
|
||||
Height = 16,
|
||||
Width = 16,
|
||||
Data = @"M694.86 0 q40 0 73.72 19.43 q33.71 19.43 53.14 53.15 q19.43 33.72 19.43 73.71 l0 731.42 q0 40 -19.43 73.71
|
||||
q-19.42 33.72 -53.14 53.14 q-33.72 19.43 -73.72 19.43 l-365.72 0 q-40 0 -73.71 -19.43 q-33.72 -19.43 -53.14 -53.14
|
||||
q-19.43 -33.71 -19.43 -73.71 l0 -731.42 q0 -40 19.43 -73.71 q19.42 -33.72 53.14 -53.15 q33.71 -19.43 73.71 -19.43
|
||||
l365.72 0 ZM512 877.71 q-22.86 0 -38.86 16 q-16 16 -16 38.86 q0 22.86 16 38.86 q16 16 38.86 16 q22.86 0 38.86 -16
|
||||
q16 -16 16 -38.86 q0 -22.86 -16 -38.86 q-16 -16 -38.86 -16 ZM694.86 73.14 l-365.72 0 q-27.43 0 -48.57 18.28
|
||||
q-21.14 18.28 -24.57 46.86 l0 8 l0 621.71 q0 27.43 18.28 48.57 q18.29 21.14 46.86 24.57 l8 0 l365.72 0
|
||||
q27.43 0 48.57 -18.28 q21.14 -18.28 24.57 -46.86 l0 -8 l0 -621.71 q0 -30.86 -21.14 -52 q-21.14 -21.14 -52 -21.14 Z",
|
||||
Fill = "#FF000000"
|
||||
};
|
||||
|
||||
PlatformPC = new VectorImage
|
||||
{
|
||||
Height = 16,
|
||||
Width = 16,
|
||||
Data = @"M694.86 804.57 q14.85 0 25.71 10.86 q10.86 10.86 10.86 25.71 q0 14.86 -10.86 25.71 q-10.86 10.86 -25.71 10.86
|
||||
l-365.72 0 q-14.85 0 -25.71 -10.86 q-10.86 -10.86 -10.86 -25.71 q0 -14.86 10.86 -25.71 q10.86 -10.86 25.71 -10.86
|
||||
l365.72 0 ZM877.71 0 q40 0 73.71 19.43 q33.72 19.43 53.14 53.15 q19.43 33.72 19.43 73.71 l0 438.85 q0 40 -19.43 73.72
|
||||
q-19.43 33.72 -53.14 53.14 q-33.71 19.43 -73.71 19.43 l-731.42 0 q-40 0 -73.71 -19.43 q-33.72 -19.43 -53.15 -53.14
|
||||
q-19.43 -33.72 -19.43 -73.72 l0 -438.85 q0 -40 19.43 -73.71 q19.43 -33.72 53.15 -53.15 q33.72 -19.43 73.71 -19.43
|
||||
l731.42 0 ZM877.71 73.14 l-731.42 0 q-27.43 0 -48.57 18.28 q-21.15 18.28 -24.58 46.86 l0 8 l0 438.85
|
||||
q0 27.43 18.28 48.58 q18.28 21.14 46.86 24.57 l8 0 l731.42 0 q27.43 0 48.57 -18.29 q21.14 -18.29 24.58 -46.86
|
||||
l0 -8 l0 -438.85 q0 -30.86 -21.14 -52 q-21.14 -21.14 -52 -21.14 ZM347.43 182.86 q34.28 0 63.99 17.14
|
||||
q29.72 17.14 46.86 46.85 q17.15 29.72 17.15 64 q0 34.28 -17.15 64 q-17.14 29.71 -46.86 46.86
|
||||
q-29.71 17.14 -63.99 17.14 l-91.43 0 l0 109.71 l-73.14 0 l0 -365.71 l164.57 0 ZM694.86 182.86
|
||||
q44.57 0 82.85 19.43 q38.29 19.42 63.43 53.71 l-60.57 41.14 q-22.86 -27.43 -56 -37.14 q-33.14 -9.71 -66.28 2.29
|
||||
q-33.14 12 -53.14 40.57 q-20 28.57 -20 62.86 q0 34.28 20 62.85 q20 28.57 53.14 40.57 q33.14 12 66.28 2.28
|
||||
q33.14 -9.71 56 -37.13 l60.57 41.14 q-38.85 51.43 -101.14 67.43 q-62.29 16 -121.14 -10.86
|
||||
q-58.86 -26.86 -87.42 -84.58 q-28.57 -57.71 -14.86 -120.57 q13.71 -62.86 64 -103.43 q50.28 -40.57 114.28 -40.57
|
||||
ZM347.43 256 l-91.43 0 l0 109.71 l91.43 0 q22.86 0 38.86 -16 q16 -16 16 -38.85 q0 -22.86 -16 -38.86 q-16 -16 -38.86 -16 Z",
|
||||
Fill = "#FF000000"
|
||||
};
|
||||
|
||||
PlatformTV = new VectorImage
|
||||
{
|
||||
Height = 16,
|
||||
Width = 16,
|
||||
Data = @"M768 804.57 q14.86 0 25.72 10.86 q10.86 10.86 10.86 25.71 q0 14.86 -10.86 25.71 q-10.86 10.86 -25.72 10.86
|
||||
l-512 0 q-14.86 0 -25.72 -10.86 q-10.85 -10.86 -10.85 -25.71 q0 -14.86 10.85 -25.71 q10.85 -10.86 25.72 -10.86
|
||||
l512 0 ZM877.71 0 q40 0 73.71 19.43 q33.72 19.43 53.14 53.15 q19.43 33.72 19.43 73.71 l0 438.85 q0 40 -19.43 73.72
|
||||
q-19.43 33.72 -53.14 53.14 q-33.71 19.43 -73.71 19.43 l-731.42 0 q-40 0 -73.71 -19.43 q-33.72 -19.43 -53.15 -53.14
|
||||
q-19.43 -33.72 -19.43 -73.72 l0 -438.85 q0 -40 19.43 -73.71 q19.43 -33.72 53.15 -53.15 q33.72 -19.43 73.71 -19.43
|
||||
l731.42 0 ZM877.71 73.14 l-731.42 0 q-27.43 0 -48.57 18.28 q-21.15 18.28 -24.58 46.86 l0 8 l0 438.85
|
||||
q0 27.43 18.28 48.58 q18.28 21.14 46.86 24.57 l8 0 l731.42 0 q27.43 0 48.57 -18.29 q21.14 -18.29 24.58 -46.86
|
||||
l0 -8 l0 -438.85 q0 -30.86 -21.14 -52 q-21.14 -21.14 -52 -21.14 ZM585.14 182.86 l109.72 274.28 l109.71 -274.28
|
||||
l73.14 0 l-146.28 365.71 l-73.14 0 l-116.58 -292.57 l-176 0 l0 292.57 l-73.14 0 l0 -292.57 l-146.28 0 l0 -73.14 l438.85 0 Z",
|
||||
Fill = "#FF000000"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public VectorImage Play { get; private set; }
|
||||
@@ -290,5 +357,11 @@
|
||||
|
||||
public VectorImage VideoUp { get; private set; }
|
||||
public VectorImage Channel { get; private set; }
|
||||
|
||||
public VectorImage PlatformIpad { get; private set; }
|
||||
public VectorImage PlatformMobile { get; private set; }
|
||||
public VectorImage PlatformPC { get; private set; }
|
||||
public VectorImage PlatformTV { get; private set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,15 @@
|
||||
<system:String x:Key="FollowMovie">追剧</system:String>
|
||||
<system:String x:Key="BangumiNotWatched">尚未观看</system:String>
|
||||
|
||||
<!-- MyHistory -->
|
||||
<system:String x:Key="MyHistory">历史记录</system:String>
|
||||
<system:String x:Key="HistoryFinished">已看完</system:String>
|
||||
<system:String x:Key="HistoryStarted">刚开始</system:String>
|
||||
<system:String x:Key="HistoryWatch">看到</system:String>
|
||||
|
||||
<!-- MyToView -->
|
||||
<system:String x:Key="MyToView">稍后再看</system:String>
|
||||
|
||||
<!-- Publication -->
|
||||
<system:String x:Key="DownloadSelectedPublication">下载选中项</system:String>
|
||||
<system:String x:Key="DownloadAllPublication">下载全部</system:String>
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace DownKyi.Services
|
||||
FavoriteNumber = media.CntInfo != null ? Format.FormatNumber(media.CntInfo.Collect) : "0",
|
||||
Duration = Format.FormatDuration2(media.Duration),
|
||||
UpName = media.Upper != null ? media.Upper.Name : string.Empty,
|
||||
UpperMid = media.Upper != null ? media.Upper.Mid : -1,
|
||||
UpMid = media.Upper != null ? media.Upper.Mid : -1,
|
||||
CreateTime = ctime,
|
||||
FavTime = favTime
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace DownKyi.ViewModels.PageViewModels
|
||||
|
||||
public long Avid { get; set; }
|
||||
public string Bvid { get; set; }
|
||||
public long UpperMid { get; set; }
|
||||
public long UpMid { get; set; }
|
||||
|
||||
#region 页面属性申明
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace DownKyi.ViewModels.PageViewModels
|
||||
{
|
||||
if (!(parameter is string tag)) { return; }
|
||||
|
||||
NavigateToView.NavigateToViewUserSpace(eventAggregator, tag, UpperMid);
|
||||
NavigateToView.NavigateToViewUserSpace(eventAggregator, tag, UpMid);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
using DownKyi.Images;
|
||||
using DownKyi.Utils;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace DownKyi.ViewModels.PageViewModels
|
||||
{
|
||||
public class HistoryMedia : BindableBase
|
||||
{
|
||||
protected readonly IEventAggregator eventAggregator;
|
||||
|
||||
public HistoryMedia(IEventAggregator eventAggregator)
|
||||
{
|
||||
this.eventAggregator = eventAggregator;
|
||||
}
|
||||
|
||||
// bvid
|
||||
public string Bvid { get; set; }
|
||||
|
||||
// 播放url
|
||||
public string Url { get; set; }
|
||||
|
||||
// UP主的mid
|
||||
public long UpMid { get; set; }
|
||||
|
||||
// 类型
|
||||
public string Business { get; set; }
|
||||
|
||||
#region 页面属性申明
|
||||
|
||||
// 是否选中
|
||||
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);
|
||||
}
|
||||
|
||||
// 分P的标题
|
||||
private string subTitle;
|
||||
public string SubTitle
|
||||
{
|
||||
get => subTitle;
|
||||
set => SetProperty(ref subTitle, value);
|
||||
}
|
||||
|
||||
// 时长
|
||||
private long duration;
|
||||
public long Duration
|
||||
{
|
||||
get => duration;
|
||||
set => SetProperty(ref duration, value);
|
||||
}
|
||||
|
||||
// tag标签
|
||||
private string tagName;
|
||||
public string TagName
|
||||
{
|
||||
get => tagName;
|
||||
set => SetProperty(ref tagName, value);
|
||||
}
|
||||
|
||||
// new_desc 剧集或分P描述
|
||||
private string partdesc;
|
||||
public string Partdesc
|
||||
{
|
||||
get => partdesc;
|
||||
set => SetProperty(ref partdesc, value);
|
||||
}
|
||||
|
||||
// 观看进度
|
||||
private string progress;
|
||||
public string Progress
|
||||
{
|
||||
get => progress;
|
||||
set => SetProperty(ref progress, value);
|
||||
}
|
||||
|
||||
// 观看平台
|
||||
private VectorImage platform;
|
||||
public VectorImage Platform
|
||||
{
|
||||
get => platform;
|
||||
set => SetProperty(ref platform, value);
|
||||
}
|
||||
|
||||
// UP主的昵称
|
||||
private string upName;
|
||||
public string UpName
|
||||
{
|
||||
get => upName;
|
||||
set => SetProperty(ref upName, value);
|
||||
}
|
||||
|
||||
// UP主的头像
|
||||
private BitmapImage upHeader;
|
||||
public BitmapImage UpHeader
|
||||
{
|
||||
get => upHeader;
|
||||
set => SetProperty(ref upHeader, value);
|
||||
}
|
||||
|
||||
// 是否显示Partdesc
|
||||
private Visibility partdescVisibility;
|
||||
public Visibility PartdescVisibility
|
||||
{
|
||||
get => partdescVisibility;
|
||||
set => SetProperty(ref partdescVisibility, value);
|
||||
}
|
||||
|
||||
// 是否显示UP主信息和分区信息
|
||||
private Visibility upAndTagVisibility;
|
||||
public Visibility UpAndTagVisibility
|
||||
{
|
||||
get => upAndTagVisibility;
|
||||
set => SetProperty(ref upAndTagVisibility, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 命令申明
|
||||
|
||||
// 视频标题点击事件
|
||||
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; }
|
||||
|
||||
NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, tag, Url);
|
||||
}
|
||||
|
||||
// UP主头像点击事件
|
||||
private DelegateCommand<object> upCommand;
|
||||
public DelegateCommand<object> UpCommand => upCommand ?? (upCommand = new DelegateCommand<object>(ExecuteUpCommand));
|
||||
|
||||
/// <summary>
|
||||
/// UP主头像点击事件
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
private void ExecuteUpCommand(object parameter)
|
||||
{
|
||||
if (!(parameter is string tag)) { return; }
|
||||
|
||||
NavigateToView.NavigateToViewUserSpace(eventAggregator, tag, UpMid);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
using DownKyi.Core.BiliApi.BiliUtils;
|
||||
using DownKyi.Utils;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace DownKyi.ViewModels.PageViewModels
|
||||
{
|
||||
public class ToViewMedia : BindableBase
|
||||
{
|
||||
protected readonly IEventAggregator eventAggregator;
|
||||
|
||||
public ToViewMedia(IEventAggregator eventAggregator)
|
||||
{
|
||||
this.eventAggregator = eventAggregator;
|
||||
}
|
||||
|
||||
// aid
|
||||
public long Aid { get; set; }
|
||||
|
||||
// bvid
|
||||
public string Bvid { get; set; }
|
||||
|
||||
// UP主的mid
|
||||
public long UpMid { get; set; }
|
||||
|
||||
#region 页面属性申明
|
||||
|
||||
// 是否选中
|
||||
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);
|
||||
}
|
||||
|
||||
// UP主的昵称
|
||||
private string upName;
|
||||
public string UpName
|
||||
{
|
||||
get => upName;
|
||||
set => SetProperty(ref upName, value);
|
||||
}
|
||||
|
||||
// UP主的头像
|
||||
private BitmapImage upHeader;
|
||||
public BitmapImage UpHeader
|
||||
{
|
||||
get => upHeader;
|
||||
set => SetProperty(ref upHeader, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 命令申明
|
||||
|
||||
// 视频标题点击事件
|
||||
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; }
|
||||
|
||||
NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, tag, $"{ParseEntrance.VideoUrl}{Bvid}");
|
||||
}
|
||||
|
||||
// UP主头像点击事件
|
||||
private DelegateCommand<object> upCommand;
|
||||
public DelegateCommand<object> UpCommand => upCommand ?? (upCommand = new DelegateCommand<object>(ExecuteUpCommand));
|
||||
|
||||
/// <summary>
|
||||
/// UP主头像点击事件
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
private void ExecuteUpCommand(object parameter)
|
||||
{
|
||||
if (!(parameter is string tag)) { return; }
|
||||
|
||||
NavigateToView.NavigateToViewUserSpace(eventAggregator, tag, UpMid);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -237,7 +237,7 @@ namespace DownKyi.ViewModels
|
||||
/// <param name="isOnlySelected"></param>
|
||||
private async void AddToDownload(bool isOnlySelected)
|
||||
{
|
||||
// 收藏夹里只有视频
|
||||
// 频道里只有视频
|
||||
AddToDownloadService addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO);
|
||||
|
||||
// 选择文件夹
|
||||
@@ -411,6 +411,7 @@ namespace DownKyi.ViewModels
|
||||
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
|
||||
Medias.Clear();
|
||||
IsSelectAll = false;
|
||||
|
||||
// 根据传入参数不同执行不同任务
|
||||
var parameter = navigationContext.Parameters.GetValue<Dictionary<string, object>>("Parameter");
|
||||
|
||||
@@ -471,6 +471,7 @@ namespace DownKyi.ViewModels
|
||||
NoDataVisibility = Visibility.Collapsed;
|
||||
|
||||
Medias.Clear();
|
||||
IsSelectAll = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -481,6 +482,8 @@ namespace DownKyi.ViewModels
|
||||
{
|
||||
base.OnNavigatedTo(navigationContext);
|
||||
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
|
||||
|
||||
// 根据传入参数不同执行不同任务
|
||||
mid = navigationContext.Parameters.GetValue<long>("Parameter");
|
||||
if (mid == 0)
|
||||
|
||||
@@ -422,6 +422,7 @@ namespace DownKyi.ViewModels
|
||||
TabHeaders.Clear();
|
||||
Medias.Clear();
|
||||
SelectTabId = -1;
|
||||
IsSelectAll = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,499 @@
|
||||
using DownKyi.Core.BiliApi.History;
|
||||
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 Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace DownKyi.ViewModels
|
||||
{
|
||||
public class ViewMyHistoryViewModel : BaseViewModel
|
||||
{
|
||||
public const string Tag = "PageMyHistory";
|
||||
|
||||
private readonly IDialogService dialogService;
|
||||
|
||||
private CancellationTokenSource tokenSource;
|
||||
|
||||
// 每页视频数量,暂时在此写死,以后在设置中增加选项
|
||||
private readonly int VideoNumberInPage = 30;
|
||||
|
||||
#region 页面属性申明
|
||||
|
||||
private string pageName = Tag;
|
||||
public string PageName
|
||||
{
|
||||
get => pageName;
|
||||
set => SetProperty(ref pageName, value);
|
||||
}
|
||||
|
||||
private VectorImage arrowBack;
|
||||
public VectorImage ArrowBack
|
||||
{
|
||||
get => arrowBack;
|
||||
set => SetProperty(ref arrowBack, value);
|
||||
}
|
||||
|
||||
private Visibility contentVisibility;
|
||||
public Visibility ContentVisibility
|
||||
{
|
||||
get => contentVisibility;
|
||||
set => SetProperty(ref contentVisibility, value);
|
||||
}
|
||||
|
||||
private ObservableCollection<HistoryMedia> medias;
|
||||
public ObservableCollection<HistoryMedia> Medias
|
||||
{
|
||||
get => medias;
|
||||
set => SetProperty(ref medias, value);
|
||||
}
|
||||
|
||||
private bool isSelectAll;
|
||||
public bool IsSelectAll
|
||||
{
|
||||
get => isSelectAll;
|
||||
set => SetProperty(ref isSelectAll, value);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public ViewMyHistoryViewModel(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");
|
||||
|
||||
Medias = new ObservableCollection<HistoryMedia>();
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
#region 命令申明
|
||||
|
||||
// 返回事件
|
||||
private DelegateCommand backSpaceCommand;
|
||||
public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace));
|
||||
|
||||
/// <summary>
|
||||
/// 返回事件
|
||||
/// </summary>
|
||||
private void ExecuteBackSpace()
|
||||
{
|
||||
InitView();
|
||||
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorText");
|
||||
|
||||
// 结束任务
|
||||
tokenSource?.Cancel();
|
||||
|
||||
NavigationParam parameter = new NavigationParam
|
||||
{
|
||||
ViewName = ParentView,
|
||||
ParentViewName = null,
|
||||
Parameter = null
|
||||
};
|
||||
eventAggregator.GetEvent<NavigationEvent>().Publish(parameter);
|
||||
}
|
||||
|
||||
// 全选按钮点击事件
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// 添加到下载
|
||||
/// </summary>
|
||||
/// <param name="isOnlySelected"></param>
|
||||
private async void AddToDownload(bool isOnlySelected)
|
||||
{
|
||||
// BANGUMI类型
|
||||
AddToDownloadService addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO);
|
||||
|
||||
// 选择文件夹
|
||||
string directory = addToDownloadService.SetDirectory(dialogService);
|
||||
|
||||
// 视频计数
|
||||
int i = 0;
|
||||
await Task.Run(() =>
|
||||
{
|
||||
// 为了避免执行其他操作时,
|
||||
// Medias变化导致的异常
|
||||
var list = Medias.ToList();
|
||||
|
||||
// 添加到下载
|
||||
foreach (var media in list)
|
||||
{
|
||||
// 只下载选中项,跳过未选中项
|
||||
if (isOnlySelected && !media.IsSelected) { continue; }
|
||||
|
||||
/// 有分P的就下载全部
|
||||
|
||||
// 开启服务
|
||||
IInfoService service = null;
|
||||
switch (media.Business)
|
||||
{
|
||||
case "archive":
|
||||
service = new VideoInfoService(media.Url);
|
||||
break;
|
||||
case "pgc":
|
||||
service = new BangumiInfoService(media.Url);
|
||||
break;
|
||||
}
|
||||
if (service == null) { return; }
|
||||
|
||||
addToDownloadService.SetVideoInfoService(service);
|
||||
addToDownloadService.GetVideo();
|
||||
addToDownloadService.ParseVideo(service);
|
||||
// 下载
|
||||
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 async void UpdateHistoryMediaList()
|
||||
{
|
||||
LoadingVisibility = Visibility.Visible;
|
||||
NoDataVisibility = Visibility.Collapsed;
|
||||
Medias.Clear();
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
CancellationToken cancellationToken = tokenSource.Token;
|
||||
|
||||
var historyList = History.GetHistory(0, 0, VideoNumberInPage);
|
||||
if (historyList == null || historyList.List == null || historyList.List.Count == 0)
|
||||
{
|
||||
LoadingVisibility = Visibility.Collapsed;
|
||||
NoDataVisibility = Visibility.Visible;
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var history in historyList.List)
|
||||
{
|
||||
if (history.History == null) { continue; }
|
||||
|
||||
if (history.History.Business != "archive" && history.History.Business != "pgc")
|
||||
{ continue; }
|
||||
|
||||
// 播放url
|
||||
string url = "https://www.bilibili.com";
|
||||
switch (history.History.Business)
|
||||
{
|
||||
case "archive":
|
||||
url = "https://www.bilibili.com/video/" + history.History.Bvid;
|
||||
break;
|
||||
case "pgc":
|
||||
url = history.Uri;
|
||||
break;
|
||||
}
|
||||
|
||||
// 查询、保存封面
|
||||
string coverUrl = history.Cover;
|
||||
BitmapImage cover;
|
||||
if (coverUrl == null || coverUrl == "")
|
||||
{
|
||||
cover = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!coverUrl.ToLower().StartsWith("http"))
|
||||
{
|
||||
coverUrl = $"https:{history.Cover}";
|
||||
}
|
||||
|
||||
StorageCover storageCover = new StorageCover();
|
||||
cover = storageCover.GetCoverThumbnail(history.History.Oid, history.History.Bvid, history.History.Cid, coverUrl, 160, 100);
|
||||
}
|
||||
|
||||
// 获取用户头像
|
||||
string upName;
|
||||
BitmapImage upHeader;
|
||||
if (history.AuthorFace != null)
|
||||
{
|
||||
upName = history.AuthorName;
|
||||
StorageHeader storageHeader = new StorageHeader();
|
||||
upHeader = storageHeader.GetHeaderThumbnail(history.AuthorMid, upName, history.AuthorFace, 24, 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
upName = "";
|
||||
upHeader = null;
|
||||
}
|
||||
|
||||
// 观看进度
|
||||
// -1 已看完
|
||||
// 0 刚开始
|
||||
// >0 看到 progress
|
||||
string progress;
|
||||
if (history.Progress == -1) { progress = DictionaryResource.GetString("HistoryFinished"); }
|
||||
else if (history.Progress == 0) { progress = DictionaryResource.GetString("HistoryStarted"); }
|
||||
else { progress = DictionaryResource.GetString("HistoryWatch") + " " + Format.FormatDuration3(history.Progress); }
|
||||
|
||||
// 观看平台
|
||||
VectorImage platform;
|
||||
switch (history.History.Dt)
|
||||
{
|
||||
case 1:
|
||||
case 3:
|
||||
case 5:
|
||||
case 7:
|
||||
// 手机端
|
||||
platform = NormalIcon.Instance().PlatformMobile;
|
||||
break;
|
||||
case 2:
|
||||
// web端
|
||||
platform = NormalIcon.Instance().PlatformPC;
|
||||
break;
|
||||
case 4:
|
||||
case 6:
|
||||
// pad端
|
||||
platform = NormalIcon.Instance().PlatformIpad;
|
||||
break;
|
||||
case 33:
|
||||
// TV端
|
||||
platform = NormalIcon.Instance().PlatformTV;
|
||||
break;
|
||||
default:
|
||||
// 其他
|
||||
platform = null;
|
||||
break;
|
||||
}
|
||||
|
||||
// 是否显示Partdesc
|
||||
Visibility partdescVisibility;
|
||||
if (history.NewDesc == "")
|
||||
{
|
||||
partdescVisibility = Visibility.Hidden;
|
||||
}
|
||||
else
|
||||
{
|
||||
partdescVisibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
// 是否显示UP主信息和分区信息
|
||||
Visibility upAndTagVisibility;
|
||||
if (history.History.Business == "archive")
|
||||
{
|
||||
upAndTagVisibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
upAndTagVisibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
App.PropertyChangeAsync(() =>
|
||||
{
|
||||
HistoryMedia media = new HistoryMedia(eventAggregator)
|
||||
{
|
||||
Business = history.History.Business,
|
||||
Bvid = history.History.Bvid,
|
||||
Url = url,
|
||||
UpMid = history.AuthorMid,
|
||||
Cover = cover ?? new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")),
|
||||
Title = history.Title,
|
||||
SubTitle = history.ShowTitle,
|
||||
Duration = history.Duration,
|
||||
TagName = history.TagName,
|
||||
Partdesc = history.NewDesc,
|
||||
Progress = progress,
|
||||
Platform = platform,
|
||||
UpName = upName,
|
||||
UpHeader = upHeader,
|
||||
|
||||
PartdescVisibility = partdescVisibility,
|
||||
UpAndTagVisibility = upAndTagVisibility,
|
||||
};
|
||||
|
||||
Medias.Add(media);
|
||||
|
||||
ContentVisibility = Visibility.Visible;
|
||||
LoadingVisibility = Visibility.Collapsed;
|
||||
NoDataVisibility = Visibility.Collapsed;
|
||||
});
|
||||
|
||||
// 判断是否该结束线程,若为true,跳出循环
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, (tokenSource = new CancellationTokenSource()).Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化页面数据
|
||||
/// </summary>
|
||||
private void InitView()
|
||||
{
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
|
||||
|
||||
ContentVisibility = Visibility.Collapsed;
|
||||
LoadingVisibility = Visibility.Collapsed;
|
||||
NoDataVisibility = Visibility.Collapsed;
|
||||
|
||||
Medias.Clear();
|
||||
IsSelectAll = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导航到VideoDetail页面时执行
|
||||
/// </summary>
|
||||
/// <param name="navigationContext"></param>
|
||||
public override void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
base.OnNavigatedTo(navigationContext);
|
||||
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
|
||||
|
||||
// 根据传入参数不同执行不同任务
|
||||
long mid = navigationContext.Parameters.GetValue<long>("Parameter");
|
||||
if (mid == 0)
|
||||
{
|
||||
IsSelectAll = false;
|
||||
foreach (var media in Medias)
|
||||
{
|
||||
media.IsSelected = false;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
InitView();
|
||||
|
||||
UpdateHistoryMediaList();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -346,10 +346,10 @@ namespace DownKyi.ViewModels
|
||||
NavigateToView.NavigationView(eventAggregator, ViewMyBangumiFollowViewModel.Tag, Tag, mid);
|
||||
break;
|
||||
case 2:
|
||||
Console.WriteLine(SelectedPackage);
|
||||
NavigateToView.NavigationView(eventAggregator, ViewMyToViewVideoViewModel.Tag, Tag, mid);
|
||||
break;
|
||||
case 3:
|
||||
Console.WriteLine(SelectedPackage);
|
||||
NavigateToView.NavigationView(eventAggregator, ViewMyHistoryViewModel.Tag, Tag, mid);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,400 @@
|
||||
using DownKyi.Core.BiliApi.History;
|
||||
using DownKyi.Core.BiliApi.VideoStream;
|
||||
using DownKyi.Core.Storage;
|
||||
using DownKyi.CustomControl;
|
||||
using DownKyi.Events;
|
||||
using DownKyi.Images;
|
||||
using DownKyi.Services;
|
||||
using DownKyi.Services.Download;
|
||||
using DownKyi.Utils;
|
||||
using DownKyi.ViewModels.PageViewModels;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace DownKyi.ViewModels
|
||||
{
|
||||
public class ViewMyToViewVideoViewModel : BaseViewModel
|
||||
{
|
||||
public const string Tag = "PageMyToView";
|
||||
|
||||
private readonly IDialogService dialogService;
|
||||
|
||||
private CancellationTokenSource tokenSource;
|
||||
|
||||
#region 页面属性申明
|
||||
|
||||
private string pageName = Tag;
|
||||
public string PageName
|
||||
{
|
||||
get => pageName;
|
||||
set => SetProperty(ref pageName, value);
|
||||
}
|
||||
|
||||
private VectorImage arrowBack;
|
||||
public VectorImage ArrowBack
|
||||
{
|
||||
get => arrowBack;
|
||||
set => SetProperty(ref arrowBack, value);
|
||||
}
|
||||
|
||||
private Visibility contentVisibility;
|
||||
public Visibility ContentVisibility
|
||||
{
|
||||
get => contentVisibility;
|
||||
set => SetProperty(ref contentVisibility, value);
|
||||
}
|
||||
|
||||
private ObservableCollection<ToViewMedia> medias;
|
||||
public ObservableCollection<ToViewMedia> Medias
|
||||
{
|
||||
get => medias;
|
||||
set => SetProperty(ref medias, value);
|
||||
}
|
||||
|
||||
private bool isSelectAll;
|
||||
public bool IsSelectAll
|
||||
{
|
||||
get => isSelectAll;
|
||||
set => SetProperty(ref isSelectAll, value);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public ViewMyToViewVideoViewModel(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");
|
||||
|
||||
Medias = new ObservableCollection<ToViewMedia>();
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
#region 命令申明
|
||||
|
||||
// 返回事件
|
||||
private DelegateCommand backSpaceCommand;
|
||||
public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace));
|
||||
|
||||
/// <summary>
|
||||
/// 返回事件
|
||||
/// </summary>
|
||||
private void ExecuteBackSpace()
|
||||
{
|
||||
InitView();
|
||||
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorText");
|
||||
|
||||
// 结束任务
|
||||
tokenSource?.Cancel();
|
||||
|
||||
NavigationParam parameter = new NavigationParam
|
||||
{
|
||||
ViewName = ParentView,
|
||||
ParentViewName = null,
|
||||
Parameter = null
|
||||
};
|
||||
eventAggregator.GetEvent<NavigationEvent>().Publish(parameter);
|
||||
}
|
||||
|
||||
// 全选按钮点击事件
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// 添加到下载
|
||||
/// </summary>
|
||||
/// <param name="isOnlySelected"></param>
|
||||
private async void AddToDownload(bool isOnlySelected)
|
||||
{
|
||||
// 稍后再看里只有视频
|
||||
AddToDownloadService addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO);
|
||||
|
||||
// 选择文件夹
|
||||
string directory = addToDownloadService.SetDirectory(dialogService);
|
||||
|
||||
// 视频计数
|
||||
int i = 0;
|
||||
await Task.Run(() =>
|
||||
{
|
||||
// 为了避免执行其他操作时,
|
||||
// Medias变化导致的异常
|
||||
var list = Medias.ToList();
|
||||
|
||||
// 添加到下载
|
||||
foreach (var media in list)
|
||||
{
|
||||
// 只下载选中项,跳过未选中项
|
||||
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 async void UpdateToViewMediaList()
|
||||
{
|
||||
LoadingVisibility = Visibility.Visible;
|
||||
NoDataVisibility = Visibility.Collapsed;
|
||||
Medias.Clear();
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
CancellationToken cancellationToken = tokenSource.Token;
|
||||
|
||||
var toViewList = ToView.GetToView();
|
||||
if (toViewList == null || toViewList.Count == 0)
|
||||
{
|
||||
LoadingVisibility = Visibility.Collapsed;
|
||||
NoDataVisibility = Visibility.Visible;
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var toView in toViewList)
|
||||
{
|
||||
|
||||
// 查询、保存封面
|
||||
string coverUrl = toView.Pic;
|
||||
BitmapImage cover;
|
||||
if (coverUrl == null || coverUrl == "")
|
||||
{
|
||||
cover = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!coverUrl.ToLower().StartsWith("http"))
|
||||
{
|
||||
coverUrl = $"https:{toView.Pic}";
|
||||
}
|
||||
|
||||
StorageCover storageCover = new StorageCover();
|
||||
cover = storageCover.GetCoverThumbnail(toView.Aid, toView.Bvid, toView.Cid, coverUrl, 160, 100);
|
||||
}
|
||||
|
||||
// 获取用户头像
|
||||
long upMid = -1;
|
||||
string upName;
|
||||
BitmapImage upHeader;
|
||||
if (toView.Owner != null && toView.Owner.Face != null)
|
||||
{
|
||||
upMid = toView.Owner.Mid;
|
||||
upName = toView.Owner.Name;
|
||||
StorageHeader storageHeader = new StorageHeader();
|
||||
upHeader = storageHeader.GetHeaderThumbnail(toView.Owner.Mid, upName, toView.Owner.Face, 24, 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
upName = "";
|
||||
upHeader = null;
|
||||
}
|
||||
|
||||
App.PropertyChangeAsync(() =>
|
||||
{
|
||||
ToViewMedia media = new ToViewMedia(eventAggregator)
|
||||
{
|
||||
Aid = toView.Aid,
|
||||
Bvid = toView.Bvid,
|
||||
UpMid = upMid,
|
||||
Cover = cover ?? new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")),
|
||||
Title = toView.Title,
|
||||
UpName = upName,
|
||||
UpHeader = upHeader
|
||||
};
|
||||
|
||||
Medias.Add(media);
|
||||
|
||||
ContentVisibility = Visibility.Visible;
|
||||
LoadingVisibility = Visibility.Collapsed;
|
||||
NoDataVisibility = Visibility.Collapsed;
|
||||
});
|
||||
|
||||
// 判断是否该结束线程,若为true,跳出循环
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, (tokenSource = new CancellationTokenSource()).Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化页面数据
|
||||
/// </summary>
|
||||
private void InitView()
|
||||
{
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
|
||||
|
||||
ContentVisibility = Visibility.Collapsed;
|
||||
LoadingVisibility = Visibility.Collapsed;
|
||||
NoDataVisibility = Visibility.Collapsed;
|
||||
|
||||
Medias.Clear();
|
||||
IsSelectAll = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导航到VideoDetail页面时执行
|
||||
/// </summary>
|
||||
/// <param name="navigationContext"></param>
|
||||
public override void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
base.OnNavigatedTo(navigationContext);
|
||||
|
||||
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
|
||||
|
||||
// 根据传入参数不同执行不同任务
|
||||
long mid = navigationContext.Parameters.GetValue<long>("Parameter");
|
||||
if (mid == 0)
|
||||
{
|
||||
IsSelectAll = false;
|
||||
foreach (var media in Medias)
|
||||
{
|
||||
media.IsSelected = false;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
InitView();
|
||||
|
||||
UpdateToViewMediaList();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -446,6 +446,7 @@ namespace DownKyi.ViewModels
|
||||
TabHeaders.Clear();
|
||||
Medias.Clear();
|
||||
SelectTabId = -1;
|
||||
IsSelectAll = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -234,7 +234,7 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="1" />
|
||||
<RowDefinition Height="49" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ListBox
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="1" />
|
||||
<RowDefinition Height="49" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ListBox
|
||||
|
||||
@@ -0,0 +1,362 @@
|
||||
<UserControl
|
||||
x:Class="DownKyi.Views.ViewMyHistory"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:custom="clr-namespace:DownKyi.CustomControl"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True">
|
||||
<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}">
|
||||
<Grid
|
||||
Name="nameMediaPanel"
|
||||
Height="100"
|
||||
Margin="20,15,10,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="160" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border
|
||||
Name="nameCover"
|
||||
Grid.Column="0"
|
||||
Width="160"
|
||||
Height="100"
|
||||
HorizontalAlignment="Center"
|
||||
CornerRadius="5">
|
||||
<Border.Background>
|
||||
<!-- 长宽比:1.6 -->
|
||||
<ImageBrush ImageSource="{Binding Cover}" Stretch="UniformToFill" />
|
||||
</Border.Background>
|
||||
</Border>
|
||||
|
||||
<Image
|
||||
Name="nameChecked"
|
||||
Grid.Column="0"
|
||||
Width="24"
|
||||
Height="24"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Source="/DownKyi;component/Resources/checked.png" />
|
||||
|
||||
<Grid Grid.Column="1" Margin="20,0,0,5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Name="nameTitle"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Cursor="Hand"
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
Text="{Binding Title}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
ToolTip="{Binding Title}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseLeftButtonUp">
|
||||
<i:InvokeCommandAction Command="{Binding TitleCommand}" CommandParameter="{Binding DataContext.PageName, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBlock>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource BrushTextGrey}"
|
||||
Text="{Binding SubTitle}" />
|
||||
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="300" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<ContentControl
|
||||
Width="16"
|
||||
Height="16"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<Path
|
||||
Width="{Binding Platform.Width}"
|
||||
Height="{Binding Platform.Height}"
|
||||
Data="{Binding Platform.Data}"
|
||||
Fill="{DynamicResource BrushTextGrey}"
|
||||
Stretch="Uniform" />
|
||||
</ContentControl>
|
||||
|
||||
<TextBlock
|
||||
Margin="10,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource BrushTextGrey}"
|
||||
Text="{Binding Progress}" />
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding PartdescVisibility}">
|
||||
<TextBlock
|
||||
Margin="10,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource BrushTextGrey}"
|
||||
Text="|" />
|
||||
<TextBlock
|
||||
Margin="10,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource BrushTextGrey}"
|
||||
Text="{Binding Partdesc}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Orientation="Horizontal"
|
||||
Visibility="{Binding UpAndTagVisibility}">
|
||||
<StackPanel
|
||||
Name="nameUpper"
|
||||
Cursor="Hand"
|
||||
Orientation="Horizontal">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseLeftButtonUp">
|
||||
<i:InvokeCommandAction Command="{Binding UpCommand}" CommandParameter="{Binding DataContext.PageName, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<Border
|
||||
Name="nameUpperHeader"
|
||||
Width="24"
|
||||
Height="24"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="12">
|
||||
<Border.Background>
|
||||
<ImageBrush ImageSource="{Binding UpHeader}" />
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<TextBlock
|
||||
Name="nameUpperName"
|
||||
Margin="10,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource BrushTextGrey}"
|
||||
Text="{Binding UpName}" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Margin="10,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource BrushTextGrey}"
|
||||
Text="|" />
|
||||
<TextBlock
|
||||
Margin="10,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource BrushTextGrey}"
|
||||
Text="{Binding TagName}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Height="1"
|
||||
Margin="20,0,20,0"
|
||||
VerticalAlignment="Bottom"
|
||||
Background="{DynamicResource BrushBorderTranslucent}" />
|
||||
</Grid>
|
||||
<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="#FF00A1D6" />
|
||||
</Trigger>
|
||||
<Trigger SourceName="nameUpper" Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="nameUpperName" Property="Foreground" Value="#FF00A1D6" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<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 MyHistory}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
|
||||
|
||||
<Grid Grid.Row="2" Visibility="{Binding ContentVisibility}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="1" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ListBox
|
||||
x:Name="nameMedias"
|
||||
Grid.Row="0"
|
||||
BorderThickness="0"
|
||||
ItemContainerStyle="{StaticResource MediaListStyle}"
|
||||
ItemsSource="{Binding Medias}"
|
||||
ScrollViewer.CanContentScroll="False"
|
||||
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>
|
||||
<StackPanel IsItemsHost="True" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.Style>
|
||||
<Style TargetType="{x:Type ListBox}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type 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>
|
||||
|
||||
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
|
||||
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition Width="80" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<CheckBox
|
||||
Grid.Column="0"
|
||||
Margin="10,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding SelectAllCommand}"
|
||||
CommandParameter="{Binding ElementName=nameMedias, Path=SelectedItem}"
|
||||
Content="{DynamicResource SelectAll}"
|
||||
Foreground="{DynamicResource BrushTextDark}"
|
||||
IsChecked="{Binding IsSelectAll, Mode=TwoWay}"
|
||||
Style="{StaticResource CheckBoxStyle}" />
|
||||
|
||||
<Button
|
||||
Grid.Column="2"
|
||||
Margin="0,0,10,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding AddToDownloadCommand}"
|
||||
Content="{DynamicResource DownloadSelectedPublication}"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource BrushText}"
|
||||
Style="{StaticResource BtnStyle}" />
|
||||
|
||||
<Button
|
||||
Grid.Column="3"
|
||||
Margin="0,0,10,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding AddAllToDownloadCommand}"
|
||||
Content="{DynamicResource DownloadAllPublication}"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource BrushText}"
|
||||
Style="{StaticResource BtnStyle}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- 加载gif -->
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
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="2"
|
||||
Width="256"
|
||||
Height="256"
|
||||
Source="/DownKyi;component/Resources/no-data.png"
|
||||
Visibility="{Binding NoDataVisibility}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace DownKyi.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// ViewMyHistory.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ViewMyHistory : UserControl
|
||||
{
|
||||
public ViewMyHistory()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,286 @@
|
||||
<UserControl
|
||||
x:Class="DownKyi.Views.ViewMyToViewVideo"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:custom="clr-namespace:DownKyi.CustomControl"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True">
|
||||
<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}">
|
||||
<Grid
|
||||
Name="nameMediaPanel"
|
||||
Height="100"
|
||||
Margin="20,15,10,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="160" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border
|
||||
Name="nameCover"
|
||||
Grid.Column="0"
|
||||
Width="160"
|
||||
Height="100"
|
||||
HorizontalAlignment="Center"
|
||||
CornerRadius="5">
|
||||
<Border.Background>
|
||||
<!-- 长宽比:1.6 -->
|
||||
<ImageBrush ImageSource="{Binding Cover}" />
|
||||
</Border.Background>
|
||||
</Border>
|
||||
|
||||
<Image
|
||||
Name="nameChecked"
|
||||
Grid.Column="0"
|
||||
Width="24"
|
||||
Height="24"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Source="/DownKyi;component/Resources/checked.png" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="20,0"
|
||||
Orientation="Vertical">
|
||||
<TextBlock
|
||||
Name="nameTitle"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Cursor="Hand"
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
Text="{Binding Title}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
ToolTip="{Binding Title}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseLeftButtonUp">
|
||||
<i:InvokeCommandAction Command="{Binding TitleCommand}" CommandParameter="{Binding DataContext.PageName, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBlock>
|
||||
|
||||
<StackPanel
|
||||
Name="nameUp"
|
||||
Margin="0,40,0,0"
|
||||
Cursor="Hand"
|
||||
Orientation="Horizontal">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseLeftButtonUp">
|
||||
<i:InvokeCommandAction Command="{Binding UpCommand}" CommandParameter="{Binding DataContext.PageName, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<Border
|
||||
Width="24"
|
||||
Height="24"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="12">
|
||||
<Border.Background>
|
||||
<ImageBrush ImageSource="{Binding UpHeader}" />
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<TextBlock
|
||||
Name="nameUpName"
|
||||
Margin="10,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource BrushTextGrey}"
|
||||
Text="{Binding UpName}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Height="1"
|
||||
Margin="20,0,20,0"
|
||||
VerticalAlignment="Bottom"
|
||||
Background="{DynamicResource BrushBorderTranslucent}" />
|
||||
</Grid>
|
||||
<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>
|
||||
<Trigger SourceName="nameUp" Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="nameUpName" Property="Foreground" Value="{DynamicResource BrushPrimary}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<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 MyToView}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
|
||||
|
||||
<Grid Grid.Row="2" Visibility="{Binding ContentVisibility}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="1" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ListBox
|
||||
x:Name="nameMedias"
|
||||
Grid.Row="0"
|
||||
BorderThickness="0"
|
||||
ItemContainerStyle="{StaticResource MediaListStyle}"
|
||||
ItemsSource="{Binding Medias}"
|
||||
ScrollViewer.CanContentScroll="False"
|
||||
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>
|
||||
<StackPanel IsItemsHost="True" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.Style>
|
||||
<Style TargetType="{x:Type ListBox}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type 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>
|
||||
|
||||
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
|
||||
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition Width="80" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<CheckBox
|
||||
Grid.Column="0"
|
||||
Margin="10,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding SelectAllCommand}"
|
||||
CommandParameter="{Binding ElementName=nameMedias, Path=SelectedItem}"
|
||||
Content="{DynamicResource SelectAll}"
|
||||
Foreground="{DynamicResource BrushTextDark}"
|
||||
IsChecked="{Binding IsSelectAll, Mode=TwoWay}"
|
||||
Style="{StaticResource CheckBoxStyle}" />
|
||||
|
||||
<Button
|
||||
Grid.Column="2"
|
||||
Margin="0,0,10,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding AddToDownloadCommand}"
|
||||
Content="{DynamicResource DownloadSelectedPublication}"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource BrushText}"
|
||||
Style="{StaticResource BtnStyle}" />
|
||||
|
||||
<Button
|
||||
Grid.Column="3"
|
||||
Margin="0,0,10,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding AddAllToDownloadCommand}"
|
||||
Content="{DynamicResource DownloadAllPublication}"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource BrushText}"
|
||||
Style="{StaticResource BtnStyle}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- 加载gif -->
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
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="2"
|
||||
Width="256"
|
||||
Height="256"
|
||||
Source="/DownKyi;component/Resources/no-data.png"
|
||||
Visibility="{Binding NoDataVisibility}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace DownKyi.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// ViewMyToView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ViewMyToViewVideo : UserControl
|
||||
{
|
||||
public ViewMyToViewVideo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="1" />
|
||||
<RowDefinition Height="49" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ListBox
|
||||
|
||||
Reference in New Issue
Block a user