好友页面框架搭建

croire 3 years ago
parent 440ebff101
commit 7253a0ee12

@ -4,12 +4,14 @@ using DownKyi.Utils;
using DownKyi.ViewModels; using DownKyi.ViewModels;
using DownKyi.ViewModels.Dialogs; using DownKyi.ViewModels.Dialogs;
using DownKyi.ViewModels.DownloadManager; using DownKyi.ViewModels.DownloadManager;
using DownKyi.ViewModels.Friend;
using DownKyi.ViewModels.Settings; using DownKyi.ViewModels.Settings;
using DownKyi.ViewModels.Toolbox; using DownKyi.ViewModels.Toolbox;
using DownKyi.ViewModels.UserSpace; using DownKyi.ViewModels.UserSpace;
using DownKyi.Views; using DownKyi.Views;
using DownKyi.Views.Dialogs; using DownKyi.Views.Dialogs;
using DownKyi.Views.DownloadManager; using DownKyi.Views.DownloadManager;
using DownKyi.Views.Friend;
using DownKyi.Views.Settings; using DownKyi.Views.Settings;
using DownKyi.Views.Toolbox; using DownKyi.Views.Toolbox;
using DownKyi.Views.UserSpace; using DownKyi.Views.UserSpace;
@ -166,6 +168,7 @@ namespace DownKyi
containerRegistry.RegisterForNavigation<ViewUserSpace>(ViewUserSpaceViewModel.Tag); containerRegistry.RegisterForNavigation<ViewUserSpace>(ViewUserSpaceViewModel.Tag);
containerRegistry.RegisterForNavigation<ViewPublication>(ViewPublicationViewModel.Tag); containerRegistry.RegisterForNavigation<ViewPublication>(ViewPublicationViewModel.Tag);
containerRegistry.RegisterForNavigation<Views.ViewChannel>(ViewModels.ViewChannelViewModel.Tag); containerRegistry.RegisterForNavigation<Views.ViewChannel>(ViewModels.ViewChannelViewModel.Tag);
containerRegistry.RegisterForNavigation<ViewFriend>(ViewFriendViewModel.Tag);
containerRegistry.RegisterForNavigation<ViewMySpace>(ViewMySpaceViewModel.Tag); containerRegistry.RegisterForNavigation<ViewMySpace>(ViewMySpaceViewModel.Tag);
containerRegistry.RegisterForNavigation<ViewMyFavorites>(ViewMyFavoritesViewModel.Tag); containerRegistry.RegisterForNavigation<ViewMyFavorites>(ViewMyFavoritesViewModel.Tag);
@ -177,6 +180,10 @@ namespace DownKyi
containerRegistry.RegisterForNavigation<ViewDownloading>(ViewDownloadingViewModel.Tag); containerRegistry.RegisterForNavigation<ViewDownloading>(ViewDownloadingViewModel.Tag);
containerRegistry.RegisterForNavigation<ViewDownloadFinished>(ViewDownloadFinishedViewModel.Tag); containerRegistry.RegisterForNavigation<ViewDownloadFinished>(ViewDownloadFinishedViewModel.Tag);
// Friend
containerRegistry.RegisterForNavigation<ViewFollowing>(ViewFollowingViewModel.Tag);
containerRegistry.RegisterForNavigation<ViewFollower>(ViewFollowerViewModel.Tag);
// settings pages // settings pages
containerRegistry.RegisterForNavigation<ViewBasic>(ViewBasicViewModel.Tag); containerRegistry.RegisterForNavigation<ViewBasic>(ViewBasicViewModel.Tag);
containerRegistry.RegisterForNavigation<ViewNetwork>(ViewNetworkViewModel.Tag); containerRegistry.RegisterForNavigation<ViewNetwork>(ViewNetworkViewModel.Tag);

