完成关注和粉丝页面

pull/612/head
leiurayer 2 years ago
parent 15c31ee6b8
commit eb274f82b9

@ -4,12 +4,14 @@ using DownKyi.Utils;
using DownKyi.ViewModels;
using DownKyi.ViewModels.Dialogs;
using DownKyi.ViewModels.DownloadManager;
using DownKyi.ViewModels.Friends;
using DownKyi.ViewModels.Settings;
using DownKyi.ViewModels.Toolbox;
using DownKyi.ViewModels.UserSpace;
using DownKyi.Views;
using DownKyi.Views.Dialogs;
using DownKyi.Views.DownloadManager;
using DownKyi.Views.Friends;
using DownKyi.Views.Settings;
using DownKyi.Views.Toolbox;
using DownKyi.Views.UserSpace;
@ -184,6 +186,7 @@ namespace DownKyi
containerRegistry.RegisterForNavigation<ViewPublication>(ViewPublicationViewModel.Tag);
containerRegistry.RegisterForNavigation<Views.ViewChannel>(ViewModels.ViewChannelViewModel.Tag);
containerRegistry.RegisterForNavigation<Views.ViewSeasonsSeries>(ViewModels.ViewSeasonsSeriesViewModel.Tag);
containerRegistry.RegisterForNavigation<ViewFriends>(ViewFriendsViewModel.Tag);
containerRegistry.RegisterForNavigation<ViewMySpace>(ViewMySpaceViewModel.Tag);
containerRegistry.RegisterForNavigation<ViewMyFavorites>(ViewMyFavoritesViewModel.Tag);
@ -195,6 +198,10 @@ namespace DownKyi
containerRegistry.RegisterForNavigation<ViewDownloading>(ViewDownloadingViewModel.Tag);
containerRegistry.RegisterForNavigation<ViewDownloadFinished>(ViewDownloadFinishedViewModel.Tag);
// Friend
containerRegistry.RegisterForNavigation<ViewFollowing>(ViewFollowingViewModel.Tag);
containerRegistry.RegisterForNavigation<ViewFollower>(ViewFollowerViewModel.Tag);
// settings pages
containerRegistry.RegisterForNavigation<ViewBasic>(ViewBasicViewModel.Tag);
containerRegistry.RegisterForNavigation<ViewNetwork>(ViewNetworkViewModel.Tag);

@ -121,12 +121,15 @@
<Compile Include="Services\Download\BuiltinDownloadService.cs" />
<Compile Include="Services\Download\DownloadStorageService.cs" />
<Compile Include="Services\SearchService.cs" />
<Compile Include="ViewModels\Friends\ViewFollowerViewModel.cs" />
<Compile Include="ViewModels\Friends\ViewFollowingViewModel.cs" />
<Compile Include="Utils\WindowAdaptation.cs" />
<Compile Include="ViewModels\Dialogs\ViewAlertDialogViewModel.cs" />
<Compile Include="ViewModels\PageViewModels\BangumiFollowMedia.cs" />
<Compile Include="ViewModels\PageViewModels\Favorites.cs" />
<Compile Include="ViewModels\PageViewModels\FavoritesMedia.cs" />
<Compile Include="ViewModels\PageViewModels\ChannelMedia.cs" />
<Compile Include="ViewModels\PageViewModels\FriendInfo.cs" />
<Compile Include="ViewModels\PageViewModels\HistoryMedia.cs" />
<Compile Include="ViewModels\PageViewModels\PublicationMedia.cs" />
<Compile Include="ViewModels\PageViewModels\SpaceItem.cs" />
@ -177,6 +180,7 @@
<Compile Include="ViewModels\ViewChannelViewModel.cs" />
<Compile Include="ViewModels\ViewDownloadManagerViewModel.cs" />
<Compile Include="ViewModels\Toolbox\ViewExtractMediaViewModel.cs" />
<Compile Include="ViewModels\ViewFriendsViewModel.cs" />
<Compile Include="ViewModels\ViewIndexViewModel.cs" />
<Compile Include="ViewModels\ViewLoginViewModel.cs" />
<Compile Include="ViewModels\Settings\ViewNetworkViewModel.cs" />
@ -208,6 +212,12 @@
<Compile Include="Views\DownloadManager\ViewDownloading.xaml.cs">
<DependentUpon>ViewDownloading.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Friends\ViewFollower.xaml.cs">
<DependentUpon>ViewFollower.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Friends\ViewFollowing.xaml.cs">
<DependentUpon>ViewFollowing.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Settings\ViewAbout.xaml.cs">
<DependentUpon>ViewAbout.xaml</DependentUpon>
</Compile>
@ -253,6 +263,9 @@
<Compile Include="Views\ViewDownloadManager.xaml.cs">
<DependentUpon>ViewDownloadManager.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ViewFriends.xaml.cs">
<DependentUpon>ViewFriends.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ViewIndex.xaml.cs">
<DependentUpon>ViewIndex.xaml</DependentUpon>
</Compile>
@ -380,6 +393,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Friends\ViewFollower.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Friends\ViewFollowing.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -456,6 +477,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ViewFriends.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ViewIndex.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

@ -97,6 +97,17 @@
<system:String x:Key="DownloadAllPublication">下载全部</system:String>
<system:String x:Key="PublicationWait">请稍等,马上就好~</system:String>
<!-- Friend -->
<system:String x:Key="Friend">好友</system:String>
<system:String x:Key="FriendFollowing">关注</system:String>
<system:String x:Key="FriendFollower">粉丝</system:String>
<system:String x:Key="FollowingWait">请稍等,马上就好~</system:String>
<system:String x:Key="FollowerWait">请稍等,马上就好~</system:String>
<system:String x:Key="AllFollowing">全部关注</system:String>
<system:String x:Key="WhisperFollowing">悄悄关注</system:String>
<!-- VideoDetail -->
<system:String x:Key="CopyCover">复制封面图片</system:String>
<system:String x:Key="CopyCoverUrl">复制封面URL</system:String>

