From 7253a0ee124bd6fd87b008fcfe7e730c63d28402 Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sun, 13 Mar 2022 17:18:18 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=A5=BD=E5=8F=8B=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=A1=86=E6=9E=B6=E6=90=AD=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi/App.xaml.cs | 7 + DownKyi/DownKyi.csproj | 24 +++ DownKyi/Languages/Default.xaml | 5 + .../Friend/ViewFollowerViewModel.cs | 18 +++ .../Friend/ViewFollowingViewModel.cs | 18 +++ .../ViewModels/PageViewModels/SpaceItem.cs | 7 + .../ViewModels/UserSpace/TabRightBanner.cs | 2 + .../UserSpace/ViewArchiveViewModel.cs | 11 +- .../UserSpace/ViewChannelViewModel.cs | 10 +- DownKyi/ViewModels/ViewFriendViewModel.cs | 152 ++++++++++++++++++ .../ViewMyBangumiFollowViewModel.cs | 2 +- DownKyi/ViewModels/ViewMySpaceViewModel.cs | 70 ++++++-- DownKyi/ViewModels/ViewUserSpaceViewModel.cs | 48 +++++- DownKyi/Views/Friend/ViewFollower.xaml | 14 ++ DownKyi/Views/Friend/ViewFollower.xaml.cs | 28 ++++ DownKyi/Views/Friend/ViewFollowing.xaml | 14 ++ DownKyi/Views/Friend/ViewFollowing.xaml.cs | 28 ++++ DownKyi/Views/ViewFriend.xaml | 139 ++++++++++++++++ DownKyi/Views/ViewFriend.xaml.cs | 28 ++++ DownKyi/Views/ViewMySpace.xaml | 8 + DownKyi/Views/ViewUserSpace.xaml | 7 + 21 files changed, 611 insertions(+), 29 deletions(-) create mode 100644 DownKyi/ViewModels/Friend/ViewFollowerViewModel.cs create mode 100644 DownKyi/ViewModels/Friend/ViewFollowingViewModel.cs create mode 100644 DownKyi/ViewModels/ViewFriendViewModel.cs create mode 100644 DownKyi/Views/Friend/ViewFollower.xaml create mode 100644 DownKyi/Views/Friend/ViewFollower.xaml.cs create mode 100644 DownKyi/Views/Friend/ViewFollowing.xaml create mode 100644 DownKyi/Views/Friend/ViewFollowing.xaml.cs create mode 100644 DownKyi/Views/ViewFriend.xaml create mode 100644 DownKyi/Views/ViewFriend.xaml.cs diff --git a/DownKyi/App.xaml.cs b/DownKyi/App.xaml.cs index 6a5d6a9..1ef4e1f 100644 --- a/DownKyi/App.xaml.cs +++ b/DownKyi/App.xaml.cs @@ -4,12 +4,14 @@ using DownKyi.Utils; using DownKyi.ViewModels; using DownKyi.ViewModels.Dialogs; using DownKyi.ViewModels.DownloadManager; +using DownKyi.ViewModels.Friend; 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.Friend; using DownKyi.Views.Settings; using DownKyi.Views.Toolbox; using DownKyi.Views.UserSpace; @@ -166,6 +168,7 @@ namespace DownKyi containerRegistry.RegisterForNavigation(ViewUserSpaceViewModel.Tag); containerRegistry.RegisterForNavigation(ViewPublicationViewModel.Tag); containerRegistry.RegisterForNavigation(ViewModels.ViewChannelViewModel.Tag); + containerRegistry.RegisterForNavigation(ViewFriendViewModel.Tag); containerRegistry.RegisterForNavigation(ViewMySpaceViewModel.Tag); containerRegistry.RegisterForNavigation(ViewMyFavoritesViewModel.Tag); @@ -177,6 +180,10 @@ namespace DownKyi containerRegistry.RegisterForNavigation(ViewDownloadingViewModel.Tag); containerRegistry.RegisterForNavigation(ViewDownloadFinishedViewModel.Tag); + // Friend + containerRegistry.RegisterForNavigation(ViewFollowingViewModel.Tag); + containerRegistry.RegisterForNavigation(ViewFollowerViewModel.Tag); + // settings pages containerRegistry.RegisterForNavigation(ViewBasicViewModel.Tag); containerRegistry.RegisterForNavigation(ViewNetworkViewModel.Tag); diff --git a/DownKyi/DownKyi.csproj b/DownKyi/DownKyi.csproj index 1ee1080..7a7c8b2 100644 --- a/DownKyi/DownKyi.csproj +++ b/DownKyi/DownKyi.csproj @@ -100,6 +100,8 @@ + + @@ -151,6 +153,7 @@ + @@ -179,6 +182,12 @@ ViewDownloading.xaml + + ViewFollower.xaml + + + ViewFollowing.xaml + ViewAbout.xaml @@ -218,6 +227,9 @@ ViewDownloadManager.xaml + + ViewFriend.xaml + ViewIndex.xaml @@ -341,6 +353,14 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -409,6 +429,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/DownKyi/Languages/Default.xaml b/DownKyi/Languages/Default.xaml index a590212..7617c23 100644 --- a/DownKyi/Languages/Default.xaml +++ b/DownKyi/Languages/Default.xaml @@ -96,6 +96,11 @@ 下载全部 请稍等,马上就好~ + + 好友 + 关注 + 粉丝 + 复制封面图片 复制封面URL diff --git a/DownKyi/ViewModels/Friend/ViewFollowerViewModel.cs b/DownKyi/ViewModels/Friend/ViewFollowerViewModel.cs new file mode 100644 index 0000000..964cb0d --- /dev/null +++ b/DownKyi/ViewModels/Friend/ViewFollowerViewModel.cs @@ -0,0 +1,18 @@ +using Prism.Events; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DownKyi.ViewModels.Friend +{ + public class ViewFollowerViewModel : BaseViewModel + { + public const string Tag = "PageFriendFollower"; + + public ViewFollowerViewModel(IEventAggregator eventAggregator) : base(eventAggregator) + { + } + } +} diff --git a/DownKyi/ViewModels/Friend/ViewFollowingViewModel.cs b/DownKyi/ViewModels/Friend/ViewFollowingViewModel.cs new file mode 100644 index 0000000..693cd24 --- /dev/null +++ b/DownKyi/ViewModels/Friend/ViewFollowingViewModel.cs @@ -0,0 +1,18 @@ +using Prism.Events; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DownKyi.ViewModels.Friend +{ + public class ViewFollowingViewModel : BaseViewModel + { + public const string Tag = "PageFriendFollowing"; + + public ViewFollowingViewModel(IEventAggregator eventAggregator) : base(eventAggregator) + { + } + } +} diff --git a/DownKyi/ViewModels/PageViewModels/SpaceItem.cs b/DownKyi/ViewModels/PageViewModels/SpaceItem.cs index 091cb9f..8eb149c 100644 --- a/DownKyi/ViewModels/PageViewModels/SpaceItem.cs +++ b/DownKyi/ViewModels/PageViewModels/SpaceItem.cs @@ -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 { diff --git a/DownKyi/ViewModels/UserSpace/TabRightBanner.cs b/DownKyi/ViewModels/UserSpace/TabRightBanner.cs index f36a678..252c3ce 100644 --- a/DownKyi/ViewModels/UserSpace/TabRightBanner.cs +++ b/DownKyi/ViewModels/UserSpace/TabRightBanner.cs @@ -4,6 +4,8 @@ namespace DownKyi.ViewModels.UserSpace { public class TabRightBanner : BindableBase { + public int Id { get; set; } + private bool isEnabled; public bool IsEnabled { diff --git a/DownKyi/ViewModels/UserSpace/ViewArchiveViewModel.cs b/DownKyi/ViewModels/UserSpace/ViewArchiveViewModel.cs index 407000d..f280cca 100644 --- a/DownKyi/ViewModels/UserSpace/ViewArchiveViewModel.cs +++ b/DownKyi/ViewModels/UserSpace/ViewArchiveViewModel.cs @@ -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().Publish(param); + NavigateToView.NavigationView(eventAggregator, ViewPublicationViewModel.Tag, ViewUserSpaceViewModel.Tag, data); SelectedItem = -1; } diff --git a/DownKyi/ViewModels/UserSpace/ViewChannelViewModel.cs b/DownKyi/ViewModels/UserSpace/ViewChannelViewModel.cs index c5776bb..82e67c0 100644 --- a/DownKyi/ViewModels/UserSpace/ViewChannelViewModel.cs +++ b/DownKyi/ViewModels/UserSpace/ViewChannelViewModel.cs @@ -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().Publish(param); + NavigateToView.NavigationView(eventAggregator, ViewModels.ViewChannelViewModel.Tag, ViewUserSpaceViewModel.Tag, data); SelectedItem = -1; } diff --git a/DownKyi/ViewModels/ViewFriendViewModel.cs b/DownKyi/ViewModels/ViewFriendViewModel.cs new file mode 100644 index 0000000..8b3a8d8 --- /dev/null +++ b/DownKyi/ViewModels/ViewFriendViewModel.cs @@ -0,0 +1,152 @@ +using DownKyi.Events; +using DownKyi.Images; +using DownKyi.Utils; +using DownKyi.ViewModels.Friend; +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 ViewFriendViewModel : BaseViewModel + { + public const string Tag = "PageFriend"; + + private readonly IRegionManager regionManager; + + private long mid = -1; + + #region 页面属性申明 + + private VectorImage arrowBack; + public VectorImage ArrowBack + { + get => arrowBack; + set => SetProperty(ref arrowBack, value); + } + + private ObservableCollection tabHeaders; + public ObservableCollection TabHeaders + { + get => tabHeaders; + set => SetProperty(ref tabHeaders, value); + } + + private int selectTabId; + public int SelectTabId + { + get => selectTabId; + set => SetProperty(ref selectTabId, value); + } + + #endregion + + public ViewFriendViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) : base(eventAggregator) + { + this.regionManager = regionManager; + + #region 属性初始化 + + ArrowBack = NavigationIcon.Instance().ArrowBack; + ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); + + TabHeaders = new ObservableCollection + { + 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)); + + /// + /// 返回事件 + /// + private void ExecuteBackSpace() + { + //InitView(); + + ArrowBack.Fill = DictionaryResource.GetColor("ColorText"); + + NavigationParam parameter = new NavigationParam + { + ViewName = ParentView, + ParentViewName = null, + Parameter = null + }; + eventAggregator.GetEvent().Publish(parameter); + } + + // 顶部tab点击事件 + private DelegateCommand tabHeadersCommand; + public DelegateCommand TabHeadersCommand => tabHeadersCommand ?? (tabHeadersCommand = new DelegateCommand(ExecuteTabHeadersCommand)); + + /// + /// 顶部tab点击事件 + /// + /// + private void ExecuteTabHeadersCommand(object parameter) + { + if (!(parameter is TabHeader tabHeader)) { return; } + + NavigationView(tabHeader.Id); + } + + #endregion + + /// + /// 进入子页面 + /// + /// + private void NavigationView(int id) + { + NavigationParameters param = new NavigationParameters() + { + { "mid", mid }, + }; + + switch (id) + { + case 0: + regionManager.RequestNavigate("FriendContentRegion", ViewFollowerViewModel.Tag, param); + break; + case 1: + regionManager.RequestNavigate("FriendContentRegion", ViewFollowingViewModel.Tag, param); + break; + } + } + + /// + /// 导航到VideoDetail页面时执行 + /// + /// + public override void OnNavigatedTo(NavigationContext navigationContext) + { + base.OnNavigatedTo(navigationContext); + + ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); + + // 根据传入参数不同执行不同任务 + var parameter = navigationContext.Parameters.GetValue>("Parameter"); + if (parameter == null) + { + return; + } + + mid = (long)parameter["mid"]; + SelectTabId = (int)parameter["friendId"]; + + NavigationView(SelectTabId); + } + + } +} diff --git a/DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs b/DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs index caa760e..42b15eb 100644 --- a/DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs +++ b/DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs @@ -183,7 +183,7 @@ namespace DownKyi.ViewModels public DelegateCommand TabHeadersCommand => tabHeadersCommand ?? (tabHeadersCommand = new DelegateCommand(ExecuteTabHeadersCommand, CanExecuteTabHeadersCommand)); /// - /// 左侧tab点击事件 + /// 顶部tab点击事件 /// /// private void ExecuteTabHeadersCommand(object parameter) diff --git a/DownKyi/ViewModels/ViewMySpaceViewModel.cs b/DownKyi/ViewModels/ViewMySpaceViewModel.cs index 01a8d94..28f987b 100644 --- a/DownKyi/ViewModels/ViewMySpaceViewModel.cs +++ b/DownKyi/ViewModels/ViewMySpaceViewModel.cs @@ -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().Publish(parameter); } + // 页面选择事件 + private DelegateCommand statusListCommand; + public DelegateCommand StatusListCommand => statusListCommand ?? (statusListCommand = new DelegateCommand(ExecuteStatusListCommand)); + + /// + /// 页面选择事件 + /// + private void ExecuteStatusListCommand() + { + if (SelectedStatus == -1) + { + return; + } + + Dictionary data = new Dictionary + { + { "mid", mid }, + { "friendId", 0 } + }; + + switch (SelectedStatus) + { + case 0: + data["friendId"] = 0; + NavigateToView.NavigationView(eventAggregator, ViewFriendViewModel.Tag, Tag, data); + break; + case 1: + data["friendId"] = 0; + NavigateToView.NavigationView(eventAggregator, ViewFriendViewModel.Tag, Tag, data); + break; + case 2: + data["friendId"] = 1; + NavigateToView.NavigationView(eventAggregator, ViewFriendViewModel.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; diff --git a/DownKyi/ViewModels/ViewUserSpaceViewModel.cs b/DownKyi/ViewModels/ViewUserSpaceViewModel.cs index 9cecb51..6bef7cb 100644 --- a/DownKyi/ViewModels/ViewUserSpaceViewModel.cs +++ b/DownKyi/ViewModels/ViewUserSpaceViewModel.cs @@ -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) @@ -200,7 +208,6 @@ namespace DownKyi.ViewModels eventAggregator.GetEvent().Publish(parameter); } - // 左侧tab点击事件 private DelegateCommand tabLeftBannersCommand; public DelegateCommand TabLeftBannersCommand => tabLeftBannersCommand ?? (tabLeftBannersCommand = new DelegateCommand(ExecuteTabLeftBannersCommand)); @@ -230,6 +237,38 @@ namespace DownKyi.ViewModels } } + // 右侧tab点击事件 + private DelegateCommand tabRightBannersCommand; + public DelegateCommand TabRightBannersCommand => tabRightBannersCommand ?? (tabRightBannersCommand = new DelegateCommand(ExecuteTabRightBannersCommand)); + + /// + /// 右侧tab点击事件 + /// + private void ExecuteTabRightBannersCommand(object parameter) + { + if (!(parameter is TabRightBanner banner)) { return; } + + Dictionary data = new Dictionary + { + { "mid", mid }, + { "friendId", 0 } + }; + + switch (banner.Id) + { + case 0: + data["friendId"] = 0; + NavigateToView.NavigationView(eventAggregator, ViewFriendViewModel.Tag, Tag, data); + break; + case 1: + data["friendId"] = 1; + NavigateToView.NavigationView(eventAggregator, ViewFriendViewModel.Tag, Tag, data); + break; + } + + SelectedRightBanner = -1; + } + #endregion /// @@ -252,6 +291,8 @@ namespace DownKyi.ViewModels TabLeftBanners.Clear(); TabRightBanners.Clear(); + SelectedRightBanner = -1; + // 将内容置空,使其不指向任何页面 regionManager.RequestNavigate("UserSpaceContentRegion", ""); @@ -416,6 +457,7 @@ namespace DownKyi.ViewModels { TabRightBanners.Add(new TabRightBanner { + Id = 0, IsEnabled = true, LabelColor = DictionaryResource.GetColor("ColorPrimary"), CountColor = DictionaryResource.GetColor("ColorPrimary"), @@ -424,6 +466,7 @@ namespace DownKyi.ViewModels }); TabRightBanners.Add(new TabRightBanner { + Id = 1, IsEnabled = true, LabelColor = DictionaryResource.GetColor("ColorPrimary"), CountColor = DictionaryResource.GetColor("ColorPrimary"), @@ -442,6 +485,7 @@ namespace DownKyi.ViewModels { TabRightBanners.Add(new TabRightBanner { + Id = 2, IsEnabled = false, LabelColor = DictionaryResource.GetColor("ColorTextGrey"), CountColor = DictionaryResource.GetColor("ColorTextDark"), @@ -456,6 +500,7 @@ namespace DownKyi.ViewModels } TabRightBanners.Add(new TabRightBanner { + Id = 3, IsEnabled = false, LabelColor = DictionaryResource.GetColor("ColorTextGrey"), CountColor = DictionaryResource.GetColor("ColorTextDark"), @@ -470,6 +515,7 @@ namespace DownKyi.ViewModels } TabRightBanners.Add(new TabRightBanner { + Id = 4, IsEnabled = false, LabelColor = DictionaryResource.GetColor("ColorTextGrey"), CountColor = DictionaryResource.GetColor("ColorTextDark"), diff --git a/DownKyi/Views/Friend/ViewFollower.xaml b/DownKyi/Views/Friend/ViewFollower.xaml new file mode 100644 index 0000000..4419847 --- /dev/null +++ b/DownKyi/Views/Friend/ViewFollower.xaml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/DownKyi/Views/Friend/ViewFollower.xaml.cs b/DownKyi/Views/Friend/ViewFollower.xaml.cs new file mode 100644 index 0000000..93d62da --- /dev/null +++ b/DownKyi/Views/Friend/ViewFollower.xaml.cs @@ -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.Friend +{ + /// + /// ViewFollower.xaml 的交互逻辑 + /// + public partial class ViewFollower : UserControl + { + public ViewFollower() + { + InitializeComponent(); + } + } +} diff --git a/DownKyi/Views/Friend/ViewFollowing.xaml b/DownKyi/Views/Friend/ViewFollowing.xaml new file mode 100644 index 0000000..5fb0017 --- /dev/null +++ b/DownKyi/Views/Friend/ViewFollowing.xaml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/DownKyi/Views/Friend/ViewFollowing.xaml.cs b/DownKyi/Views/Friend/ViewFollowing.xaml.cs new file mode 100644 index 0000000..40e5bba --- /dev/null +++ b/DownKyi/Views/Friend/ViewFollowing.xaml.cs @@ -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.Friend +{ + /// + /// ViewFollowing.xaml 的交互逻辑 + /// + public partial class ViewFollowing : UserControl + { + public ViewFollowing() + { + InitializeComponent(); + } + } +} diff --git a/DownKyi/Views/ViewFriend.xaml b/DownKyi/Views/ViewFriend.xaml new file mode 100644 index 0000000..40ad395 --- /dev/null +++ b/DownKyi/Views/ViewFriend.xaml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DownKyi/Views/ViewFriend.xaml.cs b/DownKyi/Views/ViewFriend.xaml.cs new file mode 100644 index 0000000..36445f6 --- /dev/null +++ b/DownKyi/Views/ViewFriend.xaml.cs @@ -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 +{ + /// + /// ViewFriend.xaml 的交互逻辑 + /// + public partial class ViewFriend : UserControl + { + public ViewFriend() + { + InitializeComponent(); + } + } +} diff --git a/DownKyi/Views/ViewMySpace.xaml b/DownKyi/Views/ViewMySpace.xaml index 409c3b9..fc165c9 100644 --- a/DownKyi/Views/ViewMySpace.xaml +++ b/DownKyi/Views/ViewMySpace.xaml @@ -256,8 +256,14 @@ BorderBrush="{x:Null}" BorderThickness="0" ItemsSource="{Binding StatusList}" + SelectedIndex="{Binding SelectedStatus}" SelectionMode="Single" Style="{StaticResource SpaceStyle}"> + + + + + + + + + + + + + + + + + + + + + diff --git a/DownKyi/Views/ViewFriend.xaml b/DownKyi/Views/ViewFriend.xaml index 40ad395..abfdf23 100644 --- a/DownKyi/Views/ViewFriend.xaml +++ b/DownKyi/Views/ViewFriend.xaml @@ -51,7 +51,6 @@ Name="nameTabHeaders" Grid.Column="1" BorderThickness="0" - IsEnabled="{Binding IsEnabled}" ItemsSource="{Binding TabHeaders}" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Disabled" From 0c5cc2d7ca6b7040c0ee7ac687371968e3afdbb4 Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sun, 16 Oct 2022 16:58:24 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9Friends=E5=8C=85?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi/DownKyi.csproj | 12 ++++++------ .../{Friend => Friends}/ViewFollowerViewModel.cs | 2 +- .../{Friend => Friends}/ViewFollowingViewModel.cs | 2 +- DownKyi/Views/{Friend => Friends}/ViewFollower.xaml | 2 +- .../Views/{Friend => Friends}/ViewFollower.xaml.cs | 2 +- DownKyi/Views/{Friend => Friends}/ViewFollowing.xaml | 2 +- .../Views/{Friend => Friends}/ViewFollowing.xaml.cs | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) rename DownKyi/ViewModels/{Friend => Friends}/ViewFollowerViewModel.cs (98%) rename DownKyi/ViewModels/{Friend => Friends}/ViewFollowingViewModel.cs (91%) rename DownKyi/Views/{Friend => Friends}/ViewFollower.xaml (98%) rename DownKyi/Views/{Friend => Friends}/ViewFollower.xaml.cs (95%) rename DownKyi/Views/{Friend => Friends}/ViewFollowing.xaml (90%) rename DownKyi/Views/{Friend => Friends}/ViewFollowing.xaml.cs (95%) diff --git a/DownKyi/DownKyi.csproj b/DownKyi/DownKyi.csproj index 788877d..7df8b04 100644 --- a/DownKyi/DownKyi.csproj +++ b/DownKyi/DownKyi.csproj @@ -121,8 +121,8 @@ - - + + @@ -211,10 +211,10 @@ ViewDownloading.xaml - + ViewFollower.xaml - + ViewFollowing.xaml @@ -392,11 +392,11 @@ Designer MSBuild:Compile - + Designer MSBuild:Compile - + Designer MSBuild:Compile diff --git a/DownKyi/ViewModels/Friend/ViewFollowerViewModel.cs b/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs similarity index 98% rename from DownKyi/ViewModels/Friend/ViewFollowerViewModel.cs rename to DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs index 2c377fb..acf8bd8 100644 --- a/DownKyi/ViewModels/Friend/ViewFollowerViewModel.cs +++ b/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs @@ -4,7 +4,7 @@ using Prism.Events; using Prism.Regions; using System.Collections.ObjectModel; -namespace DownKyi.ViewModels.Friend +namespace DownKyi.ViewModels.Friends { public class ViewFollowerViewModel : BaseViewModel { diff --git a/DownKyi/ViewModels/Friend/ViewFollowingViewModel.cs b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs similarity index 91% rename from DownKyi/ViewModels/Friend/ViewFollowingViewModel.cs rename to DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs index 693cd24..c65d387 100644 --- a/DownKyi/ViewModels/Friend/ViewFollowingViewModel.cs +++ b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace DownKyi.ViewModels.Friend +namespace DownKyi.ViewModels.Friends { public class ViewFollowingViewModel : BaseViewModel { diff --git a/DownKyi/Views/Friend/ViewFollower.xaml b/DownKyi/Views/Friends/ViewFollower.xaml similarity index 98% rename from DownKyi/Views/Friend/ViewFollower.xaml rename to DownKyi/Views/Friends/ViewFollower.xaml index ded640c..52309c1 100644 --- a/DownKyi/Views/Friend/ViewFollower.xaml +++ b/DownKyi/Views/Friends/ViewFollower.xaml @@ -1,5 +1,5 @@  /// ViewFollower.xaml 的交互逻辑 diff --git a/DownKyi/Views/Friend/ViewFollowing.xaml b/DownKyi/Views/Friends/ViewFollowing.xaml similarity index 90% rename from DownKyi/Views/Friend/ViewFollowing.xaml rename to DownKyi/Views/Friends/ViewFollowing.xaml index 5fb0017..de15d36 100644 --- a/DownKyi/Views/Friend/ViewFollowing.xaml +++ b/DownKyi/Views/Friends/ViewFollowing.xaml @@ -1,5 +1,5 @@  /// ViewFollowing.xaml 的交互逻辑 From 0356b94d71d91b011578e84177c856fb8422a3ef Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sun, 16 Oct 2022 17:04:08 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9Friends=E5=8C=85?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi/App.xaml.cs | 6 +++--- DownKyi/DownKyi.csproj | 8 ++++---- .../{ViewFriendViewModel.cs => ViewFriendsViewModel.cs} | 8 ++++---- DownKyi/ViewModels/ViewMySpaceViewModel.cs | 6 +++--- DownKyi/ViewModels/ViewUserSpaceViewModel.cs | 4 ++-- DownKyi/Views/{ViewFriend.xaml => ViewFriends.xaml} | 2 +- DownKyi/Views/{ViewFriend.xaml.cs => ViewFriends.xaml.cs} | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) rename DownKyi/ViewModels/{ViewFriendViewModel.cs => ViewFriendsViewModel.cs} (94%) rename DownKyi/Views/{ViewFriend.xaml => ViewFriends.xaml} (99%) rename DownKyi/Views/{ViewFriend.xaml.cs => ViewFriends.xaml.cs} (87%) diff --git a/DownKyi/App.xaml.cs b/DownKyi/App.xaml.cs index 42f74b4..a6ceda2 100644 --- a/DownKyi/App.xaml.cs +++ b/DownKyi/App.xaml.cs @@ -4,14 +4,14 @@ using DownKyi.Utils; using DownKyi.ViewModels; using DownKyi.ViewModels.Dialogs; using DownKyi.ViewModels.DownloadManager; -using DownKyi.ViewModels.Friend; +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.Friend; +using DownKyi.Views.Friends; using DownKyi.Views.Settings; using DownKyi.Views.Toolbox; using DownKyi.Views.UserSpace; @@ -186,7 +186,7 @@ namespace DownKyi containerRegistry.RegisterForNavigation(ViewPublicationViewModel.Tag); containerRegistry.RegisterForNavigation(ViewModels.ViewChannelViewModel.Tag); containerRegistry.RegisterForNavigation(ViewModels.ViewSeasonsSeriesViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewFriendViewModel.Tag); + containerRegistry.RegisterForNavigation(ViewFriendsViewModel.Tag); containerRegistry.RegisterForNavigation(ViewMySpaceViewModel.Tag); containerRegistry.RegisterForNavigation(ViewMyFavoritesViewModel.Tag); diff --git a/DownKyi/DownKyi.csproj b/DownKyi/DownKyi.csproj index 7df8b04..35c0390 100644 --- a/DownKyi/DownKyi.csproj +++ b/DownKyi/DownKyi.csproj @@ -179,7 +179,7 @@ - + @@ -262,8 +262,8 @@ ViewDownloadManager.xaml - - ViewFriend.xaml + + ViewFriends.xaml ViewIndex.xaml @@ -476,7 +476,7 @@ Designer MSBuild:Compile - + Designer MSBuild:Compile diff --git a/DownKyi/ViewModels/ViewFriendViewModel.cs b/DownKyi/ViewModels/ViewFriendsViewModel.cs similarity index 94% rename from DownKyi/ViewModels/ViewFriendViewModel.cs rename to DownKyi/ViewModels/ViewFriendsViewModel.cs index 9557c78..f1138f5 100644 --- a/DownKyi/ViewModels/ViewFriendViewModel.cs +++ b/DownKyi/ViewModels/ViewFriendsViewModel.cs @@ -1,7 +1,7 @@ using DownKyi.Events; using DownKyi.Images; using DownKyi.Utils; -using DownKyi.ViewModels.Friend; +using DownKyi.ViewModels.Friends; using DownKyi.ViewModels.PageViewModels; using Prism.Commands; using Prism.Events; @@ -11,9 +11,9 @@ using System.Collections.ObjectModel; namespace DownKyi.ViewModels { - public class ViewFriendViewModel : BaseViewModel + public class ViewFriendsViewModel : BaseViewModel { - public const string Tag = "PageFriend"; + public const string Tag = "PageFriends"; private readonly IRegionManager regionManager; @@ -44,7 +44,7 @@ namespace DownKyi.ViewModels #endregion - public ViewFriendViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) : base(eventAggregator) + public ViewFriendsViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) : base(eventAggregator) { this.regionManager = regionManager; diff --git a/DownKyi/ViewModels/ViewMySpaceViewModel.cs b/DownKyi/ViewModels/ViewMySpaceViewModel.cs index 28f987b..d057806 100644 --- a/DownKyi/ViewModels/ViewMySpaceViewModel.cs +++ b/DownKyi/ViewModels/ViewMySpaceViewModel.cs @@ -360,15 +360,15 @@ namespace DownKyi.ViewModels { case 0: data["friendId"] = 0; - NavigateToView.NavigationView(eventAggregator, ViewFriendViewModel.Tag, Tag, data); + NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, Tag, data); break; case 1: data["friendId"] = 0; - NavigateToView.NavigationView(eventAggregator, ViewFriendViewModel.Tag, Tag, data); + NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, Tag, data); break; case 2: data["friendId"] = 1; - NavigateToView.NavigationView(eventAggregator, ViewFriendViewModel.Tag, Tag, data); + NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, Tag, data); break; default: break; diff --git a/DownKyi/ViewModels/ViewUserSpaceViewModel.cs b/DownKyi/ViewModels/ViewUserSpaceViewModel.cs index 830fba7..feb0cea 100644 --- a/DownKyi/ViewModels/ViewUserSpaceViewModel.cs +++ b/DownKyi/ViewModels/ViewUserSpaceViewModel.cs @@ -261,11 +261,11 @@ namespace DownKyi.ViewModels { case 0: data["friendId"] = 0; - NavigateToView.NavigationView(eventAggregator, ViewFriendViewModel.Tag, Tag, data); + NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, Tag, data); break; case 1: data["friendId"] = 1; - NavigateToView.NavigationView(eventAggregator, ViewFriendViewModel.Tag, Tag, data); + NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, Tag, data); break; } diff --git a/DownKyi/Views/ViewFriend.xaml b/DownKyi/Views/ViewFriends.xaml similarity index 99% rename from DownKyi/Views/ViewFriend.xaml rename to DownKyi/Views/ViewFriends.xaml index abfdf23..d9ed296 100644 --- a/DownKyi/Views/ViewFriend.xaml +++ b/DownKyi/Views/ViewFriends.xaml @@ -1,5 +1,5 @@  /// ViewFriend.xaml 的交互逻辑 /// - public partial class ViewFriend : UserControl + public partial class ViewFriends : UserControl { - public ViewFriend() + public ViewFriends() { InitializeComponent(); } From 8b6e286d18fd5e172c280749e1cc5065d1ac609b Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sun, 16 Oct 2022 17:33:07 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9Friends=E5=8C=85?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs | 2 +- DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs b/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs index acf8bd8..b344def 100644 --- a/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs +++ b/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs @@ -8,7 +8,7 @@ namespace DownKyi.ViewModels.Friends { public class ViewFollowerViewModel : BaseViewModel { - public const string Tag = "PageFriendFollower"; + public const string Tag = "PageFriendsFollower"; #region 页面属性申明 diff --git a/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs index c65d387..5998adc 100644 --- a/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs +++ b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs @@ -9,7 +9,7 @@ namespace DownKyi.ViewModels.Friends { public class ViewFollowingViewModel : BaseViewModel { - public const string Tag = "PageFriendFollowing"; + public const string Tag = "PageFriendsFollowing"; public ViewFollowingViewModel(IEventAggregator eventAggregator) : base(eventAggregator) { From 4b36040f39cf27db30b15d8a5ad198c98226b33d Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sun, 23 Oct 2022 11:03:53 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E7=BA=A0=E6=AD=A3=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=85=B3=E6=B3=A8=E5=92=8C=E7=B2=89=E4=B8=9D=E7=9A=84=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Users/Models/RelationFollowInfo.cs | 2 + .../Friends/ViewFollowerViewModel.cs | 64 +------------ .../Friends/ViewFollowingViewModel.cs | 93 ++++++++++++++++++- DownKyi/ViewModels/ViewFriendsViewModel.cs | 4 +- DownKyi/Views/Friends/ViewFollower.xaml | 43 +-------- DownKyi/Views/Friends/ViewFollowing.xaml | 48 +++++++++- 6 files changed, 140 insertions(+), 114 deletions(-) diff --git a/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs b/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs index 0548df8..23710c2 100644 --- a/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs +++ b/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs @@ -23,7 +23,9 @@ namespace DownKyi.Core.BiliApi.Users.Models public string Face { get; set; } [JsonProperty("sign")] public string Sign { get; set; } + // face_nft // official_verify // vip + // nft_icon } } diff --git a/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs b/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs index b344def..2e337a9 100644 --- a/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs +++ b/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs @@ -1,8 +1,4 @@ -using DownKyi.ViewModels.PageViewModels; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System.Collections.ObjectModel; +using Prism.Events; namespace DownKyi.ViewModels.Friends { @@ -12,76 +8,18 @@ namespace DownKyi.ViewModels.Friends #region 页面属性申明 - private ObservableCollection tabHeaders; - public ObservableCollection TabHeaders - { - get => tabHeaders; - set => SetProperty(ref tabHeaders, value); - } - - private int selectTabId; - public int SelectTabId - { - get => selectTabId; - set => SetProperty(ref selectTabId, value); - } - #endregion public ViewFollowerViewModel(IEventAggregator eventAggregator) : base(eventAggregator) { #region 属性初始化 - TabHeaders = new ObservableCollection(); - - int i = TabHeaders.Count; #endregion } #region 命令申明 - // 左侧tab点击事件 - private DelegateCommand leftTabHeadersCommand; - public DelegateCommand LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand(ExecuteLeftTabHeadersCommand)); - - /// - /// 左侧tab点击事件 - /// - /// - private void ExecuteLeftTabHeadersCommand(object parameter) - { - if (!(parameter is TabHeader tabHeader)) { return; } - - //NavigationParameters param = new NavigationParameters(); - - //switch (tabHeader.Id) - //{ - // case 0: - // regionManager.RequestNavigate("ToolboxContentRegion", ViewBiliHelperViewModel.Tag, param); - // break; - // case 1: - // regionManager.RequestNavigate("ToolboxContentRegion", ViewDelogoViewModel.Tag, param); - // break; - // case 2: - // regionManager.RequestNavigate("ToolboxContentRegion", ViewExtractMediaViewModel.Tag, param); - // break; - //} - } - #endregion - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - // 进入设置页面时显示的设置项 - SelectTabId = 0; - - } - } } diff --git a/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs index 5998adc..a4c5b1b 100644 --- a/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs +++ b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs @@ -1,9 +1,12 @@ -using Prism.Events; -using System; +using DownKyi.Core.BiliApi.Users; +using DownKyi.Core.BiliApi.Users.Models; +using DownKyi.Utils; +using DownKyi.ViewModels.PageViewModels; +using Prism.Commands; +using Prism.Events; +using Prism.Regions; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.ObjectModel; namespace DownKyi.ViewModels.Friends { @@ -11,8 +14,88 @@ namespace DownKyi.ViewModels.Friends { public const string Tag = "PageFriendsFollowing"; + #region 页面属性申明 + + private ObservableCollection tabHeaders; + public ObservableCollection TabHeaders + { + get => tabHeaders; + set => SetProperty(ref tabHeaders, value); + } + + private int selectTabId; + public int SelectTabId + { + get => selectTabId; + set => SetProperty(ref selectTabId, value); + } + + #endregion + public ViewFollowingViewModel(IEventAggregator eventAggregator) : base(eventAggregator) { + #region 属性初始化 + List followingGroup = UserRelation.GetFollowingGroup(); + + TabHeaders = new ObservableCollection() + { + //new TabHeader{Id = 0, Title = DictionaryResource.GetString("FriendFollowing") }, + new TabHeader{Id = -1, Title = "全部关注" }, + new TabHeader{Id = -2, Title = "悄悄关注" }, + }; + + foreach (FollowingGroup tag in followingGroup) + { + TabHeaders.Add(new TabHeader { Id = tag.TagId, Title = tag.Name, SubTitle = tag.Count.ToString() }); + } + + #endregion } + + #region 命令申明 + + // 左侧tab点击事件 + private DelegateCommand leftTabHeadersCommand; + public DelegateCommand LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand(ExecuteLeftTabHeadersCommand)); + + /// + /// 左侧tab点击事件 + /// + /// + private void ExecuteLeftTabHeadersCommand(object parameter) + { + if (!(parameter is TabHeader tabHeader)) { return; } + + //NavigationParameters param = new NavigationParameters(); + + //switch (tabHeader.Id) + //{ + // case 0: + // regionManager.RequestNavigate("ToolboxContentRegion", ViewBiliHelperViewModel.Tag, param); + // break; + // case 1: + // regionManager.RequestNavigate("ToolboxContentRegion", ViewDelogoViewModel.Tag, param); + // break; + // case 2: + // regionManager.RequestNavigate("ToolboxContentRegion", ViewExtractMediaViewModel.Tag, param); + // break; + //} + } + + #endregion + + /// + /// 导航到页面时执行 + /// + /// + public override void OnNavigatedTo(NavigationContext navigationContext) + { + base.OnNavigatedTo(navigationContext); + + // 进入设置页面时显示的设置项 + SelectTabId = 0; + + } + } } diff --git a/DownKyi/ViewModels/ViewFriendsViewModel.cs b/DownKyi/ViewModels/ViewFriendsViewModel.cs index f1138f5..f949d7d 100644 --- a/DownKyi/ViewModels/ViewFriendsViewModel.cs +++ b/DownKyi/ViewModels/ViewFriendsViewModel.cs @@ -117,10 +117,10 @@ namespace DownKyi.ViewModels switch (id) { case 0: - regionManager.RequestNavigate("FriendContentRegion", ViewFollowerViewModel.Tag, param); + regionManager.RequestNavigate("FriendContentRegion", ViewFollowingViewModel.Tag, param); break; case 1: - regionManager.RequestNavigate("FriendContentRegion", ViewFollowingViewModel.Tag, param); + regionManager.RequestNavigate("FriendContentRegion", ViewFollowerViewModel.Tag, param); break; } } diff --git a/DownKyi/Views/Friends/ViewFollower.xaml b/DownKyi/Views/Friends/ViewFollower.xaml index 52309c1..b426740 100644 --- a/DownKyi/Views/Friends/ViewFollower.xaml +++ b/DownKyi/Views/Friends/ViewFollower.xaml @@ -12,47 +12,6 @@ - - - - - - - - - - - - - - - - - - - - + diff --git a/DownKyi/Views/Friends/ViewFollowing.xaml b/DownKyi/Views/Friends/ViewFollowing.xaml index de15d36..a58b943 100644 --- a/DownKyi/Views/Friends/ViewFollowing.xaml +++ b/DownKyi/Views/Friends/ViewFollowing.xaml @@ -2,13 +2,57 @@ 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"> - + + + - + + + + + + + + + + + + + + + + + + + + From 84c3403a942df8ff51302dad14daa9e56f1f741b Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Fri, 4 Nov 2022 16:07:54 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E5=AE=8C=E6=88=90PageFriendsFollowing?= =?UTF-8?q?=E7=9A=84=E5=B7=A6=E4=BE=A7table=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi/Languages/Default.xaml | 3 + .../Friends/ViewFollowingViewModel.cs | 72 +++++++++++++++---- DownKyi/ViewModels/ViewFriendsViewModel.cs | 11 ++- 3 files changed, 69 insertions(+), 17 deletions(-) diff --git a/DownKyi/Languages/Default.xaml b/DownKyi/Languages/Default.xaml index cc01956..5cf084b 100644 --- a/DownKyi/Languages/Default.xaml +++ b/DownKyi/Languages/Default.xaml @@ -102,6 +102,9 @@ 关注 粉丝 + 全部关注 + 悄悄关注 + 复制封面图片 复制封面URL diff --git a/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs index a4c5b1b..0ccd04c 100644 --- a/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs +++ b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs @@ -7,6 +7,7 @@ using Prism.Events; using Prism.Regions; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Threading.Tasks; namespace DownKyi.ViewModels.Friends { @@ -14,6 +15,9 @@ namespace DownKyi.ViewModels.Friends { public const string Tag = "PageFriendsFollowing"; + // mid + private long mid = -1; + #region 页面属性申明 private ObservableCollection tabHeaders; @@ -35,19 +39,8 @@ namespace DownKyi.ViewModels.Friends public ViewFollowingViewModel(IEventAggregator eventAggregator) : base(eventAggregator) { #region 属性初始化 - List followingGroup = UserRelation.GetFollowingGroup(); - - TabHeaders = new ObservableCollection() - { - //new TabHeader{Id = 0, Title = DictionaryResource.GetString("FriendFollowing") }, - new TabHeader{Id = -1, Title = "全部关注" }, - new TabHeader{Id = -2, Title = "悄悄关注" }, - }; - foreach (FollowingGroup tag in followingGroup) - { - TabHeaders.Add(new TabHeader { Id = tag.TagId, Title = tag.Name, SubTitle = tag.Count.ToString() }); - } + TabHeaders = new ObservableCollection(); #endregion } @@ -84,6 +77,40 @@ namespace DownKyi.ViewModels.Friends #endregion + /// + /// 初始化左侧列表 + /// + private async void InitLeftTable() + { + TabHeaders.Clear(); + + // 用户的关系状态数 + 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 = 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() }); + } + } + } + /// /// 导航到页面时执行 /// @@ -92,9 +119,26 @@ namespace DownKyi.ViewModels.Friends { base.OnNavigatedTo(navigationContext); - // 进入设置页面时显示的设置项 - SelectTabId = 0; + // 传入mid + long parameter = navigationContext.Parameters.GetValue("mid"); + if (parameter == 0) + { + return; + } + mid = parameter; + // 是否是从PageFriends的headerTable的item点击进入的 + // true表示加载PageFriends后第一次进入此页面 + // false表示从headerTable的item点击进入的 + bool isFirst = navigationContext.Parameters.GetValue("isFirst"); + if (isFirst) + { + // 初始化左侧列表 + InitLeftTable(); + + // 进入页面时显示的设置项 + SelectTabId = 0; + } } } diff --git a/DownKyi/ViewModels/ViewFriendsViewModel.cs b/DownKyi/ViewModels/ViewFriendsViewModel.cs index f949d7d..580f7d0 100644 --- a/DownKyi/ViewModels/ViewFriendsViewModel.cs +++ b/DownKyi/ViewModels/ViewFriendsViewModel.cs @@ -98,7 +98,7 @@ namespace DownKyi.ViewModels { if (!(parameter is TabHeader tabHeader)) { return; } - NavigationView(tabHeader.Id); + NavigationView(tabHeader.Id, false); } #endregion @@ -107,11 +107,16 @@ namespace DownKyi.ViewModels /// 进入子页面 /// /// - private void NavigationView(int id) + /// + 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) @@ -145,7 +150,7 @@ namespace DownKyi.ViewModels mid = (long)parameter["mid"]; SelectTabId = (int)parameter["friendId"]; - NavigationView(SelectTabId); + NavigationView(SelectTabId, true); } } From 4188daca72df815822fb0cdae164951d1e90857d Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sat, 5 Nov 2022 19:29:00 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi/ViewModels/ViewChannelViewModel.cs | 2 -- DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs | 2 -- DownKyi/ViewModels/ViewMyFavoritesViewModel.cs | 3 +-- DownKyi/ViewModels/ViewMyHistoryViewModel.cs | 2 -- DownKyi/ViewModels/ViewMyToViewVideoViewModel.cs | 2 -- DownKyi/ViewModels/ViewPublicFavoritesViewModel.cs | 2 -- DownKyi/ViewModels/ViewPublicationViewModel.cs | 2 -- DownKyi/ViewModels/ViewSeasonsSeriesViewModel.cs | 2 -- 8 files changed, 1 insertion(+), 16 deletions(-) diff --git a/DownKyi/ViewModels/ViewChannelViewModel.cs b/DownKyi/ViewModels/ViewChannelViewModel.cs index 35609fd..ff98f53 100644 --- a/DownKyi/ViewModels/ViewChannelViewModel.cs +++ b/DownKyi/ViewModels/ViewChannelViewModel.cs @@ -28,8 +28,6 @@ namespace DownKyi.ViewModels { public const string Tag = "PageChannel"; - private readonly IDialogService dialogService; - private CancellationTokenSource tokenSource; private long mid = -1; diff --git a/DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs b/DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs index 44da8e0..1a16f8f 100644 --- a/DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs +++ b/DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs @@ -27,8 +27,6 @@ namespace DownKyi.ViewModels { public const string Tag = "PageMyBangumiFollow"; - private readonly IDialogService dialogService; - private CancellationTokenSource tokenSource; private long mid = -1; diff --git a/DownKyi/ViewModels/ViewMyFavoritesViewModel.cs b/DownKyi/ViewModels/ViewMyFavoritesViewModel.cs index 770e855..b4799bb 100644 --- a/DownKyi/ViewModels/ViewMyFavoritesViewModel.cs +++ b/DownKyi/ViewModels/ViewMyFavoritesViewModel.cs @@ -26,7 +26,7 @@ namespace DownKyi.ViewModels { public const string Tag = "PageMyFavorites"; - private readonly IDialogService dialogService; + //private readonly IDialogService dialogService; private CancellationTokenSource tokenSource1; private CancellationTokenSource tokenSource2; @@ -87,7 +87,6 @@ namespace DownKyi.ViewModels set => SetProperty(ref mediaContentVisibility, value); } - private Visibility mediaLoadingVisibility; public Visibility MediaLoadingVisibility { diff --git a/DownKyi/ViewModels/ViewMyHistoryViewModel.cs b/DownKyi/ViewModels/ViewMyHistoryViewModel.cs index cee0b01..cbb8f7b 100644 --- a/DownKyi/ViewModels/ViewMyHistoryViewModel.cs +++ b/DownKyi/ViewModels/ViewMyHistoryViewModel.cs @@ -28,8 +28,6 @@ namespace DownKyi.ViewModels { public const string Tag = "PageMyHistory"; - private readonly IDialogService dialogService; - private CancellationTokenSource tokenSource; // 每页视频数量,暂时在此写死,以后在设置中增加选项 diff --git a/DownKyi/ViewModels/ViewMyToViewVideoViewModel.cs b/DownKyi/ViewModels/ViewMyToViewVideoViewModel.cs index 1eceb36..34d3f54 100644 --- a/DownKyi/ViewModels/ViewMyToViewVideoViewModel.cs +++ b/DownKyi/ViewModels/ViewMyToViewVideoViewModel.cs @@ -27,8 +27,6 @@ namespace DownKyi.ViewModels { public const string Tag = "PageMyToView"; - private readonly IDialogService dialogService; - private CancellationTokenSource tokenSource; #region 页面属性申明 diff --git a/DownKyi/ViewModels/ViewPublicFavoritesViewModel.cs b/DownKyi/ViewModels/ViewPublicFavoritesViewModel.cs index 98f2457..98e9e29 100644 --- a/DownKyi/ViewModels/ViewPublicFavoritesViewModel.cs +++ b/DownKyi/ViewModels/ViewPublicFavoritesViewModel.cs @@ -26,8 +26,6 @@ namespace DownKyi.ViewModels { public const string Tag = "PagePublicFavorites"; - private readonly IDialogService dialogService; - private CancellationTokenSource tokenSource; #region 页面属性申明 diff --git a/DownKyi/ViewModels/ViewPublicationViewModel.cs b/DownKyi/ViewModels/ViewPublicationViewModel.cs index 2c7c4d0..19b5c96 100644 --- a/DownKyi/ViewModels/ViewPublicationViewModel.cs +++ b/DownKyi/ViewModels/ViewPublicationViewModel.cs @@ -29,8 +29,6 @@ namespace DownKyi.ViewModels { public const string Tag = "PagePublication"; - private readonly IDialogService dialogService; - private CancellationTokenSource tokenSource; private long mid = -1; diff --git a/DownKyi/ViewModels/ViewSeasonsSeriesViewModel.cs b/DownKyi/ViewModels/ViewSeasonsSeriesViewModel.cs index 0c4377f..c559f3a 100644 --- a/DownKyi/ViewModels/ViewSeasonsSeriesViewModel.cs +++ b/DownKyi/ViewModels/ViewSeasonsSeriesViewModel.cs @@ -28,8 +28,6 @@ namespace DownKyi.ViewModels { public const string Tag = "PageSeasonsSeries"; - private readonly IDialogService dialogService; - private CancellationTokenSource tokenSource; private long mid = -1; From 60813ce903f2d0539277df03244747e67396c15a Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sat, 5 Nov 2022 19:59:49 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BiliApi/Users/Models/RelationWhisper.cs | 9 +- DownKyi.Core/BiliApi/Users/UserRelation.cs | 4 +- DownKyi/CustomControl/CustomPagerViewModel.cs | 5 +- DownKyi/DownKyi.csproj | 1 + DownKyi/Languages/Default.xaml | 1 + DownKyi/ViewModels/BaseViewModel.cs | 2 +- .../Friends/ViewFollowingViewModel.cs | 328 ++++++++++++++++-- .../ViewModels/PageViewModels/FriendInfo.cs | 65 ++++ DownKyi/ViewModels/ViewFriendsViewModel.cs | 4 +- DownKyi/ViewModels/ViewUserSpaceViewModel.cs | 14 +- DownKyi/Views/Friends/ViewFollowing.xaml | 253 +++++++++++--- 11 files changed, 606 insertions(+), 80 deletions(-) create mode 100644 DownKyi/ViewModels/PageViewModels/FriendInfo.cs diff --git a/DownKyi.Core/BiliApi/Users/Models/RelationWhisper.cs b/DownKyi.Core/BiliApi/Users/Models/RelationWhisper.cs index 19e1b4d..9bab5a8 100644 --- a/DownKyi.Core/BiliApi/Users/Models/RelationWhisper.cs +++ b/DownKyi.Core/BiliApi/Users/Models/RelationWhisper.cs @@ -8,7 +8,14 @@ namespace DownKyi.Core.BiliApi.Users.Models public class RelationWhisper : BaseModel { [JsonProperty("data")] - public List Data { get; set; } + public RelationWhisperData Data { get; set; } + } + + public class RelationWhisperData : BaseModel + { + [JsonProperty("list")] + public List List { get; set; } + // re_version } } diff --git a/DownKyi.Core/BiliApi/Users/UserRelation.cs b/DownKyi.Core/BiliApi/Users/UserRelation.cs index d6c4c96..63c6a86 100644 --- a/DownKyi.Core/BiliApi/Users/UserRelation.cs +++ b/DownKyi.Core/BiliApi/Users/UserRelation.cs @@ -139,8 +139,8 @@ namespace DownKyi.Core.BiliApi.Users try { RelationWhisper relationWhisper = JsonConvert.DeserializeObject(response); - if (relationWhisper == null || relationWhisper.Data == null) { return null; } - return relationWhisper.Data; + if (relationWhisper == null || relationWhisper.Data == null || relationWhisper.Data.List == null) { return null; } + return relationWhisper.Data.List; } catch (Exception e) { diff --git a/DownKyi/CustomControl/CustomPagerViewModel.cs b/DownKyi/CustomControl/CustomPagerViewModel.cs index 5a6ed4c..363b962 100644 --- a/DownKyi/CustomControl/CustomPagerViewModel.cs +++ b/DownKyi/CustomControl/CustomPagerViewModel.cs @@ -60,8 +60,9 @@ namespace DownKyi.CustomControl } set { - if (value < Current || value < 1) + if (value < Current || value < 0) { + Visibility = Visibility.Hidden; //throw new Exception("数值不在允许的范围内。"); System.Console.WriteLine(value.ToString()); } @@ -69,7 +70,7 @@ namespace DownKyi.CustomControl { count = value; - if (count == 1) { Visibility = Visibility.Hidden; } + if (count <= 1) { Visibility = Visibility.Hidden; } else { Visibility = Visibility.Visible; } OnCountChanged(count); diff --git a/DownKyi/DownKyi.csproj b/DownKyi/DownKyi.csproj index 35c0390..f54d5ee 100644 --- a/DownKyi/DownKyi.csproj +++ b/DownKyi/DownKyi.csproj @@ -129,6 +129,7 @@ + diff --git a/DownKyi/Languages/Default.xaml b/DownKyi/Languages/Default.xaml index 5cf084b..92c6e85 100644 --- a/DownKyi/Languages/Default.xaml +++ b/DownKyi/Languages/Default.xaml @@ -102,6 +102,7 @@ 关注 粉丝 + 请稍等,马上就好~ 全部关注 悄悄关注 diff --git a/DownKyi/ViewModels/BaseViewModel.cs b/DownKyi/ViewModels/BaseViewModel.cs index 89d5852..b8a3081 100644 --- a/DownKyi/ViewModels/BaseViewModel.cs +++ b/DownKyi/ViewModels/BaseViewModel.cs @@ -10,7 +10,7 @@ namespace DownKyi.ViewModels public class BaseViewModel : BindableBase, INavigationAware { protected readonly IEventAggregator eventAggregator; - protected readonly IDialogService dialogService; + protected IDialogService dialogService; protected string ParentView = string.Empty; public BaseViewModel(IEventAggregator eventAggregator) diff --git a/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs index 0ccd04c..0cec046 100644 --- a/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs +++ b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs @@ -1,13 +1,20 @@ 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 { @@ -18,8 +25,74 @@ namespace DownKyi.ViewModels.Friends // 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 tabHeaders; public ObservableCollection TabHeaders { @@ -34,13 +107,46 @@ namespace DownKyi.ViewModels.Friends 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 contents; + public ObservableCollection 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(); + Contents = new ObservableCollection(); #endregion } @@ -49,7 +155,7 @@ namespace DownKyi.ViewModels.Friends // 左侧tab点击事件 private DelegateCommand leftTabHeadersCommand; - public DelegateCommand LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand(ExecuteLeftTabHeadersCommand)); + public DelegateCommand LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand(ExecuteLeftTabHeadersCommand, CanExecuteLeftTabHeadersCommand)); /// /// 左侧tab点击事件 @@ -59,24 +165,42 @@ namespace DownKyi.ViewModels.Friends { if (!(parameter is TabHeader tabHeader)) { return; } - //NavigationParameters param = new NavigationParameters(); + // 页面选择 + Pager = new CustomPagerViewModel(1, (int)Math.Ceiling(double.Parse(tabHeader.SubTitle) / NumberInPage)); + Pager.CurrentChanged += OnCurrentChanged_Pager; + Pager.CountChanged += OnCountChanged_Pager; + Pager.Current = 1; + } - //switch (tabHeader.Id) - //{ - // case 0: - // regionManager.RequestNavigate("ToolboxContentRegion", ViewBiliHelperViewModel.Tag, param); - // break; - // case 1: - // regionManager.RequestNavigate("ToolboxContentRegion", ViewDelogoViewModel.Tag, param); - // break; - // case 2: - // regionManager.RequestNavigate("ToolboxContentRegion", ViewExtractMediaViewModel.Tag, param); - // break; - //} + /// + /// 左侧tab点击事件是否允许执行 + /// + /// + /// + private bool CanExecuteLeftTabHeadersCommand(object parameter) + { + return IsEnabled; } #endregion + /// + /// 初始化页面数据 + /// + 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; + } + /// /// 初始化左侧列表 /// @@ -84,31 +208,174 @@ namespace DownKyi.ViewModels.Friends { TabHeaders.Clear(); - // 用户的关系状态数 - UserRelationStat relationStat = null; + 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 = 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 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 LoadAllFollowings(int pn, int ps) + { + List contents = null; await Task.Run(() => { - relationStat = UserStatus.GetUserRelationStat(mid); + 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 (relationStat != null) + + if (contents == null) { return false; } + return true; + } + + private async Task LoadWhispers(int pn, int ps) + { + List contents = null; + await Task.Run(() => { - 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() }); - } + contents = UserRelation.GetWhispers(pn, ps); + if (contents == null) { return; } - // 用户的关注分组 - List followingGroup = null; + LoadContent(contents); + }); + + if (contents == null) { return false; } + return true; + } + + private async Task LoadFollowingGroupContent(int tagId, int pn, int ps) + { + List contents = null; await Task.Run(() => { - followingGroup = UserRelation.GetFollowingGroup(); + contents = UserRelation.GetFollowingGroupContent(tagId, pn, ps); + if (contents == null) { return; } + + LoadContent(contents); }); - if (followingGroup != null) + + 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) { - foreach (FollowingGroup tag in followingGroup) - { - TabHeaders.Add(new TabHeader { Id = tag.TagId, Title = tag.Name, SubTitle = tag.Count.ToString() }); - } + 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; } /// @@ -133,11 +400,14 @@ namespace DownKyi.ViewModels.Friends bool isFirst = navigationContext.Parameters.GetValue("isFirst"); if (isFirst) { + InitView(); + // 初始化左侧列表 InitLeftTable(); // 进入页面时显示的设置项 SelectTabId = 0; + } } diff --git a/DownKyi/ViewModels/PageViewModels/FriendInfo.cs b/DownKyi/ViewModels/PageViewModels/FriendInfo.cs new file mode 100644 index 0000000..f4ace41 --- /dev/null +++ b/DownKyi/ViewModels/PageViewModels/FriendInfo.cs @@ -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 userCommand; + public DelegateCommand UserCommand => userCommand ?? (userCommand = new DelegateCommand(ExecuteUserCommand)); + + /// + /// 视频标题点击事件 + /// + /// + private void ExecuteUserCommand(object parameter) + { + if (!(parameter is string tag)) { return; } + + NavigateToView.NavigationView(eventAggregator, ViewUserSpaceViewModel.Tag, tag, Mid); + } + + #endregion + } +} diff --git a/DownKyi/ViewModels/ViewFriendsViewModel.cs b/DownKyi/ViewModels/ViewFriendsViewModel.cs index 580f7d0..bc3d683 100644 --- a/DownKyi/ViewModels/ViewFriendsViewModel.cs +++ b/DownKyi/ViewModels/ViewFriendsViewModel.cs @@ -98,7 +98,9 @@ namespace DownKyi.ViewModels { if (!(parameter is TabHeader tabHeader)) { return; } - NavigationView(tabHeader.Id, false); + // TODO + // 此处应该根据具体状态传入true or false + NavigationView(tabHeader.Id, true); } #endregion diff --git a/DownKyi/ViewModels/ViewUserSpaceViewModel.cs b/DownKyi/ViewModels/ViewUserSpaceViewModel.cs index feb0cea..24994ec 100644 --- a/DownKyi/ViewModels/ViewUserSpaceViewModel.cs +++ b/DownKyi/ViewModels/ViewUserSpaceViewModel.cs @@ -257,15 +257,25 @@ namespace DownKyi.ViewModels { "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, Tag, data); + NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, parentViewName, data); break; case 1: data["friendId"] = 1; - NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, Tag, data); + NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, parentViewName, data); break; } diff --git a/DownKyi/Views/Friends/ViewFollowing.xaml b/DownKyi/Views/Friends/ViewFollowing.xaml index a58b943..846df92 100644 --- a/DownKyi/Views/Friends/ViewFollowing.xaml +++ b/DownKyi/Views/Friends/ViewFollowing.xaml @@ -9,50 +9,219 @@ prism:ViewModelLocator.AutoWireViewModel="True"> + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 05b678e2b898298a6d1b2b9798905b3c95b72d9f Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sat, 5 Nov 2022 21:30:47 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=B2=89=E4=B8=9D?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi/CustomControl/CustomPager.xaml | 8 +- DownKyi/Languages/Default.xaml | 2 + .../Friends/ViewFollowerViewModel.cs | 216 +++++++++++++++++- DownKyi/Views/Friends/ViewFollower.xaml | 140 +++++++++++- DownKyi/Views/Friends/ViewFollowing.xaml | 1 - 5 files changed, 362 insertions(+), 5 deletions(-) diff --git a/DownKyi/CustomControl/CustomPager.xaml b/DownKyi/CustomControl/CustomPager.xaml index 499752c..2b512f2 100644 --- a/DownKyi/CustomControl/CustomPager.xaml +++ b/DownKyi/CustomControl/CustomPager.xaml @@ -72,7 +72,7 @@ - + @@ -136,6 +136,7 @@ Style="{StaticResource pagerButton}" Visibility="{Binding FirstVisibility}"> 粉丝 请稍等,马上就好~ + 请稍等,马上就好~ + 全部关注 悄悄关注 diff --git a/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs b/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs index 2e337a9..5e91eaa 100644 --- a/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs +++ b/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs @@ -1,4 +1,18 @@ -using Prism.Events; +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 { @@ -6,14 +20,79 @@ namespace DownKyi.ViewModels.Friends { 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 contents; + public ObservableCollection 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(); + #endregion } @@ -21,5 +100,140 @@ namespace DownKyi.ViewModels.Friends #endregion + private void LoadContent(List 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 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; + } + + /// + /// 初始化页面数据 + /// + private void InitView() + { + ContentVisibility = Visibility.Collapsed; + LoadingVisibility = Visibility.Visible; + NoDataVisibility = Visibility.Collapsed; + + Contents.Clear(); + } + + /// + /// 导航到页面时执行 + /// + /// + public override void OnNavigatedTo(NavigationContext navigationContext) + { + base.OnNavigatedTo(navigationContext); + + // 传入mid + long parameter = navigationContext.Parameters.GetValue("mid"); + if (parameter == 0) + { + return; + } + mid = parameter; + + // 是否是从PageFriends的headerTable的item点击进入的 + // true表示加载PageFriends后第一次进入此页面 + // false表示从headerTable的item点击进入的 + bool isFirst = navigationContext.Parameters.GetValue("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; + } + } } } diff --git a/DownKyi/Views/Friends/ViewFollower.xaml b/DownKyi/Views/Friends/ViewFollower.xaml index b426740..d5b5a0d 100644 --- a/DownKyi/Views/Friends/ViewFollower.xaml +++ b/DownKyi/Views/Friends/ViewFollower.xaml @@ -8,10 +8,146 @@ xmlns:prism="http://prismlibrary.com/" prism:ViewModelLocator.AutoWireViewModel="True"> - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DownKyi/Views/Friends/ViewFollowing.xaml b/DownKyi/Views/Friends/ViewFollowing.xaml index 846df92..bec5253 100644 --- a/DownKyi/Views/Friends/ViewFollowing.xaml +++ b/DownKyi/Views/Friends/ViewFollowing.xaml @@ -11,7 +11,6 @@