@ -100,6 +100,8 @@
<Compile Include="Services\Download\AddToDownloadService.cs" /> <Compile Include="Services\Download\AddToDownloadService.cs" />
<Compile Include="Services\Download\DownloadStorageService.cs" /> <Compile Include="Services\Download\DownloadStorageService.cs" />
<Compile Include="Services\SearchService.cs" /> <Compile Include="Services\SearchService.cs" />
<Compile Include="ViewModels\Friend\ViewFollowerViewModel.cs" />
<Compile Include="ViewModels\Friend\ViewFollowingViewModel.cs" />
<Compile Include="ViewModels\PageViewModels\BangumiFollowMedia.cs" /> <Compile Include="ViewModels\PageViewModels\BangumiFollowMedia.cs" />
<Compile Include="ViewModels\PageViewModels\Favorites.cs" /> <Compile Include="ViewModels\PageViewModels\Favorites.cs" />
<Compile Include="ViewModels\PageViewModels\FavoritesMedia.cs" /> <Compile Include="ViewModels\PageViewModels\FavoritesMedia.cs" />
@ -151,6 +153,7 @@
<Compile Include="ViewModels\ViewChannelViewModel.cs" /> <Compile Include="ViewModels\ViewChannelViewModel.cs" />
<Compile Include="ViewModels\ViewDownloadManagerViewModel.cs" /> <Compile Include="ViewModels\ViewDownloadManagerViewModel.cs" />
<Compile Include="ViewModels\Toolbox\ViewExtractMediaViewModel.cs" /> <Compile Include="ViewModels\Toolbox\ViewExtractMediaViewModel.cs" />
<Compile Include="ViewModels\ViewFriendViewModel.cs" />
<Compile Include="ViewModels\ViewIndexViewModel.cs" /> <Compile Include="ViewModels\ViewIndexViewModel.cs" />
<Compile Include="ViewModels\ViewLoginViewModel.cs" /> <Compile Include="ViewModels\ViewLoginViewModel.cs" />
<Compile Include="ViewModels\Settings\ViewNetworkViewModel.cs" /> <Compile Include="ViewModels\Settings\ViewNetworkViewModel.cs" />
@ -179,6 +182,12 @@
<Compile Include="Views\DownloadManager\ViewDownloading.xaml.cs"> <Compile Include="Views\DownloadManager\ViewDownloading.xaml.cs">
<DependentUpon>ViewDownloading.xaml</DependentUpon> <DependentUpon>ViewDownloading.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\Friend\ViewFollower.xaml.cs">
<DependentUpon>ViewFollower.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Friend\ViewFollowing.xaml.cs">
<DependentUpon>ViewFollowing.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Settings\ViewAbout.xaml.cs"> <Compile Include="Views\Settings\ViewAbout.xaml.cs">
<DependentUpon>ViewAbout.xaml</DependentUpon> <DependentUpon>ViewAbout.xaml</DependentUpon>
</Compile> </Compile>
@ -218,6 +227,9 @@
<Compile Include="Views\ViewDownloadManager.xaml.cs"> <Compile Include="Views\ViewDownloadManager.xaml.cs">
<DependentUpon>ViewDownloadManager.xaml</DependentUpon> <DependentUpon>ViewDownloadManager.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\ViewFriend.xaml.cs">
<DependentUpon>ViewFriend.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ViewIndex.xaml.cs"> <Compile Include="Views\ViewIndex.xaml.cs">
<DependentUpon>ViewIndex.xaml</DependentUpon> <DependentUpon>ViewIndex.xaml</DependentUpon>
</Compile> </Compile>
@ -341,6 +353,14 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\Friend\ViewFollower.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Friend\ViewFollowing.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\MainWindow.xaml"> <Page Include="Views\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@ -409,6 +429,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\ViewFriend.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ViewIndex.xaml"> <Page Include="Views\ViewIndex.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>

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

@ -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)
{
}
}
}

@ -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)
{
}
}
}

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

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

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

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

