Introducing Elevation Badge

This commit is contained in:
Lightczx
2023-05-17 20:58:40 +08:00
parent f104554661
commit 96f503d30c
10 changed files with 102 additions and 12 deletions

View File

@@ -47,6 +47,19 @@ internal static class Property<TOwner>
return DependencyProperty.Register(name, typeof(TProperty), typeof(TOwner), new(defaultValue));
}
/// <summary>
/// 注册依赖属性
/// </summary>
/// <typeparam name="TProperty">属性的类型</typeparam>
/// <param name="name">属性名称</param>
/// <param name="defaultValue">封装的默认值</param>
/// <param name="callback">属性更改回调</param>
/// <returns>注册的依赖属性</returns>
public static DependencyProperty DependBoxed<TProperty>(string name, object defaultValue, Action<DependencyObject, DependencyPropertyChangedEventArgs> callback)
{
return DependencyProperty.Register(name, typeof(TProperty), typeof(TOwner), new(defaultValue, new(callback)));
}
/// <summary>
/// 注册依赖属性
/// </summary>

View File

@@ -1590,6 +1590,15 @@ namespace Snap.Hutao.Resource.Localization {
}
}
/// <summary>
/// 查找类似 需要管理员权限 的本地化字符串。
/// </summary>
internal static string ViewControlElevationText {
get {
return ResourceManager.GetString("ViewControlElevationText", resourceCulture);
}
}
/// <summary>
/// 查找类似 加载中,请稍候 的本地化字符串。
/// </summary>

View File

@@ -2013,4 +2013,7 @@
<data name="ViewInfoBarToggleTitle" xml:space="preserve">
<value>有新的通知</value>
</data>
<data name="ViewControlElevationText" xml:space="preserve">
<value>需要管理员权限</value>
</data>
</root>

View File

@@ -115,6 +115,7 @@
<None Remove="View\Control\BaseValueSlider.xaml" />
<None Remove="View\Control\BottomTextControl.xaml" />
<None Remove="View\Control\DescParamComboBox.xaml" />
<None Remove="View\Control\Elevation.xaml" />
<None Remove="View\Control\ItemIcon.xaml" />
<None Remove="View\Control\LaunchGameResourceExpander.xaml" />
<None Remove="View\Control\LoadingView.xaml" />
@@ -302,6 +303,12 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Page Update="View\Control\Elevation.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="View\InfoBarView.xaml">
<Generator>MSBuild:Compile</Generator>

View File

@@ -0,0 +1,22 @@
<UserControl
x:Class="Snap.Hutao.View.Control.Elevation"
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:Snap.Hutao.View.Control"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
VerticalAlignment="Center"
mc:Ignorable="d">
<Border
Padding="10,6"
Background="{ThemeResource SystemFillColorCriticalBackgroundBrush}"
CornerRadius="14"
Style="{StaticResource BorderCardStyle}">
<TextBlock
Foreground="{ThemeResource SystemFillColorCriticalBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{shcm:ResourceString Name=ViewControlElevationText}"/>
</Border>
</UserControl>

View File

@@ -0,0 +1,22 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control;
namespace Snap.Hutao.View.Control;
/// <summary>
/// 管理员提示
/// </summary>
internal sealed partial class Elevation : UserControl
{
/// <summary>
/// 构造一个新的管理员提示
/// </summary>
public Elevation()
{
InitializeComponent();
}
}

View File

@@ -25,6 +25,7 @@
<shcb:InvokeCommandOnLoadedBehavior Command="{Binding OpenUICommand}"/>
</mxi:Interaction.Behaviors>
<shc:ScopedPage.Resources>
<x:Double x:Key="AdaptiveGridViewDesiredWidth">300</x:Double>
<shc:BindingProxy x:Key="BindingProxy" DataContext="{Binding}"/>
<DataTemplate x:Key="AnnouncementTemplate">
@@ -32,7 +33,7 @@
Margin="16,16,0,-4"
HorizontalAlignment="Stretch"
cwua:ItemsReorderAnimation.Duration="0:0:0.1"
DesiredWidth="300"
DesiredWidth="{StaticResource AdaptiveGridViewDesiredWidth}"
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
ItemsSource="{Binding List}"
SelectionMode="None">
@@ -165,9 +166,10 @@
Margin="16,16,0,0"
HorizontalAlignment="Stretch"
cwua:ItemsReorderAnimation.Duration="0:0:0.1"
DesiredWidth="300"
DesiredWidth="{StaticResource AdaptiveGridViewDesiredWidth}"
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
SelectionMode="None">
SelectionMode="None"
StretchContentForSingleRow="False">
<shvca:LaunchGameCard Height="{StaticResource HomeAdaptiveCardHeight}"/>
<shvca:GachaStatisticsCard/>
<shvca:AchievementCard/>