@ -0,0 +1,239 @@
using DownKyi.Core.BiliApi.Users;
using DownKyi.Core.BiliApi.Users.Models;
using DownKyi.Core.Settings.Models;
using DownKyi.Core.Settings;
using DownKyi.Core.Storage;
using DownKyi.CustomControl;
using DownKyi.ViewModels.PageViewModels;
using Prism.Events;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Imaging;
namespace DownKyi.ViewModels.Friends
{
public class ViewFollowerViewModel : BaseViewModel
{
public const string Tag = "PageFriendsFollower";
// mid
private long mid = -1;
// 每页数量,暂时在此写死,以后在设置中增加选项
private readonly int NumberInPage = 20;
public bool IsEnabled = true;
#region 页面属性申明
private string pageName = ViewFriendsViewModel.Tag;
public string PageName
{
get => pageName;
set => SetProperty(ref pageName, value);
}
private Visibility contentVisibility;
public Visibility ContentVisibility
{
get => contentVisibility;
set => SetProperty(ref contentVisibility, 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);
}
private CustomPagerViewModel pager;
public CustomPagerViewModel Pager
{
get => pager;
set => SetProperty(ref pager, value);
}
private ObservableCollection<FriendInfo> contents;
public ObservableCollection<FriendInfo> Contents
{
get => contents;
set => SetProperty(ref contents, value);
}
#endregion
public ViewFollowerViewModel(IEventAggregator eventAggregator) : base(eventAggregator)
{
#region 属性初始化
// 初始化loading gif
Loading = new GifImage(Properties.Resources.loading);
Loading.StartAnimate();
LoadingVisibility = Visibility.Collapsed;
NoDataVisibility = Visibility.Collapsed;
Contents = new ObservableCollection<FriendInfo>();
#endregion
}
#region 命令申明
#endregion
private void LoadContent(List<RelationFollowInfo> contents)
{
ContentVisibility = Visibility.Visible;
LoadingVisibility = Visibility.Collapsed;
NoDataVisibility = Visibility.Collapsed;
foreach (var item in contents)
{
StorageHeader storageHeader = new StorageHeader();
BitmapImage header = storageHeader.GetHeaderThumbnail(item.Mid, item.Name, item.Face, 64, 64);
App.PropertyChangeAsync(new Action(() =>
{
Contents.Add(new FriendInfo(eventAggregator) { Mid = item.Mid, Header = header, Name = item.Name, Sign = item.Sign });
}));
}
}
private async void UpdateContent(int current)
{
// 是否正在获取数据
// 在所有的退出分支中都需要设为true
IsEnabled = false;
Contents.Clear();
ContentVisibility = Visibility.Collapsed;
LoadingVisibility = Visibility.Visible;
NoDataVisibility = Visibility.Collapsed;
RelationFollow data = null;
List<RelationFollowInfo> contents = null;
await Task.Run(() =>
{
data = UserRelation.GetFollowers(mid, current, NumberInPage);
if (data != null && data.List != null && data.List.Count > 0)
{
contents = data.List;
}
if (contents == null) { return; }
LoadContent(contents);
});
if (data == null || contents == null)
{
ContentVisibility = Visibility.Collapsed;
LoadingVisibility = Visibility.Collapsed;
NoDataVisibility = Visibility.Visible;
}
else
{
UserInfoSettings userInfo = SettingsManager.GetInstance().GetUserInfo();
if (userInfo != null && userInfo.Mid == mid)
{
Pager.Count = (int)Math.Ceiling((double)data.Total / NumberInPage);
}
else
{
int page = (int)Math.Ceiling((double)data.Total / NumberInPage);
if (page > 5)
{
Pager.Count = 5;
}
else
{
Pager.Count = page;
}
}
ContentVisibility = Visibility.Visible;
LoadingVisibility = Visibility.Collapsed;
NoDataVisibility = Visibility.Collapsed;
}
IsEnabled = true;
}
private void OnCountChanged_Pager(int count) { }
private bool OnCurrentChanged_Pager(int old, int current)
{
if (!IsEnabled)
{
//Pager.Current = old;
return false;
}
UpdateContent(current);
return true;
}
/// <summary>
/// 初始化页面数据
/// </summary>
private void InitView()
{
ContentVisibility = Visibility.Collapsed;
LoadingVisibility = Visibility.Visible;
NoDataVisibility = Visibility.Collapsed;
Contents.Clear();
}
/// <summary>
/// 导航到页面时执行
/// </summary>
/// <param name="navigationContext"></param>
public override void OnNavigatedTo(NavigationContext navigationContext)
{
base.OnNavigatedTo(navigationContext);
// 传入mid
long parameter = navigationContext.Parameters.GetValue<long>("mid");
if (parameter == 0)
{
return;
}
mid = parameter;
// 是否是从PageFriends的headerTable的item点击进入的
// true表示加载PageFriends后第一次进入此页面
// false表示从headerTable的item点击进入的
bool isFirst = navigationContext.Parameters.GetValue<bool>("isFirst");
if (isFirst)
{
InitView();
//UpdateContent(1);
// 页面选择
Pager = new CustomPagerViewModel(1, (int)Math.Ceiling((double)1 / NumberInPage));
Pager.CurrentChanged += OnCurrentChanged_Pager;
Pager.CountChanged += OnCountChanged_Pager;
Pager.Current = 1;
}
}
}
}

