forked from xiaoyaocz/biliuwp-lite
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #520 from ywmoyue/dev
4.6.27
- Loading branch information
Showing
57 changed files
with
2,123 additions
and
706 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,35 @@ | ||
<UserControl | ||
x:Class="BiliLite.Controls.AttentionButton" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:BiliLite.Controls" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
Background="Transparent" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400"> | ||
<UserControl.Resources> | ||
<MenuFlyout x:Key="AttentionFlyout" x:Name="AttentionFlyout"> | ||
<MenuFlyoutItem Click="SetFollowingTag_OnClick">设置分组</MenuFlyoutItem> | ||
<MenuFlyoutItem Command="{x:Bind m_viewModel.AttentionCommand}">取消关注</MenuFlyoutItem> | ||
</MenuFlyout> | ||
</UserControl.Resources> | ||
<Grid Background="Transparent"> | ||
<local:UserFollowingTagsFlyout x:Name="UserFollowingTagsFlyout"></local:UserFollowingTagsFlyout> | ||
<Button Width="80" | ||
x:Name="AttendedBtn" | ||
Visibility="{x:Bind Path=m_viewModel.Attention,Converter={StaticResource display},ConverterParameter=1,Mode=OneWay}" | ||
Click="AttendedBtn_OnClick" | ||
Padding="16 4" FontSize="12">已关注</Button> | ||
<Button Width="80" | ||
Visibility="{x:Bind Path=m_viewModel.Attention,Converter={StaticResource display},ConverterParameter=0,Mode=OneWay}" | ||
Command="{x:Bind Path=m_viewModel.AttentionCommand}" | ||
Padding="16 4" | ||
BorderThickness="1" | ||
Background="Transparent" | ||
BorderBrush="{ThemeResource HighLightColor}" | ||
Foreground="{ThemeResource HighLightColor}" | ||
FontSize="12">关注</Button> | ||
</Grid> | ||
</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,61 @@ | ||
using System.Threading.Tasks; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using BiliLite.ViewModels.User; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
//https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板 | ||
|
||
namespace BiliLite.Controls | ||
{ | ||
public sealed partial class AttentionButton : UserControl | ||
{ | ||
private readonly UserAttentionButtonViewModel m_viewModel; | ||
|
||
public AttentionButton() | ||
{ | ||
m_viewModel = App.ServiceProvider.GetRequiredService<UserAttentionButtonViewModel>(); | ||
this.InitializeComponent(); | ||
} | ||
|
||
public static readonly DependencyProperty AttentionProperty = | ||
DependencyProperty.Register(nameof(Attention), typeof(int), typeof(AttentionButton), new PropertyMetadata(0)); | ||
|
||
public int Attention | ||
{ | ||
get => m_viewModel.Attention; | ||
set => m_viewModel.Attention = value; | ||
} | ||
|
||
public static readonly DependencyProperty UserIdProperty = | ||
DependencyProperty.Register(nameof(Attention), typeof(string), typeof(AttentionButton), new PropertyMetadata(default(string))); | ||
|
||
public string UserId | ||
{ | ||
get => m_viewModel.UserId; | ||
set => m_viewModel.UserId = value; | ||
} | ||
|
||
public async Task AttentionUp() | ||
{ | ||
await m_viewModel.AttentionUP(m_viewModel.UserId, 1); | ||
} | ||
|
||
private void AttendedBtn_OnClick(object sender, RoutedEventArgs e) | ||
{ | ||
var flyoutShowOptions = new FlyoutShowOptions() | ||
{ | ||
Placement = FlyoutPlacementMode.Bottom | ||
}; | ||
AttentionFlyout.ShowAt(sender as DependencyObject, flyoutShowOptions); | ||
} | ||
|
||
private async void SetFollowingTag_OnClick(object sender, RoutedEventArgs e) | ||
{ | ||
if(!UserFollowingTagsFlyout.HasInit) | ||
await UserFollowingTagsFlyout.Init(m_viewModel.UserId); | ||
UserFollowingTagsFlyout.ShowAt(AttendedBtn); | ||
} | ||
} | ||
} |
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,30 @@ | ||
<UserControl | ||
x:Class="BiliLite.Controls.UserFollowingTagsFlyout" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:BiliLite.Controls" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:user="using:BiliLite.ViewModels.User" | ||
mc:Ignorable="d" | ||
d:DesignHeight="0" | ||
d:DesignWidth="0"> | ||
|
||
<UserControl.ContextFlyout> | ||
<Flyout Placement="Bottom" | ||
x:Name="FollowingTagFlyout" | ||
AllowFocusOnInteraction="False" | ||
Closed="FollowingTagFlyout_OnClosed"> | ||
<StackPanel Orientation="Vertical"> | ||
<ListView ItemsSource="{x:Bind m_viewModel.FollowingTags,Mode=OneWay}"> | ||
<ListView.ItemTemplate> | ||
<DataTemplate x:DataType="user:UserRelationFollowingTagViewModel"> | ||
<CheckBox Content="{x:Bind Name}" IsChecked="{x:Bind UserInThisTag,Mode=TwoWay}" /> | ||
</DataTemplate> | ||
</ListView.ItemTemplate> | ||
</ListView> | ||
<Button x:Name="SaveFollowingTagUser" Click="SaveFollowingTagUser_OnClick" HorizontalAlignment="Right">保存</Button> | ||
</StackPanel> | ||
</Flyout> | ||
</UserControl.ContextFlyout> | ||
</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,49 @@ | ||
using System.Threading.Tasks; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using BiliLite.ViewModels.User; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
//https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板 | ||
|
||
namespace BiliLite.Controls | ||
{ | ||
public sealed partial class UserFollowingTagsFlyout : UserControl | ||
{ | ||
private readonly UserFollowingTagsFlyoutViewModel m_viewModel; | ||
|
||
public UserFollowingTagsFlyout() | ||
{ | ||
m_viewModel = App.ServiceProvider.GetRequiredService<UserFollowingTagsFlyoutViewModel>(); | ||
this.InitializeComponent(); | ||
} | ||
|
||
public bool HasInit { get; set; } | ||
|
||
private void FollowingTagFlyout_OnClosed(object sender, object e) | ||
{ | ||
m_viewModel.CancelSaveFollowingTagUser(); | ||
} | ||
|
||
private async void SaveFollowingTagUser_OnClick(object sender, RoutedEventArgs e) | ||
{ | ||
await m_viewModel.SaveFollowingTagUser(); | ||
FollowingTagFlyout.Hide(); | ||
} | ||
|
||
public async Task Init(string userId) | ||
{ | ||
await m_viewModel.Init(userId); | ||
HasInit = true; | ||
} | ||
|
||
public void ShowAt(DependencyObject target) | ||
{ | ||
ContextFlyout.ShowAt(target, new FlyoutShowOptions() | ||
{ | ||
Placement = FlyoutPlacementMode.Bottom | ||
}); | ||
} | ||
} | ||
} |
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.