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.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/App.xaml.cs b/DownKyi/App.xaml.cs index 732836d..a6ceda2 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.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(ViewPublicationViewModel.Tag); containerRegistry.RegisterForNavigation(ViewModels.ViewChannelViewModel.Tag); containerRegistry.RegisterForNavigation(ViewModels.ViewSeasonsSeriesViewModel.Tag); + containerRegistry.RegisterForNavigation(ViewFriendsViewModel.Tag); containerRegistry.RegisterForNavigation(ViewMySpaceViewModel.Tag); containerRegistry.RegisterForNavigation(ViewMyFavoritesViewModel.Tag); @@ -195,6 +198,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/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}"> + + + @@ -177,6 +180,7 @@ + @@ -208,6 +212,12 @@ ViewDownloading.xaml + + ViewFollower.xaml + + + ViewFollowing.xaml + ViewAbout.xaml @@ -253,6 +263,9 @@ ViewDownloadManager.xaml + + ViewFriends.xaml + ViewIndex.xaml @@ -380,6 +393,14 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -456,6 +477,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/DownKyi/Languages/Default.xaml b/DownKyi/Languages/Default.xaml index e0ced81..d7aff13 100644 --- a/DownKyi/Languages/Default.xaml +++ b/DownKyi/Languages/Default.xaml @@ -97,6 +97,17 @@ 下载全部 请稍等,马上就好~ + + 好友 + 关注 + 粉丝 + + 请稍等,马上就好~ + 请稍等,马上就好~ + + 全部关注 + 悄悄关注 + 复制封面图片 复制封面URL 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/ViewFollowerViewModel.cs b/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs new file mode 100644 index 0000000..5e91eaa --- /dev/null +++ b/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs @@ -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 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 + } + + #region 命令申明 + + #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/ViewModels/Friends/ViewFollowingViewModel.cs b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs new file mode 100644 index 0000000..0cec046 --- /dev/null +++ b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs @@ -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 tabHeaders; + public ObservableCollection 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 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 + } + + #region 命令申明 + + // 左侧tab点击事件 + private DelegateCommand leftTabHeadersCommand; + public DelegateCommand LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand(ExecuteLeftTabHeadersCommand, CanExecuteLeftTabHeadersCommand)); + + /// + /// 左侧tab点击事件 + /// + /// + 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; + } + + /// + /// 左侧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; + } + + /// + /// 初始化左侧列表 + /// + 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 = 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(() => + { + 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 LoadWhispers(int pn, int ps) + { + List 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 LoadFollowingGroupContent(int tagId, int pn, int ps) + { + List 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; + } + + /// + /// 导航到页面时执行 + /// + /// + 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(); + + // 初始化左侧列表 + 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/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/Settings/ViewAboutViewModel.cs b/DownKyi/ViewModels/Settings/ViewAboutViewModel.cs index 1d3fdb9..0cdf35b 100644 --- a/DownKyi/ViewModels/Settings/ViewAboutViewModel.cs +++ b/DownKyi/ViewModels/Settings/ViewAboutViewModel.cs @@ -60,7 +60,7 @@ namespace DownKyi.ViewModels.Settings } /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override void OnNavigatedTo(NavigationContext navigationContext) diff --git a/DownKyi/ViewModels/Settings/ViewBasicViewModel.cs b/DownKyi/ViewModels/Settings/ViewBasicViewModel.cs index eee40ca..3f2ce2b 100644 --- a/DownKyi/ViewModels/Settings/ViewBasicViewModel.cs +++ b/DownKyi/ViewModels/Settings/ViewBasicViewModel.cs @@ -95,7 +95,7 @@ namespace DownKyi.ViewModels.Settings } /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override void OnNavigatedTo(NavigationContext navigationContext) diff --git a/DownKyi/ViewModels/Settings/ViewDanmakuViewModel.cs b/DownKyi/ViewModels/Settings/ViewDanmakuViewModel.cs index cdc557b..659ead2 100644 --- a/DownKyi/ViewModels/Settings/ViewDanmakuViewModel.cs +++ b/DownKyi/ViewModels/Settings/ViewDanmakuViewModel.cs @@ -115,7 +115,7 @@ namespace DownKyi.ViewModels.Settings } /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override void OnNavigatedTo(NavigationContext navigationContext) diff --git a/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs b/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs index 3007a94..7bb76fb 100644 --- a/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs +++ b/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs @@ -246,7 +246,7 @@ namespace DownKyi.ViewModels.Settings } /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override void OnNavigatedTo(NavigationContext navigationContext) 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/ViewChannelViewModel.cs b/DownKyi/ViewModels/ViewChannelViewModel.cs index 8c1d0f1..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; @@ -434,7 +432,7 @@ namespace DownKyi.ViewModels } /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override void OnNavigatedTo(NavigationContext navigationContext) diff --git a/DownKyi/ViewModels/ViewDownloadManagerViewModel.cs b/DownKyi/ViewModels/ViewDownloadManagerViewModel.cs index 7e17995..ae3a7b3 100644 --- a/DownKyi/ViewModels/ViewDownloadManagerViewModel.cs +++ b/DownKyi/ViewModels/ViewDownloadManagerViewModel.cs @@ -109,7 +109,7 @@ namespace DownKyi.ViewModels #endregion /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override void OnNavigatedTo(NavigationContext navigationContext) diff --git a/DownKyi/ViewModels/ViewFriendsViewModel.cs b/DownKyi/ViewModels/ViewFriendsViewModel.cs new file mode 100644 index 0000000..bc3d683 --- /dev/null +++ b/DownKyi/ViewModels/ViewFriendsViewModel.cs @@ -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 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 ViewFriendsViewModel(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; } + + // TODO + // 此处应该根据具体状态传入true or false + NavigationView(tabHeader.Id, true); + } + + #endregion + + /// + /// 进入子页面 + /// + /// + /// + 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; + } + } + + /// + /// 导航到页面时执行 + /// + /// + 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, true); + } + + } +} diff --git a/DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs b/DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs index 60365f1..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; @@ -511,7 +509,7 @@ namespace DownKyi.ViewModels } /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override void OnNavigatedTo(NavigationContext navigationContext) diff --git a/DownKyi/ViewModels/ViewMyFavoritesViewModel.cs b/DownKyi/ViewModels/ViewMyFavoritesViewModel.cs index 1787e99..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 { @@ -477,7 +476,7 @@ namespace DownKyi.ViewModels } /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override async void OnNavigatedTo(NavigationContext navigationContext) diff --git a/DownKyi/ViewModels/ViewMyHistoryViewModel.cs b/DownKyi/ViewModels/ViewMyHistoryViewModel.cs index 6f9906a..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; // 每页视频数量,暂时在此写死,以后在设置中增加选项 @@ -504,7 +502,7 @@ namespace DownKyi.ViewModels } /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override void OnNavigatedTo(NavigationContext navigationContext) diff --git a/DownKyi/ViewModels/ViewMySpaceViewModel.cs b/DownKyi/ViewModels/ViewMySpaceViewModel.cs index 01a8d94..d057806 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, 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; diff --git a/DownKyi/ViewModels/ViewMyToViewVideoViewModel.cs b/DownKyi/ViewModels/ViewMyToViewVideoViewModel.cs index 1635bb9..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 页面属性申明 @@ -400,7 +398,7 @@ namespace DownKyi.ViewModels } /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override void OnNavigatedTo(NavigationContext navigationContext) 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 9b5f337..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; @@ -487,7 +485,7 @@ namespace DownKyi.ViewModels } /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override void OnNavigatedTo(NavigationContext navigationContext) 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; diff --git a/DownKyi/ViewModels/ViewSettingsViewModel.cs b/DownKyi/ViewModels/ViewSettingsViewModel.cs index 0d30ee8..882aea5 100644 --- a/DownKyi/ViewModels/ViewSettingsViewModel.cs +++ b/DownKyi/ViewModels/ViewSettingsViewModel.cs @@ -121,7 +121,7 @@ namespace DownKyi.ViewModels #endregion /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override void OnNavigatedTo(NavigationContext navigationContext) diff --git a/DownKyi/ViewModels/ViewToolboxViewModel.cs b/DownKyi/ViewModels/ViewToolboxViewModel.cs index e55da00..4e4ce6f 100644 --- a/DownKyi/ViewModels/ViewToolboxViewModel.cs +++ b/DownKyi/ViewModels/ViewToolboxViewModel.cs @@ -112,7 +112,7 @@ namespace DownKyi.ViewModels #endregion /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override void OnNavigatedTo(NavigationContext navigationContext) diff --git a/DownKyi/ViewModels/ViewUserSpaceViewModel.cs b/DownKyi/ViewModels/ViewUserSpaceViewModel.cs index 764cd38..24994ec 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) @@ -232,6 +240,48 @@ 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 } + }; + + 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 /// @@ -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"), diff --git a/DownKyi/ViewModels/ViewVideoDetailViewModel.cs b/DownKyi/ViewModels/ViewVideoDetailViewModel.cs index b5c170f..5d7551b 100644 --- a/DownKyi/ViewModels/ViewVideoDetailViewModel.cs +++ b/DownKyi/ViewModels/ViewVideoDetailViewModel.cs @@ -739,7 +739,7 @@ namespace DownKyi.ViewModels #endregion /// - /// 导航到VideoDetail页面时执行 + /// 导航到页面时执行 /// /// public override void OnNavigatedTo(NavigationContext navigationContext) diff --git a/DownKyi/Views/Friends/ViewFollower.xaml b/DownKyi/Views/Friends/ViewFollower.xaml new file mode 100644 index 0000000..d5b5a0d --- /dev/null +++ b/DownKyi/Views/Friends/ViewFollower.xaml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DownKyi/Views/Friends/ViewFollower.xaml.cs b/DownKyi/Views/Friends/ViewFollower.xaml.cs new file mode 100644 index 0000000..85feb28 --- /dev/null +++ b/DownKyi/Views/Friends/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.Friends +{ + /// + /// ViewFollower.xaml 的交互逻辑 + /// + public partial class ViewFollower : UserControl + { + public ViewFollower() + { + InitializeComponent(); + } + } +} diff --git a/DownKyi/Views/Friends/ViewFollowing.xaml b/DownKyi/Views/Friends/ViewFollowing.xaml new file mode 100644 index 0000000..bec5253 --- /dev/null +++ b/DownKyi/Views/Friends/ViewFollowing.xaml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DownKyi/Views/Friends/ViewFollowing.xaml.cs b/DownKyi/Views/Friends/ViewFollowing.xaml.cs new file mode 100644 index 0000000..340a192 --- /dev/null +++ b/DownKyi/Views/Friends/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.Friends +{ + /// + /// ViewFollowing.xaml 的交互逻辑 + /// + public partial class ViewFollowing : UserControl + { + public ViewFollowing() + { + InitializeComponent(); + } + } +} diff --git a/DownKyi/Views/ViewFriends.xaml b/DownKyi/Views/ViewFriends.xaml new file mode 100644 index 0000000..d9ed296 --- /dev/null +++ b/DownKyi/Views/ViewFriends.xaml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DownKyi/Views/ViewFriends.xaml.cs b/DownKyi/Views/ViewFriends.xaml.cs new file mode 100644 index 0000000..8332b78 --- /dev/null +++ b/DownKyi/Views/ViewFriends.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 ViewFriends : UserControl + { + public ViewFriends() + { + 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}"> + + + + +