@ -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<TabHeader> tabHeaders;
public ObservableCollection<TabHeader> TabHeaders
{
get => tabHeaders;
set => SetProperty(ref tabHeaders, value);
}
private int selectTabId;
public int SelectTabId
{
get => selectTabId;
set => SetProperty(ref selectTabId, value);
}
#endregion
public ViewFriendViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) : base(eventAggregator)
{
this.regionManager = regionManager;
#region 属性初始化
ArrowBack = NavigationIcon.Instance().ArrowBack;
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
TabHeaders = new ObservableCollection<TabHeader>
{
new TabHeader { Id = 0, Title = DictionaryResource.GetString("FriendFollowing") },
new TabHeader { Id = 1, Title = DictionaryResource.GetString("FriendFollower") },
};
#endregion
}
#region 命令申明
// 返回事件
private DelegateCommand backSpaceCommand;
public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace));
/// <summary>
/// 返回事件
/// </summary>
private void ExecuteBackSpace()
{
//InitView();
ArrowBack.Fill = DictionaryResource.GetColor("ColorText");
NavigationParam parameter = new NavigationParam
{
ViewName = ParentView,
ParentViewName = null,
Parameter = null
};
eventAggregator.GetEvent<NavigationEvent>().Publish(parameter);
}
// 顶部tab点击事件
private DelegateCommand<object> tabHeadersCommand;
public DelegateCommand<object> TabHeadersCommand => tabHeadersCommand ?? (tabHeadersCommand = new DelegateCommand<object>(ExecuteTabHeadersCommand));
/// <summary>
/// 顶部tab点击事件
/// </summary>
/// <param name="parameter"></param>
private void ExecuteTabHeadersCommand(object parameter)
{
if (!(parameter is TabHeader tabHeader)) { return; }
NavigationView(tabHeader.Id);
}
#endregion
/// <summary>
/// 进入子页面
/// </summary>
/// <param name="id"></param>
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;
}
}
/// <summary>
/// 导航到VideoDetail页面时执行
/// </summary>
/// <param name="navigationContext"></param>
public override void OnNavigatedTo(NavigationContext navigationContext)
{
base.OnNavigatedTo(navigationContext);
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
// 根据传入参数不同执行不同任务
var parameter = navigationContext.Parameters.GetValue<Dictionary<string, object>>("Parameter");
if (parameter == null)
{
return;
}
mid = (long)parameter["mid"];
SelectTabId = (int)parameter["friendId"];
NavigationView(SelectTabId);
}
}
}

@ -183,7 +183,7 @@ namespace DownKyi.ViewModels
public DelegateCommand<object> TabHeadersCommand => tabHeadersCommand ?? (tabHeadersCommand = new DelegateCommand<object>(ExecuteTabHeadersCommand, CanExecuteTabHeadersCommand)); public DelegateCommand<object> TabHeadersCommand => tabHeadersCommand ?? (tabHeadersCommand = new DelegateCommand<object>(ExecuteTabHeadersCommand, CanExecuteTabHeadersCommand));
/// <summary> /// <summary>
/// 左侧tab点击事件 /// 顶部tab点击事件
/// </summary> /// </summary>
/// <param name="parameter"></param> /// <param name="parameter"></param>
private void ExecuteTabHeadersCommand(object parameter) private void ExecuteTabHeadersCommand(object parameter)

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