View File

@@ -94,7 +94,8 @@
DesiredWidth="320"
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
ItemsSource="{Binding CultivateEntries}"
SelectionMode="None">
SelectionMode="None"
StretchContentForSingleRow="False">
<cwucont:AdaptiveGridView.ItemTemplate>
<DataTemplate>
<Border Style="{StaticResource BorderCardStyle}">
@@ -244,7 +245,8 @@
DesiredWidth="320"
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
ItemsSource="{Binding StatisticsItems}"
SelectionMode="None">
SelectionMode="None"
StretchContentForSingleRow="False">
<cwucont:AdaptiveGridView.Resources>
<x:Double x:Key="GridViewItemMinHeight">0</x:Double>
</cwucont:AdaptiveGridView.Resources>
@@ -323,7 +325,8 @@
Padding="16,16,4,4"
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
ItemsSource="{Binding InventoryItems}"
SelectionMode="None">
SelectionMode="None"
StretchContentForSingleRow="False">
<cwucont:AdaptiveGridView.ItemTemplate>
<DataTemplate>
<Button

View File

@@ -129,7 +129,8 @@
DesiredWidth="280"
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
ItemsSource="{Binding DailyNoteEntries}"
SelectionMode="None">
SelectionMode="None"
StretchContentForSingleRow="False">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Padding="8" Style="{StaticResource BorderCardStyle}">

View File

@@ -64,10 +64,13 @@
Header="{shcm:ResourceString Name=ViewPageLaunchGameSwitchSchemeHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE8AB;}"
IsEnabled="{Binding HutaoOptions.IsElevated}">
<ComboBox
DisplayMemberPath="DisplayName"
ItemsSource="{Binding KnownSchemes}"
SelectedItem="{Binding SelectedScheme, Mode=TwoWay}"/>
<StackPanel Orientation="Horizontal">
<shvc:Elevation Margin="0,0,36,0" Visibility="{Binding HutaoOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
<ComboBox
DisplayMemberPath="DisplayName"
ItemsSource="{Binding KnownSchemes}"
SelectedItem="{Binding SelectedScheme, Mode=TwoWay}"/>
</StackPanel>
</clw:SettingsCard>
<clw:SettingsCard
ActionIconToolTip="{shcm:ResourceString Name=ViewPageLaunchGameSwitchAccountDetectAction}"
@@ -216,7 +219,11 @@
Header="{shcm:ResourceString Name=ViewPageLaunchGameMultipleInstancesHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE7C4;}"
IsEnabled="{Binding HutaoOptions.IsElevated}">
<ToggleSwitch Width="120" IsOn="{Binding Options.MultipleInstances, Mode=TwoWay}"/>
<StackPanel Orientation="Horizontal">
<shvc:Elevation Visibility="{Binding HutaoOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
<ToggleSwitch Width="120" IsOn="{Binding Options.MultipleInstances, Mode=TwoWay}"/>
</StackPanel>
</clw:SettingsCard>
<clw:SettingsCard
Description="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsDescription}"
@@ -224,6 +231,7 @@
HeaderIcon="{shcm:FontIcon Glyph=&#xE785;}"
IsEnabled="{Binding HutaoOptions.IsElevated}">
<StackPanel Orientation="Horizontal">
<shvc:Elevation Margin="0,0,36,0" Visibility="{Binding HutaoOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
<NumberBox
MinWidth="156"
Padding="10,8,0,0"