This repository has been archived by the owner on Dec 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 支持显示热门标签和全部标签 * 完成直播分区详情页 * 添加连接动画
- Loading branch information
Showing
34 changed files
with
1,187 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<UserControl | ||
x:Class="Richasy.Bili.App.Controls.LiveAreaItem" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:Richasy.Bili.App.Controls" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400" | ||
mc:Ignorable="d"> | ||
|
||
<local:CardPanel | ||
x:Name="ContentContainer" | ||
Click="OnAreaClick" | ||
IsEnableHoverAnimation="False" | ||
IsEnableShadow="False"> | ||
<StackPanel | ||
Margin="4" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
Spacing="12"> | ||
<local:CommonImageEx | ||
Width="40" | ||
HorizontalAlignment="Center" | ||
ImageUrl="{x:Bind Cover, Mode=OneWay}" /> | ||
<TextBlock | ||
HorizontalAlignment="Center" | ||
Text="{x:Bind Title, Mode=OneWay}" | ||
TextAlignment="Center" | ||
TextWrapping="Wrap" /> | ||
</StackPanel> | ||
</local:CardPanel> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright (c) Richasy. All rights reserved. | ||
|
||
using System; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Media.Animation; | ||
|
||
namespace Richasy.Bili.App.Controls | ||
{ | ||
/// <summary> | ||
/// 直播分区条目. | ||
/// </summary> | ||
public sealed partial class LiveAreaItem : UserControl | ||
{ | ||
/// <summary> | ||
/// <see cref="Cover"/> 的依赖属性. | ||
/// </summary> | ||
public static readonly DependencyProperty CoverProperty = | ||
DependencyProperty.Register(nameof(Cover), typeof(string), typeof(LiveAreaItem), new PropertyMetadata(default)); | ||
|
||
/// <summary> | ||
/// <see cref="Title"/> 的依赖属性. | ||
/// </summary> | ||
public static readonly DependencyProperty TitleProperty = | ||
DependencyProperty.Register(nameof(Title), typeof(string), typeof(LiveAreaItem), new PropertyMetadata(default)); | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="LiveAreaItem"/> class. | ||
/// </summary> | ||
public LiveAreaItem() => InitializeComponent(); | ||
|
||
/// <summary> | ||
/// 在条目被点击时发生. | ||
/// </summary> | ||
public event EventHandler ItemClick; | ||
|
||
/// <summary> | ||
/// 封面. | ||
/// </summary> | ||
public string Cover | ||
{ | ||
get { return (string)GetValue(CoverProperty); } | ||
set { SetValue(CoverProperty, value); } | ||
} | ||
|
||
/// <summary> | ||
/// 标题. | ||
/// </summary> | ||
public string Title | ||
{ | ||
get { return (string)GetValue(TitleProperty); } | ||
set { SetValue(TitleProperty, value); } | ||
} | ||
|
||
private void OnAreaClick(object sender, RoutedEventArgs e) | ||
{ | ||
var animationService = ConnectedAnimationService.GetForCurrentView(); | ||
animationService.PrepareToAnimate("LiveAreaAnimate", ContentContainer); | ||
ItemClick?.Invoke(this, EventArgs.Empty); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<local:CenterPopup | ||
x:Class="Richasy.Bili.App.Controls.LiveAreaView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:bilibili="using:Richasy.Bili.Models.BiliBili" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:loc="using:Richasy.Bili.Locator.Uwp" | ||
xmlns:local="using:Richasy.Bili.App.Controls" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" | ||
Title="{loc:LocaleLocator Name=TotalTags}" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400" | ||
mc:Ignorable="d"> | ||
|
||
<Grid MinHeight="200"> | ||
<Grid Visibility="{x:Bind _viewModel.IsAreaError, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}"> | ||
<muxc:NavigationView | ||
IsBackButtonVisible="Collapsed" | ||
IsPaneToggleButtonVisible="False" | ||
IsSettingsVisible="False" | ||
MenuItemsSource="{x:Bind _viewModel.LiveAreaGroupCollection}" | ||
PaneDisplayMode="Top" | ||
SelectedItem="{x:Bind _viewModel.SelectedAreaGroup, Mode=TwoWay}" | ||
Visibility="{x:Bind _viewModel.IsLiveAreaRequesting, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}"> | ||
<muxc:NavigationView.MenuItemTemplate> | ||
<DataTemplate x:DataType="bilibili:LiveAreaGroup"> | ||
<muxc:NavigationViewItem Content="{x:Bind Name}" /> | ||
</DataTemplate> | ||
</muxc:NavigationView.MenuItemTemplate> | ||
<ScrollViewer HorizontalScrollMode="Disabled" VerticalScrollBarVisibility="Hidden"> | ||
<muxc:ItemsRepeater Margin="0,8,0,20" ItemsSource="{x:Bind _viewModel.DisplayAreaCollection}"> | ||
<muxc:ItemsRepeater.Layout> | ||
<muxc:UniformGridLayout | ||
ItemsStretch="Fill" | ||
MinColumnSpacing="12" | ||
MinItemHeight="118" | ||
MinItemWidth="120" | ||
MinRowSpacing="12" /> | ||
</muxc:ItemsRepeater.Layout> | ||
<muxc:ItemsRepeater.ItemTemplate> | ||
<DataTemplate x:DataType="bilibili:LiveArea"> | ||
<local:LiveAreaItem | ||
Title="{x:Bind Name}" | ||
Cover="{x:Bind Cover}" | ||
DataContext="{x:Bind}" | ||
ItemClick="OnAreaClick" /> | ||
</DataTemplate> | ||
</muxc:ItemsRepeater.ItemTemplate> | ||
</muxc:ItemsRepeater> | ||
</ScrollViewer> | ||
</muxc:NavigationView> | ||
</Grid> | ||
|
||
<muxc:ProgressRing Style="{StaticResource PageProgressRingStyle}" IsActive="{x:Bind _viewModel.IsLiveAreaRequesting, Mode=OneWay}" /> | ||
|
||
<local:ErrorPanel | ||
x:Name="ErrorPanel" | ||
ActionButtonClick="OnRefreshButtonClickAsync" | ||
ActionContent="{loc:LocaleLocator Name=Refresh}" | ||
Text="{loc:LocaleLocator Name=RequestLiveTagsFailed}" | ||
Visibility="{x:Bind _viewModel.IsAreaError, Mode=OneWay}" /> | ||
</Grid> | ||
</local:CenterPopup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) Richasy. All rights reserved. | ||
|
||
using System.Threading.Tasks; | ||
using Richasy.Bili.Models.BiliBili; | ||
using Richasy.Bili.ViewModels.Uwp; | ||
using Windows.UI.Xaml; | ||
|
||
namespace Richasy.Bili.App.Controls | ||
{ | ||
/// <summary> | ||
/// 直播分区视图. | ||
/// </summary> | ||
public sealed partial class LiveAreaView : CenterPopup | ||
{ | ||
private readonly LiveModuleViewModel _viewModel = LiveModuleViewModel.Instance; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="LiveAreaView"/> class. | ||
/// </summary> | ||
public LiveAreaView() => InitializeComponent(); | ||
|
||
/// <summary> | ||
/// 显示视图. | ||
/// </summary> | ||
/// <returns><see cref="Task"/>.</returns> | ||
public async Task ShowAsync() | ||
{ | ||
Show(); | ||
if (_viewModel.LiveAreaGroupCollection.Count == 0) | ||
{ | ||
await _viewModel.InitializeAreaIndexAsync(); | ||
} | ||
} | ||
|
||
private async void OnRefreshButtonClickAsync(object sender, RoutedEventArgs e) | ||
=> await _viewModel.InitializeAreaIndexAsync(); | ||
|
||
private void OnAreaClick(object sender, System.EventArgs e) | ||
{ | ||
var data = (sender as FrameworkElement).DataContext as LiveArea; | ||
AppViewModel.Instance.SetOverlayContentId(Models.Enums.PageIds.LiveAreaDetail, data); | ||
Hide(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.