@ -0,0 +1,415 @@
using DownKyi.Core.BiliApi.Users;
using DownKyi.Core.BiliApi.Users.Models;
using DownKyi.Core.Settings;
using DownKyi.Core.Settings.Models;
using DownKyi.Core.Storage;
using DownKyi.CustomControl;
using DownKyi.Utils;
using DownKyi.ViewModels.PageViewModels;
using Prism.Commands;
using Prism.Events;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Imaging;
namespace DownKyi.ViewModels.Friends
{
public class ViewFollowingViewModel : BaseViewModel
{
public const string Tag = "PageFriendsFollowing";
// mid
private long mid = -1;
// 每页数量,暂时在此写死,以后在设置中增加选项
private readonly int NumberInPage = 20;
#region 页面属性申明
private string pageName = ViewFriendsViewModel.Tag;
public string PageName
{
get => pageName;
set => SetProperty(ref pageName, value);
}
private Visibility contentVisibility;
public Visibility ContentVisibility
{
get => contentVisibility;
set => SetProperty(ref contentVisibility, value);
}
private Visibility innerContentVisibility;
public Visibility InnerContentVisibility
{
get => innerContentVisibility;
set => SetProperty(ref innerContentVisibility, 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);
}
private GifImage contentLoading;
public GifImage ContentLoading
{
get => contentLoading;
set => SetProperty(ref contentLoading, value);
}
private Visibility contentLoadingVisibility;
public Visibility ContentLoadingVisibility
{
get => contentLoadingVisibility;
set => SetProperty(ref contentLoadingVisibility, value);
}
private Visibility contentNoDataVisibility;
public Visibility ContentNoDataVisibility
{
get => contentNoDataVisibility;
set => SetProperty(ref contentNoDataVisibility, value);
}
private ObservableCollection<TabHeader> tabHeaders;
public ObservableCollection<TabHeader> TabHeaders
{
get => tabHeaders;
set => SetProperty(ref tabHeaders, value);
}
private int selectTabId;
public int SelectTabId
{
get => selectTabId;
set => SetProperty(ref selectTabId, value);
}
private bool isEnabled = true;
public bool IsEnabled
{
get => isEnabled;
set => SetProperty(ref isEnabled, value);
}
private CustomPagerViewModel pager;
public CustomPagerViewModel Pager
{
get => pager;
set => SetProperty(ref pager, value);
}
private ObservableCollection<FriendInfo> contents;
public ObservableCollection<FriendInfo> Contents
{
get => contents;
set => SetProperty(ref contents, value);
}
#endregion
public ViewFollowingViewModel(IEventAggregator eventAggregator) : base(eventAggregator)
{
#region 属性初始化
// 初始化loading gif
Loading = new GifImage(Properties.Resources.loading);
Loading.StartAnimate();
LoadingVisibility = Visibility.Collapsed;
NoDataVisibility = Visibility.Collapsed;
ContentLoading = new GifImage(Properties.Resources.loading);
ContentLoading.StartAnimate();
ContentLoadingVisibility = Visibility.Collapsed;
ContentNoDataVisibility = Visibility.Collapsed;
TabHeaders = new ObservableCollection<TabHeader>();
Contents = new ObservableCollection<FriendInfo>();
#endregion
}
#region 命令申明
// 左侧tab点击事件
private DelegateCommand<object> leftTabHeadersCommand;
public DelegateCommand<object> LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand<object>(ExecuteLeftTabHeadersCommand, CanExecuteLeftTabHeadersCommand));
/// <summary>
/// 左侧tab点击事件
/// </summary>
/// <param name="parameter"></param>
private void ExecuteLeftTabHeadersCommand(object parameter)
{
if (!(parameter is TabHeader tabHeader)) { return; }
// 页面选择
Pager = new CustomPagerViewModel(1, (int)Math.Ceiling(double.Parse(tabHeader.SubTitle) / NumberInPage));
Pager.CurrentChanged += OnCurrentChanged_Pager;
Pager.CountChanged += OnCountChanged_Pager;
Pager.Current = 1;
}
/// <summary>
/// 左侧tab点击事件是否允许执行
/// </summary>
/// <param name="parameter"></param>
/// <returns></returns>
private bool CanExecuteLeftTabHeadersCommand(object parameter)
{
return IsEnabled;
}
#endregion
/// <summary>
/// 初始化页面数据
/// </summary>
private void InitView()
{
ContentVisibility = Visibility.Collapsed;
InnerContentVisibility = Visibility.Collapsed;
LoadingVisibility = Visibility.Visible;
NoDataVisibility = Visibility.Collapsed;
ContentLoadingVisibility = Visibility.Collapsed;
ContentNoDataVisibility = Visibility.Collapsed;
TabHeaders.Clear();
Contents.Clear();
SelectTabId = -1;
}
/// <summary>
/// 初始化左侧列表
/// </summary>
private async void InitLeftTable()
{
TabHeaders.Clear();
UserInfoSettings userInfo = SettingsManager.GetInstance().GetUserInfo();
if (userInfo != null && userInfo.Mid == mid)
{
// 用户的关系状态数
UserRelationStat relationStat = null;
await Task.Run(() =>
{
relationStat = UserStatus.GetUserRelationStat(mid);
});
if (relationStat != null)
{
TabHeaders.Add(new TabHeader { Id = -1, Title = DictionaryResource.GetString("AllFollowing"), SubTitle = relationStat.Following.ToString() });
TabHeaders.Add(new TabHeader { Id = -2, Title = DictionaryResource.GetString("WhisperFollowing"), SubTitle = relationStat.Whisper.ToString() });
}
// 用户的关注分组
List<FollowingGroup> followingGroup = null;
await Task.Run(() =>
{
followingGroup = UserRelation.GetFollowingGroup();
});
if (followingGroup != null)
{
foreach (FollowingGroup tag in followingGroup)
{
TabHeaders.Add(new TabHeader { Id = tag.TagId, Title = tag.Name, SubTitle = tag.Count.ToString() });
}
}
}
else
{
// 用户的关系状态数
UserRelationStat relationStat = null;
await Task.Run(() =>
{
relationStat = UserStatus.GetUserRelationStat(mid);
});
if (relationStat != null)
{
TabHeaders.Add(new TabHeader { Id = -1, Title = DictionaryResource.GetString("AllFollowing"), SubTitle = relationStat.Following.ToString() });
}
}
ContentVisibility = Visibility.Visible;
LoadingVisibility = Visibility.Collapsed;
}
private void LoadContent(List<RelationFollowInfo> contents)
{
InnerContentVisibility = Visibility.Visible;
ContentLoadingVisibility = Visibility.Collapsed;
ContentNoDataVisibility = Visibility.Collapsed;
foreach (var item in contents)
{
StorageHeader storageHeader = new StorageHeader();
BitmapImage header = storageHeader.GetHeaderThumbnail(item.Mid, item.Name, item.Face, 64, 64);
App.PropertyChangeAsync(new Action(() =>
{
Contents.Add(new FriendInfo(eventAggregator) { Mid = item.Mid, Header = header, Name = item.Name, Sign = item.Sign });
}));
}
}
private async Task<bool> LoadAllFollowings(int pn, int ps)
{
List<RelationFollowInfo> contents = null;
await Task.Run(() =>
{
RelationFollow data = UserRelation.GetFollowings(mid, pn, ps);
if (data != null && data.List != null && data.List.Count > 0)
{
contents = data.List;
}
if (contents == null) { return; }
LoadContent(contents);
});
if (contents == null) { return false; }
return true;
}
private async Task<bool> LoadWhispers(int pn, int ps)
{
List<RelationFollowInfo> contents = null;
await Task.Run(() =>
{
contents = UserRelation.GetWhispers(pn, ps);
if (contents == null) { return; }
LoadContent(contents);
});
if (contents == null) { return false; }
return true;
}
private async Task<bool> LoadFollowingGroupContent(int tagId, int pn, int ps)
{
List<RelationFollowInfo> contents = null;
await Task.Run(() =>
{
contents = UserRelation.GetFollowingGroupContent(tagId, pn, ps);
if (contents == null) { return; }
LoadContent(contents);
});
if (contents == null) { return false; }
return true;
}
private async void UpdateContent(int current)
{
// 是否正在获取数据
// 在所有的退出分支中都需要设为true
IsEnabled = false;
Contents.Clear();
InnerContentVisibility = Visibility.Collapsed;
ContentLoadingVisibility = Visibility.Visible;
ContentNoDataVisibility = Visibility.Collapsed;
TabHeader tab = TabHeaders[SelectTabId];
bool isSucceed;
switch (tab.Id)
{
case -1:
isSucceed = await LoadAllFollowings(current, NumberInPage);
break;
case -2:
isSucceed = await LoadWhispers(current, NumberInPage);
break;
default:
isSucceed = await LoadFollowingGroupContent(tab.Id, current, NumberInPage);
break;
}
if (isSucceed)
{
InnerContentVisibility = Visibility.Visible;
ContentLoadingVisibility = Visibility.Collapsed;
ContentNoDataVisibility = Visibility.Collapsed;
}
else
{
InnerContentVisibility = Visibility.Collapsed;
ContentLoadingVisibility = Visibility.Collapsed;
ContentNoDataVisibility = Visibility.Visible;
}
IsEnabled = true;
}
private void OnCountChanged_Pager(int count) { }
private bool OnCurrentChanged_Pager(int old, int current)
{
if (!IsEnabled)
{
//Pager.Current = old;
return false;
}
UpdateContent(current);
return true;
}
/// <summary>
/// 导航到页面时执行
/// </summary>
/// <param name="navigationContext"></param>
public override void OnNavigatedTo(NavigationContext navigationContext)
{
base.OnNavigatedTo(navigationContext);
// 传入mid
long parameter = navigationContext.Parameters.GetValue<long>("mid");
if (parameter == 0)
{
return;
}
mid = parameter;
// 是否是从PageFriends的headerTable的item点击进入的
// true表示加载PageFriends后第一次进入此页面
// false表示从headerTable的item点击进入的
bool isFirst = navigationContext.Parameters.GetValue<bool>("isFirst");
if (isFirst)
{
InitView();
// 初始化左侧列表
InitLeftTable();
// 进入页面时显示的设置项
SelectTabId = 0;
}
}
}
}