@ -156,6 +156,14 @@ namespace DownKyi.ViewModels
set => SetProperty(ref tabRightBanners, value); set => SetProperty(ref tabRightBanners, value);
} }
private int selectedRightBanner;
public int SelectedRightBanner
{
get => selectedRightBanner;
set => SetProperty(ref selectedRightBanner, value);
}
#endregion #endregion
public ViewUserSpaceViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) : base(eventAggregator) public ViewUserSpaceViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) : base(eventAggregator)
@ -200,7 +208,6 @@ namespace DownKyi.ViewModels
eventAggregator.GetEvent<NavigationEvent>().Publish(parameter); eventAggregator.GetEvent<NavigationEvent>().Publish(parameter);
} }
// 左侧tab点击事件 // 左侧tab点击事件
private DelegateCommand<object> tabLeftBannersCommand; private DelegateCommand<object> tabLeftBannersCommand;
public DelegateCommand<object> TabLeftBannersCommand => tabLeftBannersCommand ?? (tabLeftBannersCommand = new DelegateCommand<object>(ExecuteTabLeftBannersCommand)); public DelegateCommand<object> TabLeftBannersCommand => tabLeftBannersCommand ?? (tabLeftBannersCommand = new DelegateCommand<object>(ExecuteTabLeftBannersCommand));
@ -230,6 +237,38 @@ namespace DownKyi.ViewModels
} }
} }
// 右侧tab点击事件
private DelegateCommand<object> tabRightBannersCommand;
public DelegateCommand<object> TabRightBannersCommand => tabRightBannersCommand ?? (tabRightBannersCommand = new DelegateCommand<object>(ExecuteTabRightBannersCommand));
/// <summary>
/// 右侧tab点击事件
/// </summary>
private void ExecuteTabRightBannersCommand(object parameter)
{
if (!(parameter is TabRightBanner banner)) { return; }
Dictionary<string, object> data = new Dictionary<string, object>
{
{ "mid", mid },
{ "friendId", 0 }
};
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 #endregion
/// <summary> /// <summary>
@ -252,6 +291,8 @@ namespace DownKyi.ViewModels
TabLeftBanners.Clear(); TabLeftBanners.Clear();
TabRightBanners.Clear(); TabRightBanners.Clear();
SelectedRightBanner = -1;
// 将内容置空,使其不指向任何页面 // 将内容置空,使其不指向任何页面
regionManager.RequestNavigate("UserSpaceContentRegion", ""); regionManager.RequestNavigate("UserSpaceContentRegion", "");
@ -416,6 +457,7 @@ namespace DownKyi.ViewModels
{ {
TabRightBanners.Add(new TabRightBanner TabRightBanners.Add(new TabRightBanner
{ {
Id = 0,
IsEnabled = true, IsEnabled = true,
LabelColor = DictionaryResource.GetColor("ColorPrimary"), LabelColor = DictionaryResource.GetColor("ColorPrimary"),
CountColor = DictionaryResource.GetColor("ColorPrimary"), CountColor = DictionaryResource.GetColor("ColorPrimary"),
@ -424,6 +466,7 @@ namespace DownKyi.ViewModels
}); });
TabRightBanners.Add(new TabRightBanner TabRightBanners.Add(new TabRightBanner
{ {
Id = 1,
IsEnabled = true, IsEnabled = true,
LabelColor = DictionaryResource.GetColor("ColorPrimary"), LabelColor = DictionaryResource.GetColor("ColorPrimary"),
CountColor = DictionaryResource.GetColor("ColorPrimary"), CountColor = DictionaryResource.GetColor("ColorPrimary"),
@ -442,6 +485,7 @@ namespace DownKyi.ViewModels
{ {
TabRightBanners.Add(new TabRightBanner TabRightBanners.Add(new TabRightBanner
{ {
Id = 2,
IsEnabled = false, IsEnabled = false,
LabelColor = DictionaryResource.GetColor("ColorTextGrey"), LabelColor = DictionaryResource.GetColor("ColorTextGrey"),
CountColor = DictionaryResource.GetColor("ColorTextDark"), CountColor = DictionaryResource.GetColor("ColorTextDark"),
@ -456,6 +500,7 @@ namespace DownKyi.ViewModels
} }
TabRightBanners.Add(new TabRightBanner TabRightBanners.Add(new TabRightBanner
{ {
Id = 3,
IsEnabled = false, IsEnabled = false,
LabelColor = DictionaryResource.GetColor("ColorTextGrey"), LabelColor = DictionaryResource.GetColor("ColorTextGrey"),
CountColor = DictionaryResource.GetColor("ColorTextDark"), CountColor = DictionaryResource.GetColor("ColorTextDark"),
@ -470,6 +515,7 @@ namespace DownKyi.ViewModels
} }
TabRightBanners.Add(new TabRightBanner TabRightBanners.Add(new TabRightBanner
{ {
Id = 4,
IsEnabled = false, IsEnabled = false,
LabelColor = DictionaryResource.GetColor("ColorTextGrey"), LabelColor = DictionaryResource.GetColor("ColorTextGrey"),
CountColor = DictionaryResource.GetColor("ColorTextDark"), CountColor = DictionaryResource.GetColor("ColorTextDark"),

@ -0,0 +1,14 @@
<UserControl
x:Class="DownKyi.Views.Friend.ViewFollower"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:custom="clr-namespace:DownKyi.CustomControl"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True">
<UserControl.Resources />
<Grid>
<TextBlock Text="关注" />
</Grid>
</UserControl>

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace DownKyi.Views.Friend
{
/// <summary>
/// ViewFollower.xaml 的交互逻辑
/// </summary>
public partial class ViewFollower : UserControl
{
public ViewFollower()
{
InitializeComponent();
}
}
}

@ -0,0 +1,14 @@
<UserControl
x:Class="DownKyi.Views.Friend.ViewFollowing"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:custom="clr-namespace:DownKyi.CustomControl"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True">
<UserControl.Resources />
<Grid>
<TextBlock Text="粉丝" />
</Grid>
</UserControl>

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace DownKyi.Views.Friend
{
/// <summary>
/// ViewFollowing.xaml 的交互逻辑
/// </summary>
public partial class ViewFollowing : UserControl
{
public ViewFollowing()
{
InitializeComponent();
}
}
}

@ -0,0 +1,139 @@
<UserControl
x:Class="DownKyi.Views.ViewFriend"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:custom="clr-namespace:DownKyi.CustomControl"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True">
<UserControl.Resources />
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="1" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="0"
Margin="10,5,0,5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Command="{Binding BackSpaceCommand}"
Style="{StaticResource ImageBtnStyle}">
<StackPanel Orientation="Horizontal">
<ContentControl Width="24" Height="24">
<Path
Width="{Binding ArrowBack.Width}"
Height="{Binding ArrowBack.Height}"
Data="{Binding ArrowBack.Data}"
Fill="{Binding ArrowBack.Fill}"
Stretch="None" />
</ContentControl>
<TextBlock
VerticalAlignment="Center"
FontSize="16"
Foreground="{DynamicResource BrushTextDark}"
Text="{DynamicResource Friend}" />
</StackPanel>
</Button>
<!-- 顶部Tab -->
<ListBox
Name="nameTabHeaders"
Grid.Column="1"
BorderThickness="0"
IsEnabled="{Binding IsEnabled}"
ItemsSource="{Binding TabHeaders}"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
SelectedIndex="{Binding SelectTabId, Mode=TwoWay}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding TabHeadersCommand}" CommandParameter="{Binding ElementName=nameTabHeaders, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<StackPanel
x:Name="panel"
Margin="10,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Cursor="Hand">
<TextBlock
Name="nameText"
Padding="0,0,0,3"
Text="{Binding Title}" />
<TextBlock Name="nameIndicator" Height="1.5" />
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="Selector.IsSelected" Value="False">
<Setter TargetName="nameText" Property="Foreground" Value="{DynamicResource BrushTextDark}" />
<Setter TargetName="nameIndicator" Property="Visibility" Value="Hidden" />
<Setter TargetName="nameIndicator" Property="Background" Value="{DynamicResource BrushTextDark}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="nameText" Property="Foreground" Value="{DynamicResource BrushPrimary}" />
</Trigger>
<Trigger Property="Selector.IsSelected" Value="True">
<Setter TargetName="nameText" Property="Foreground" Value="{DynamicResource BrushPrimary}" />
<Setter TargetName="nameIndicator" Property="Visibility" Value="Visible" />
<Setter TargetName="nameIndicator" Property="Background" Value="{DynamicResource BrushPrimary}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.Style>
<Style TargetType="ListBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border
x:Name="Bd"
Padding="0"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Focusable="False">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.Style>
</ListBox>
</Grid>
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
<!-- 内容区 -->
<ContentControl Grid.Row="2" prism:RegionManager.RegionName="FriendContentRegion" />
</Grid>
</UserControl>

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace DownKyi.Views
{
/// <summary>
/// ViewFriend.xaml 的交互逻辑
/// </summary>
public partial class ViewFriend : UserControl
{
public ViewFriend()
{
InitializeComponent();
}
}
}

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

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

Loading…
Cancel
Save