Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Bili.Uwp
提交
cada8b5d
B
Bili.Uwp
项目概览
jobily
/
Bili.Uwp
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
Bili.Uwp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cada8b5d
编写于
6月 03, 2021
作者:
A
Anran Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加子分区的选中项管理
上级
ce9f5d3a
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
67 addition
and
1 deletion
+67
-1
src/App/Pages/Overlay/PartitionDetailPage.xaml
src/App/Pages/Overlay/PartitionDetailPage.xaml
+5
-1
src/App/Pages/Overlay/PartitionDetailPage.xaml.cs
src/App/Pages/Overlay/PartitionDetailPage.xaml.cs
+53
-0
src/ViewModels/ViewModels.Uwp/PartitionViewModel/PartitionViewModel.Properties.cs
...s.Uwp/PartitionViewModel/PartitionViewModel.Properties.cs
+6
-0
src/ViewModels/ViewModels.Uwp/PartitionViewModel/PartitionViewModel.cs
...s/ViewModels.Uwp/PartitionViewModel/PartitionViewModel.cs
+3
-0
未找到文件。
src/App/Pages/Overlay/PartitionDetailPage.xaml
浏览文件 @
cada8b5d
...
...
@@ -36,11 +36,15 @@
IsBackButtonVisible="Collapsed"
IsPaneToggleButtonVisible="False"
IsSettingsVisible="False"
ItemInvoked="OnDetailNavigationViewItemInvoked"
MenuItemsSource="{x:Bind ViewModel.SubPartitionCollection}"
PaneDisplayMode="Top">
<muxc:NavigationView.Resources>
<SolidColorBrush x:Key="NavigationViewContentBackground" Color="Transparent" />
</muxc:NavigationView.Resources>
<muxc:NavigationView.MenuItemTemplate>
<DataTemplate x:DataType="uwp:SubPartitionViewModel">
<muxc:NavigationViewItem Content="{x:Bind Title, Mode=OneWay}" />
<muxc:NavigationViewItem Content="{x:Bind Title, Mode=OneWay}"
Tag="{x:Bind SubPartitionId}"
/>
</DataTemplate>
</muxc:NavigationView.MenuItemTemplate>
</muxc:NavigationView>
...
...
src/App/Pages/Overlay/PartitionDetailPage.xaml.cs
浏览文件 @
cada8b5d
// Copyright (c) Richasy. All rights reserved.
using
System
;
using
System.ComponentModel
;
using
System.Linq
;
using
Richasy.Bili.App.Resources.Extension
;
using
Richasy.Bili.ViewModels.Uwp
;
using
Windows.UI.Xaml
;
...
...
@@ -26,6 +29,8 @@ namespace Richasy.Bili.App.Pages.Overlay
public
PartitionDetailPage
()
{
this
.
InitializeComponent
();
this
.
Loaded
+=
this
.
OnLoaded
;
this
.
Unloaded
+=
this
.
OnUnloaded
;
}
/// <summary>
...
...
@@ -57,5 +62,53 @@ namespace Richasy.Bili.App.Pages.Overlay
var
animate
=
animationService
.
PrepareToAnimate
(
"PartitionBackAnimate"
,
this
.
PartitionHeader
);
animate
.
Configuration
=
new
DirectConnectedAnimationConfiguration
();
}
private
void
OnUnloaded
(
object
sender
,
RoutedEventArgs
e
)
{
ViewModel
.
PropertyChanged
-=
OnViewModelPropertyChanged
;
}
private
void
OnLoaded
(
object
sender
,
RoutedEventArgs
e
)
{
ViewModel
.
PropertyChanged
+=
OnViewModelPropertyChanged
;
CheckCurrentSubPartition
();
}
private
void
OnViewModelPropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
nameof
(
ViewModel
.
CurrentSelectedSubPartition
))
{
CheckCurrentSubPartition
();
}
}
private
void
OnDetailNavigationViewItemInvoked
(
Microsoft
.
UI
.
Xaml
.
Controls
.
NavigationView
sender
,
Microsoft
.
UI
.
Xaml
.
Controls
.
NavigationViewItemInvokedEventArgs
args
)
{
var
invokeItem
=
args
.
InvokedItemContainer
as
Microsoft
.
UI
.
Xaml
.
Controls
.
NavigationViewItem
;
var
subPartitionId
=
invokeItem
.
Tag
==
null
?
-
1
:
Convert
.
ToInt32
(
invokeItem
.
Tag
);
SubPartitionViewModel
vm
;
if
(
subPartitionId
==
-
1
)
{
vm
=
ViewModel
.
SubPartitionCollection
.
First
();
}
else
{
vm
=
ViewModel
.
SubPartitionCollection
.
Where
(
p
=>
p
.
SubPartitionId
==
subPartitionId
).
FirstOrDefault
();
}
ViewModel
.
CurrentSelectedSubPartition
=
vm
;
}
private
void
CheckCurrentSubPartition
()
{
var
vm
=
ViewModel
.
CurrentSelectedSubPartition
;
if
(
vm
!=
null
)
{
if
(!(
DetailNavigationView
.
SelectedItem
is
SubPartitionViewModel
selectedItem
)
||
selectedItem
!=
vm
)
{
DetailNavigationView
.
SelectedItem
=
vm
;
}
}
}
}
}
src/ViewModels/ViewModels.Uwp/PartitionViewModel/PartitionViewModel.Properties.cs
浏览文件 @
cada8b5d
...
...
@@ -35,6 +35,12 @@ namespace Richasy.Bili.ViewModels.Uwp
/// </summary>
public
int
PartitionId
=>
_partition
?.
Tid
??
0
;
/// <summary>
/// 当前选中的子分区.
/// </summary>
[
Reactive
]
public
SubPartitionViewModel
CurrentSelectedSubPartition
{
get
;
set
;
}
/// <inheritdoc/>
public
override
bool
Equals
(
object
obj
)
=>
obj
is
PartitionViewModel
model
&&
PartitionId
==
model
.
PartitionId
;
...
...
src/ViewModels/ViewModels.Uwp/PartitionViewModel/PartitionViewModel.cs
浏览文件 @
cada8b5d
// Copyright (c) Richasy. All rights reserved.
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
Richasy.Bili.Models.BiliBili
;
namespace
Richasy.Bili.ViewModels.Uwp
...
...
@@ -35,6 +36,8 @@ namespace Richasy.Bili.ViewModels.Uwp
{
this
.
SubPartitionCollection
.
Insert
(
0
,
new
SubPartitionViewModel
(
null
));
}
this
.
CurrentSelectedSubPartition
=
this
.
SubPartitionCollection
.
First
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录