@ -0,0 +1,65 @@
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 FriendInfo : BindableBase
{
protected readonly IEventAggregator eventAggregator;
public FriendInfo(IEventAggregator eventAggregator)
{
this.eventAggregator = eventAggregator;
}
public long Mid { get; set; }
#region 页面属性申明
private BitmapImage header;
public BitmapImage Header
{
get => header;
set => SetProperty(ref header, value);
}
private string name;
public string Name
{
get => name;
set => SetProperty(ref name, value);
}
private string sign;
public string Sign
{
get => sign;
set => SetProperty(ref sign, value);
}
#endregion
#region 命令申明
// 视频标题点击事件
private DelegateCommand<object> userCommand;
public DelegateCommand<object> UserCommand => userCommand ?? (userCommand = new DelegateCommand<object>(ExecuteUserCommand));
/// <summary>
/// 视频标题点击事件
/// </summary>
/// <param name="parameter"></param>
private void ExecuteUserCommand(object parameter)
{
if (!(parameter is string tag)) { return; }
NavigateToView.NavigationView(eventAggregator, ViewUserSpaceViewModel.Tag, tag, Mid);
}
#endregion
}
}

@ -5,6 +5,13 @@ namespace DownKyi.ViewModels.PageViewModels
{
public class SpaceItem : BindableBase
{
private bool isEnabled;
public bool IsEnabled
{
get => isEnabled;
set => SetProperty(ref isEnabled, value);
}
private VectorImage image;
public VectorImage Image
{

@ -4,6 +4,8 @@ namespace DownKyi.ViewModels.UserSpace
{
public class TabRightBanner : BindableBase
{
public int Id { get; set; }
private bool isEnabled;
public bool IsEnabled
{

@ -1,6 +1,5 @@
using DownKyi.Core.BiliApi.Users.Models;
using DownKyi.Core.BiliApi.Zone;
using DownKyi.Events;
using DownKyi.Utils;
using Prism.Commands;
using Prism.Events;
@ -15,7 +14,7 @@ namespace DownKyi.ViewModels.UserSpace
{
public class ViewArchiveViewModel : BaseViewModel
{
public const string Tag = "PageUserSpaceArchiveView";
public const string Tag = "PageUserSpaceArchive";
private long mid = -1;
@ -68,13 +67,7 @@ namespace DownKyi.ViewModels.UserSpace
};
// 进入视频页面
NavigationParam param = new NavigationParam
{
ViewName = ViewPublicationViewModel.Tag,
ParentViewName = ViewUserSpaceViewModel.Tag,
Parameter = data
};
eventAggregator.GetEvent<NavigationEvent>().Publish(param);
NavigateToView.NavigationView(eventAggregator, ViewPublicationViewModel.Tag, ViewUserSpaceViewModel.Tag, data);
SelectedItem = -1;
}

@ -1,6 +1,6 @@
using DownKyi.Core.BiliApi.Users.Models;
using DownKyi.Core.Storage;
using DownKyi.Events;
using DownKyi.Utils;
using Prism.Commands;
using Prism.Events;
using Prism.Regions;
@ -68,13 +68,7 @@ namespace DownKyi.ViewModels.UserSpace
};
// 进入视频页面
NavigationParam param = new NavigationParam
{
ViewName = ViewModels.ViewChannelViewModel.Tag,
ParentViewName = ViewUserSpaceViewModel.Tag,
Parameter = data
};
eventAggregator.GetEvent<NavigationEvent>().Publish(param);
NavigateToView.NavigationView(eventAggregator, ViewModels.ViewChannelViewModel.Tag, ViewUserSpaceViewModel.Tag, data);
SelectedItem = -1;
}

@ -0,0 +1,159 @@
using DownKyi.Events;
using DownKyi.Images;
using DownKyi.Utils;
using DownKyi.ViewModels.Friends;
using DownKyi.ViewModels.PageViewModels;
using Prism.Commands;
using Prism.Events;
using Prism.Regions;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace DownKyi.ViewModels
{
public class ViewFriendsViewModel : BaseViewModel
{
public const string Tag = "PageFriends";
private readonly IRegionManager regionManager;
private long mid = -1;
#region 页面属性申明
private VectorImage arrowBack;
public VectorImage ArrowBack
{
get => arrowBack;
set => SetProperty(ref arrowBack, value);
}
private ObservableCollection<TabHeader> tabHeaders;
public ObservableCollection<TabHeader> TabHeaders
{
get => tabHeaders;
set => SetProperty(ref tabHeaders, value);
}
private int selectTabId;
public int SelectTabId
{
get => selectTabId;
set => SetProperty(ref selectTabId, value);
}
#endregion
public ViewFriendsViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) : base(eventAggregator)
{
this.regionManager = regionManager;
#region 属性初始化
ArrowBack = NavigationIcon.Instance().ArrowBack;
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
TabHeaders = new ObservableCollection<TabHeader>
{
new TabHeader { Id = 0, Title = DictionaryResource.GetString("FriendFollowing") },
new TabHeader { Id = 1, Title = DictionaryResource.GetString("FriendFollower") },
};
#endregion
}
#region 命令申明
// 返回事件
private DelegateCommand backSpaceCommand;
public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace));
/// <summary>
/// 返回事件
/// </summary>
private void ExecuteBackSpace()
{
//InitView();
ArrowBack.Fill = DictionaryResource.GetColor("ColorText");
NavigationParam parameter = new NavigationParam
{
ViewName = ParentView,
ParentViewName = null,
Parameter = null
};
eventAggregator.GetEvent<NavigationEvent>().Publish(parameter);
}
// 顶部tab点击事件
private DelegateCommand<object> tabHeadersCommand;
public DelegateCommand<object> TabHeadersCommand => tabHeadersCommand ?? (tabHeadersCommand = new DelegateCommand<object>(ExecuteTabHeadersCommand));
/// <summary>
/// 顶部tab点击事件
/// </summary>
/// <param name="parameter"></param>
private void ExecuteTabHeadersCommand(object parameter)
{
if (!(parameter is TabHeader tabHeader)) { return; }
// TODO
// 此处应该根据具体状态传入true or false
NavigationView(tabHeader.Id, true);
}
#endregion
/// <summary>
/// 进入子页面
/// </summary>
/// <param name="id"></param>
/// <param name="isFirst"></param>
private void NavigationView(int id, bool isFirst)
{
// isFirst参数表示是否是从PageFriends的headerTable的item点击进入的
// true表示加载PageFriends后第一次进入
// false表示从headerTable的item点击进入
NavigationParameters param = new NavigationParameters()
{
{ "mid", mid },
{ "isFirst", isFirst },
};
switch (id)
{
case 0:
regionManager.RequestNavigate("FriendContentRegion", ViewFollowingViewModel.Tag, param);
break;
case 1:
regionManager.RequestNavigate("FriendContentRegion", ViewFollowerViewModel.Tag, param);
break;
}
}
/// <summary>
/// 导航到页面时执行
/// </summary>
/// <param name="navigationContext"></param>
public override void OnNavigatedTo(NavigationContext navigationContext)
{
base.OnNavigatedTo(navigationContext);
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
// 根据传入参数不同执行不同任务
var parameter = navigationContext.Parameters.GetValue<Dictionary<string, object>>("Parameter");
if (parameter == null)
{
return;
}
mid = (long)parameter["mid"];
SelectTabId = (int)parameter["friendId"];
NavigationView(SelectTabId, true);
}
}
}

@ -11,6 +11,7 @@ using Prism.Commands;
using Prism.Events;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
@ -240,6 +241,13 @@ namespace DownKyi.ViewModels
set => SetProperty(ref packageList, value);
}
private int selectedStatus;
public int SelectedStatus
{
get => selectedStatus;
set => SetProperty(ref selectedStatus, value);
}
private int selectedPackage;
public int SelectedPackage
{
@ -328,6 +336,47 @@ namespace DownKyi.ViewModels
eventAggregator.GetEvent<NavigationEvent>().Publish(parameter);
}
// 页面选择事件
private DelegateCommand statusListCommand;
public DelegateCommand StatusListCommand => statusListCommand ?? (statusListCommand = new DelegateCommand(ExecuteStatusListCommand));
/// <summary>
/// 页面选择事件
/// </summary>
private void ExecuteStatusListCommand()
{
if (SelectedStatus == -1)
{
return;
}
Dictionary<string, object> data = new Dictionary<string, object>
{
{ "mid", mid },
{ "friendId", 0 }
};
switch (SelectedStatus)
{
case 0:
data["friendId"] = 0;
NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, Tag, data);
break;
case 1:
data["friendId"] = 0;
NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, Tag, data);
break;
case 2:
data["friendId"] = 1;
NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, Tag, data);
break;
default:
break;
}
SelectedStatus = -1;
}
// 页面选择事件
private DelegateCommand packageListCommand;
public DelegateCommand PackageListCommand => packageListCommand ?? (packageListCommand = new DelegateCommand(ExecutePackageListCommand));
@ -391,23 +440,24 @@ namespace DownKyi.ViewModels
CurrentExp = "--/--";
StatusList.Clear();
StatusList.Add(new SpaceItem { Title = DictionaryResource.GetString("Following"), Subtitle = "--" });
StatusList.Add(new SpaceItem { Title = DictionaryResource.GetString("Whisper"), Subtitle = "--" });
StatusList.Add(new SpaceItem { Title = DictionaryResource.GetString("Follower"), Subtitle = "--" });
StatusList.Add(new SpaceItem { Title = DictionaryResource.GetString("Black"), Subtitle = "--" });
StatusList.Add(new SpaceItem { Title = DictionaryResource.GetString("Moral"), Subtitle = "--" });
StatusList.Add(new SpaceItem { Title = DictionaryResource.GetString("Silence"), Subtitle = "N/A" });
StatusList.Add(new SpaceItem { IsEnabled = true, Title = DictionaryResource.GetString("Following"), Subtitle = "--" });
StatusList.Add(new SpaceItem { IsEnabled = true, Title = DictionaryResource.GetString("Whisper"), Subtitle = "--" });
StatusList.Add(new SpaceItem { IsEnabled = true, Title = DictionaryResource.GetString("Follower"), Subtitle = "--" });
StatusList.Add(new SpaceItem { IsEnabled = false, Title = DictionaryResource.GetString("Black"), Subtitle = "--" });
StatusList.Add(new SpaceItem { IsEnabled = false, Title = DictionaryResource.GetString("Moral"), Subtitle = "--" });
StatusList.Add(new SpaceItem { IsEnabled = false, Title = DictionaryResource.GetString("Silence"), Subtitle = "N/A" });
PackageList.Clear();
PackageList.Add(new SpaceItem { Image = NormalIcon.Instance().FavoriteOutline, Title = DictionaryResource.GetString("Favorites") });
PackageList.Add(new SpaceItem { Image = NormalIcon.Instance().Subscription, Title = DictionaryResource.GetString("Subscription") });
PackageList.Add(new SpaceItem { Image = NormalIcon.Instance().ToView, Title = DictionaryResource.GetString("ToView") });
PackageList.Add(new SpaceItem { Image = NormalIcon.Instance().History, Title = DictionaryResource.GetString("History") });
PackageList.Add(new SpaceItem { IsEnabled = true, Image = NormalIcon.Instance().FavoriteOutline, Title = DictionaryResource.GetString("Favorites") });
PackageList.Add(new SpaceItem { IsEnabled = true, Image = NormalIcon.Instance().Subscription, Title = DictionaryResource.GetString("Subscription") });
PackageList.Add(new SpaceItem { IsEnabled = true, Image = NormalIcon.Instance().ToView, Title = DictionaryResource.GetString("ToView") });
PackageList.Add(new SpaceItem { IsEnabled = true, Image = NormalIcon.Instance().History, Title = DictionaryResource.GetString("History") });
NormalIcon.Instance().FavoriteOutline.Fill = DictionaryResource.GetColor("ColorPrimary");
NormalIcon.Instance().Subscription.Fill = DictionaryResource.GetColor("ColorPrimary");
NormalIcon.Instance().ToView.Fill = DictionaryResource.GetColor("ColorPrimary");
NormalIcon.Instance().History.Fill = DictionaryResource.GetColor("ColorPrimary");
SelectedStatus = -1;
SelectedPackage = -1;
ContentVisibility = Visibility.Collapsed;

