Files
downkyicore/DownKyi/ViewModels/PageViewModels/ChannelMedia.cs
2023-11-25 21:59:48 +08:00

100 lines
2.1 KiB
C#

using Avalonia.Media.Imaging;
using DownKyi.Core.BiliApi.BiliUtils;
using DownKyi.Utils;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
namespace DownKyi.ViewModels.PageViewModels;
public class ChannelMedia : BindableBase
{
protected readonly IEventAggregator eventAggregator;
public ChannelMedia(IEventAggregator eventAggregator)
{
this.eventAggregator = eventAggregator;
}
public long Avid { get; set; }
public string Bvid { get; set; }
#region
private bool isSelected;
public bool IsSelected
{
get => isSelected;
set => SetProperty(ref isSelected, value);
}
private Bitmap cover;
public Bitmap Cover
{
get => cover;
set => SetProperty(ref cover, value);
}
private string title;
public string Title
{
get => title;
set => SetProperty(ref title, value);
}
private string duration;
public string Duration
{
get => duration;
set => SetProperty(ref duration, value);
}
private string playNumber;
public string PlayNumber
{
get => playNumber;
set => SetProperty(ref playNumber, value);
}
private string createTime;
public string CreateTime
{
get => createTime;
set => SetProperty(ref createTime, value);
}
#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}");
//string url = "https://www.bilibili.com/video/" + tag;
//System.Diagnostics.Process.Start(url);
}
#endregion
}