@ -156,6 +156,14 @@ namespace DownKyi.ViewModels
set => SetProperty(ref tabRightBanners, value);
}
private int selectedRightBanner;
public int SelectedRightBanner
{
get => selectedRightBanner;
set => SetProperty(ref selectedRightBanner, value);
}
#endregion
public ViewUserSpaceViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) : base(eventAggregator)
@ -232,6 +240,48 @@ namespace DownKyi.ViewModels
}
}
// 右侧tab点击事件
private DelegateCommand<object> tabRightBannersCommand;
public DelegateCommand<object> TabRightBannersCommand => tabRightBannersCommand ?? (tabRightBannersCommand = new DelegateCommand<object>(ExecuteTabRightBannersCommand));
/// <summary>
/// 右侧tab点击事件
/// </summary>
private void ExecuteTabRightBannersCommand(object parameter)
{
if (!(parameter is TabRightBanner banner)) { return; }
Dictionary<string, object> data = new Dictionary<string, object>
{
{ "mid", mid },
{ "friendId", 0 }
};
string parentViewName;
if (ParentView == ViewFriendsViewModel.Tag)
{
parentViewName = ViewIndexViewModel.Tag;
}
else
{
parentViewName = Tag;
}
switch (banner.Id)
{
case 0:
data["friendId"] = 0;
NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, parentViewName, data);
break;
case 1:
data["friendId"] = 1;
NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, parentViewName, data);
break;
}
SelectedRightBanner = -1;
}
#endregion
/// <summary>
@ -254,6 +304,8 @@ namespace DownKyi.ViewModels
TabLeftBanners.Clear();
TabRightBanners.Clear();
SelectedRightBanner = -1;
// 将内容置空,使其不指向任何页面
regionManager.RequestNavigate("UserSpaceContentRegion", "");
@ -436,6 +488,7 @@ namespace DownKyi.ViewModels
{
TabRightBanners.Add(new TabRightBanner
{
Id = 0,
IsEnabled = true,
LabelColor = DictionaryResource.GetColor("ColorPrimary"),
CountColor = DictionaryResource.GetColor("ColorPrimary"),
@ -444,6 +497,7 @@ namespace DownKyi.ViewModels
});
TabRightBanners.Add(new TabRightBanner
{
Id = 1,
IsEnabled = true,
LabelColor = DictionaryResource.GetColor("ColorPrimary"),
CountColor = DictionaryResource.GetColor("ColorPrimary"),
@ -462,6 +516,7 @@ namespace DownKyi.ViewModels
{
TabRightBanners.Add(new TabRightBanner
{
Id = 2,
IsEnabled = false,
LabelColor = DictionaryResource.GetColor("ColorTextGrey"),
CountColor = DictionaryResource.GetColor("ColorTextDark"),
@ -476,6 +531,7 @@ namespace DownKyi.ViewModels
}
TabRightBanners.Add(new TabRightBanner
{
Id = 3,
IsEnabled = false,
LabelColor = DictionaryResource.GetColor("ColorTextGrey"),
CountColor = DictionaryResource.GetColor("ColorTextDark"),
@ -490,6 +546,7 @@ namespace DownKyi.ViewModels
}
TabRightBanners.Add(new TabRightBanner
{
Id = 4,
IsEnabled = false,
LabelColor = DictionaryResource.GetColor("ColorTextGrey"),
CountColor = DictionaryResource.GetColor("ColorTextDark"),

@ -0,0 +1,153 @@
<UserControl
x:Class="DownKyi.Views.Friends.ViewFollower"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converter="clr-namespace:DownKyi.Converter"
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="ContentListStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid
Name="nameUserPanel"
Width="400"
Height="80"
Margin="15,15,10,5"
Cursor="Hand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<i:InvokeCommandAction Command="{Binding UserCommand}" CommandParameter="{Binding DataContext.PageName, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<Image
Grid.Column="0"
Width="64"
Height="64"
Source="{Binding Header}">
<Image.Clip>
<EllipseGeometry
Center="32,32"
RadiusX="32"
RadiusY="32" />
</Image.Clip>
</Image>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Foreground="{DynamicResource BrushTextDark}"
Text="{Binding Name}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWithOverflow" />
<TextBlock
Grid.Row="1"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="12"
Foreground="{DynamicResource BrushTextGrey2}"
Text="{Binding Sign}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWithOverflow"
ToolTip="{Binding Sign}" />
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Grid Grid.Column="1" Visibility="{Binding ContentVisibility}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<ListBox
x:Name="nameContents"
Grid.Row="0"
BorderThickness="0"
ItemContainerStyle="{StaticResource ContentListStyle}"
ItemsSource="{Binding Contents}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding ContentsCommand}" CommandParameter="{Binding ElementName=nameContents, Path=SelectedItems}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.Style>
<Style TargetType="ListBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border
x:Name="Bd"
Padding="0"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Focusable="False">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.Style>
</ListBox>
<custom:CustomPager
Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
DataContext="{Binding Pager}" />
</Grid>
<!-- 加载gif -->
<StackPanel
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 FollowerWait}" />
</StackPanel>
<!-- 没有数据提示 -->
<Image
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.Friends
{
/// <summary>
/// ViewFollower.xaml 的交互逻辑
/// </summary>
public partial class ViewFollower : UserControl
{
public ViewFollower()
{
InitializeComponent();
}
}
}

@ -0,0 +1,226 @@
<UserControl
x:Class="DownKyi.Views.Friends.ViewFollowing"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converter="clr-namespace:DownKyi.Converter"
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>
<converter:CountConverter x:Key="CountConverter" Count="1" />
<Style x:Key="ContentListStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid
Name="nameUserPanel"
Width="400"
Height="80"
Margin="15,15,10,5"
Cursor="Hand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<i:InvokeCommandAction Command="{Binding UserCommand}" CommandParameter="{Binding DataContext.PageName, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<Image
Grid.Column="0"
Width="64"
Height="64"
Source="{Binding Header}">
<Image.Clip>
<EllipseGeometry
Center="32,32"
RadiusX="32"
RadiusY="32" />
</Image.Clip>
</Image>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Foreground="{DynamicResource BrushTextDark}"
Text="{Binding Name}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWithOverflow" />
<TextBlock
Grid.Row="1"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="12"
Foreground="{DynamicResource BrushTextGrey2}"
Text="{Binding Sign}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWithOverflow"
ToolTip="{Binding Sign}" />
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Grid Visibility="{Binding ContentVisibility}">
<Grid.ColumnDefinitions>
<ColumnDefinition>
<ColumnDefinition.Style>
<Style TargetType="ColumnDefinition">
<Style.Triggers>
<DataTrigger Binding="{Binding TabHeaders}" Value="{x:Null}">
<Setter Property="Width" Value="0" />
</DataTrigger>
<DataTrigger Binding="{Binding TabHeaders.Count}" Value="0">
<Setter Property="Width" Value="0" />
</DataTrigger>
<DataTrigger Binding="{Binding TabHeaders.Count}" Value="1">
<Setter Property="Width" Value="0" />
</DataTrigger>
<DataTrigger Binding="{Binding TabHeaders.Count, Converter={StaticResource CountConverter}}" Value="true">
<Setter Property="Width" Value="200" />
</DataTrigger>
</Style.Triggers>
</Style>
</ColumnDefinition.Style>
</ColumnDefinition>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- 左侧tab header -->
<ListBox
Name="nameLeftTabHeaders"
Grid.Column="0"
BorderThickness="0"
IsEnabled="{Binding IsEnabled}"
ItemContainerStyle="{StaticResource LeftTabHeaderItemStyle}"
ItemsSource="{Binding TabHeaders}"
SelectedIndex="{Binding SelectTabId}"
Style="{StaticResource LeftTabHeaderStyle}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding LeftTabHeadersCommand}" CommandParameter="{Binding ElementName=nameLeftTabHeaders, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</ListBox>
<!-- 右侧内容区 -->
<Grid Grid.Column="1" Visibility="{Binding InnerContentVisibility}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<ListBox
x:Name="nameContents"
Grid.Row="0"
BorderThickness="0"
ItemContainerStyle="{StaticResource ContentListStyle}"
ItemsSource="{Binding Contents}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding ContentsCommand}" CommandParameter="{Binding ElementName=nameContents, Path=SelectedItems}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.Style>
<Style TargetType="ListBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border
x:Name="Bd"
Padding="0"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Focusable="False">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.Style>
</ListBox>
<custom:CustomPager
Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
DataContext="{Binding Pager}" />
</Grid>
<!-- 加载gif -->
<StackPanel
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Vertical"
Visibility="{Binding ContentLoadingVisibility}">
<ContentControl
Width="40"
Height="40"
Content="{Binding ContentLoading}" />
<TextBlock
Margin="0,10,0,0"
FontSize="14"
Foreground="{DynamicResource BrushTextDark}"
Text="{DynamicResource FollowingWait}" />
</StackPanel>
<!-- 没有数据提示 -->
<Image
Grid.Column="1"
Width="256"
Height="256"
Source="/DownKyi;component/Resources/no-data.png"
Visibility="{Binding ContentNoDataVisibility}" />
</Grid>
<!-- 加载gif -->
<StackPanel
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 FollowingWait}" />
</StackPanel>
<!-- 没有数据提示 -->
<Image
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.Friends
{
/// <summary>
/// ViewFollowing.xaml 的交互逻辑
/// </summary>
public partial class ViewFollowing : UserControl
{
public ViewFollowing()
{
InitializeComponent();
}
}
}

@ -0,0 +1,138 @@
<UserControl
x:Class="DownKyi.Views.ViewFriends"
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 />
<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 Friend}" />
</StackPanel>
</Button>
<!-- 顶部Tab -->
<ListBox
Name="nameTabHeaders"
Grid.Column="1"
BorderThickness="0"
ItemsSource="{Binding TabHeaders}"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
SelectedIndex="{Binding SelectTabId, Mode=TwoWay}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding TabHeadersCommand}" CommandParameter="{Binding ElementName=nameTabHeaders, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<StackPanel
x:Name="panel"
Margin="10,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Cursor="Hand">
<TextBlock
Name="nameText"
Padding="0,0,0,3"
Text="{Binding Title}" />
<TextBlock Name="nameIndicator" Height="1.5" />
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="Selector.IsSelected" Value="False">
<Setter TargetName="nameText" Property="Foreground" Value="{DynamicResource BrushTextDark}" />
<Setter TargetName="nameIndicator" Property="Visibility" Value="Hidden" />
<Setter TargetName="nameIndicator" Property="Background" Value="{DynamicResource BrushTextDark}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="nameText" Property="Foreground" Value="{DynamicResource BrushPrimary}" />
</Trigger>
<Trigger Property="Selector.IsSelected" Value="True">
<Setter TargetName="nameText" Property="Foreground" Value="{DynamicResource BrushPrimary}" />
<Setter TargetName="nameIndicator" Property="Visibility" Value="Visible" />
<Setter TargetName="nameIndicator" Property="Background" Value="{DynamicResource BrushPrimary}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.Style>
<Style TargetType="ListBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border
x:Name="Bd"
Padding="0"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Focusable="False">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.Style>
</ListBox>
</Grid>
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
<!-- 内容区 -->
<ContentControl Grid.Row="2" prism:RegionManager.RegionName="FriendContentRegion" />
</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>
/// ViewFriend.xaml 的交互逻辑
/// </summary>
public partial class ViewFriends : UserControl
{
public ViewFriends()
{
InitializeComponent();
}
}
}

@ -256,8 +256,14 @@
BorderBrush="{x:Null}"
BorderThickness="0"
ItemsSource="{Binding StatusList}"
SelectedIndex="{Binding SelectedStatus}"
SelectionMode="Single"
Style="{StaticResource SpaceStyle}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding StatusListCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
@ -266,6 +272,8 @@
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Cursor="Hand"
IsEnabled="{Binding IsEnabled}"
Orientation="Vertical">
<TextBlock
HorizontalAlignment="Center"

@ -277,10 +277,12 @@
</ListBox>
<ListBox
Name="nameTabRightBanners"
Grid.Column="1"
ItemContainerStyle="{StaticResource TabRightBannerStyle}"
ItemsSource="{Binding TabRightBanners}"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
SelectedIndex="{Binding SelectedRightBanner}"
Style="{StaticResource TabBannerStyle}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
@ -290,6 +292,11 @@
Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding TabRightBannersCommand}" CommandParameter="{Binding ElementName=nameTabRightBanners, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</ListBox>
</Grid>

Loading…
Cancel
Save