mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
impl #875
This commit is contained in:
@@ -6,6 +6,7 @@ using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Snap.Hutao.Control.Helper;
|
||||
|
||||
[SuppressMessage("", "SH001")]
|
||||
[DependencyProperty("IsTextSelectionEnabled", typeof(bool), false, IsAttached = true, AttachedType = typeof(InfoBar))]
|
||||
public sealed partial class InfoBarHelper
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ internal class Loading : Microsoft.UI.Xaml.Controls.ContentControl
|
||||
{
|
||||
public static readonly DependencyProperty IsLoadingProperty = DependencyProperty.Register(nameof(IsLoading), typeof(bool), typeof(Loading), new PropertyMetadata(default(bool), IsLoadingPropertyChanged));
|
||||
|
||||
[SuppressMessage("", "IDE0052")]
|
||||
private FrameworkElement? presenter;
|
||||
|
||||
public Loading()
|
||||
|
||||
@@ -439,7 +439,7 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 刷新于 {0:yyyy/MM/dd HH:mm:ss} 的本地化字符串。
|
||||
/// 查找类似 刷新于 {0:yyyy.MM.dd HH:mm:ss} 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string ModelEntityDailyNoteRefreshTimeFormat {
|
||||
get {
|
||||
@@ -2041,7 +2041,7 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 祈愿记录上传服务有效期至\n{0:yyyy-MM-dd HH:mm:ss} 的本地化字符串。
|
||||
/// 查找类似 祈愿记录上传服务有效期至\n{0:yyyy.MM.dd HH:mm:ss} 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string ServiceHutaoUserGachaLogExpiredAt {
|
||||
get {
|
||||
@@ -6486,6 +6486,15 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 文档 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string ViewUserDocumentationHeader {
|
||||
get {
|
||||
return ResourceManager.GetString("ViewUserDocumentationHeader", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 刷新 CookieToken 成功 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -2315,6 +2315,9 @@
|
||||
<data name="ViewUserDefaultDescription" xml:space="preserve">
|
||||
<value>请先登录</value>
|
||||
</data>
|
||||
<data name="ViewUserDocumentationHeader" xml:space="preserve">
|
||||
<value>文档</value>
|
||||
</data>
|
||||
<data name="ViewUserRefreshCookieTokenSuccess" xml:space="preserve">
|
||||
<value>刷新 CookieToken 成功</value>
|
||||
</data>
|
||||
|
||||
BIN
src/Snap.Hutao/Snap.Hutao/Resource/Navigation/Documentation.png
Normal file
BIN
src/Snap.Hutao/Snap.Hutao/Resource/Navigation/Documentation.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
@@ -8,7 +8,6 @@ namespace Snap.Hutao.Service.Metadata;
|
||||
/// </summary>
|
||||
internal partial class MetadataService
|
||||
{
|
||||
#pragma warning disable CA1823
|
||||
private const string FileNameAchievement = "Achievement";
|
||||
private const string FileNameAchievementGoal = "AchievementGoal";
|
||||
private const string FileNameAvatar = "Avatar";
|
||||
@@ -31,5 +30,4 @@ internal partial class MetadataService
|
||||
private const string FileNameWeapon = "Weapon";
|
||||
private const string FileNameWeaponCurve = "WeaponCurve";
|
||||
private const string FileNameWeaponPromote = "WeaponPromote";
|
||||
#pragma warning restore
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.View.Page;
|
||||
|
||||
namespace Snap.Hutao.Service.Navigation;
|
||||
|
||||
[Injection(InjectAs.Singleton, typeof(IDocumentationProvider))]
|
||||
[ConstructorGenerated]
|
||||
internal sealed partial class DocumentationProvider : IDocumentationProvider
|
||||
{
|
||||
private const string Home = "https://hut.ao";
|
||||
|
||||
private static readonly Dictionary<Type, string> TypeDocumentations = new()
|
||||
{
|
||||
[typeof(AchievementPage)] = "https://hut.ao/features/achievements.html",
|
||||
[typeof(AnnouncementPage)] = "https://hut.ao/features/dashboard.html",
|
||||
[typeof(AvatarPropertyPage)] = "https://hut.ao/features/character-data.html",
|
||||
[typeof(CultivationPage)] = "https://hut.ao/features/develop-plan.html",
|
||||
[typeof(DailyNotePage)] = "https://hut.ao/features/real-time-notes.html",
|
||||
[typeof(GachaLogPage)] = "https://hut.ao/features/wish-export.html",
|
||||
[typeof(HutaoDatabasePage)] = "https://hut.ao/features/hutao-API.html",
|
||||
[typeof(HutaoPassportPage)] = "https://hut.ao/zh/features/hutao-settings.html#%E8%83%A1%E6%A1%83%E5%B8%90%E5%8F%B7",
|
||||
[typeof(LaunchGamePage)] = "https://hut.ao/features/game-launcher.html",
|
||||
[typeof(LoginHoyoverseUserPage)] = "https://hut.ao/features/mhy-account-switch.html",
|
||||
[typeof(LoginMihoyoUserPage)] = "https://hut.ao/features/mhy-account-switch.html",
|
||||
[typeof(SettingPage)] = "https://hut.ao/features/hutao-settings.html",
|
||||
[typeof(SpiralAbyssRecordPage)] = "https://hut.ao/features/dashboard.html",
|
||||
[typeof(TestPage)] = Home,
|
||||
[typeof(WikiAvatarPage)] = "https://hut.ao/features/character-wiki.html",
|
||||
[typeof(WikiMonsterPage)] = "https://hut.ao/features/monster-wiki.html",
|
||||
[typeof(WikiWeaponPage)] = "https://hut.ao/features/weapon-wiki.html",
|
||||
};
|
||||
|
||||
private readonly INavigationService navigationService;
|
||||
|
||||
public string GetDocumentation()
|
||||
{
|
||||
if (navigationService.Current is { } type)
|
||||
{
|
||||
return TypeDocumentations[type];
|
||||
}
|
||||
|
||||
return Home;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Service.Navigation;
|
||||
|
||||
internal interface IDocumentationProvider
|
||||
{
|
||||
string GetDocumentation();
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace Snap.Hutao.Service.Navigation;
|
||||
/// 导航服务
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
internal interface INavigationService : ICastService
|
||||
internal interface INavigationService : ICastService, INavigationCurrent
|
||||
{
|
||||
/// <summary>
|
||||
/// 导航到指定类型的页面
|
||||
@@ -48,3 +48,8 @@ internal interface INavigationService : ICastService
|
||||
/// </summary>
|
||||
void GoBack();
|
||||
}
|
||||
|
||||
internal interface INavigationCurrent
|
||||
{
|
||||
Type? Current { get; }
|
||||
}
|
||||
@@ -43,6 +43,8 @@ internal sealed class NavigationService : INavigationService, INavigationInitial
|
||||
paneClosedEventHandler = OnPaneStateChanged;
|
||||
}
|
||||
|
||||
public Type? Current { get => frame?.Content.GetType(); }
|
||||
|
||||
private NavigationView? NavigationView
|
||||
{
|
||||
get => navigationView;
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
<None Remove="Resource\Navigation\Cultivation.png" />
|
||||
<None Remove="Resource\Navigation\DailyNote.png" />
|
||||
<None Remove="Resource\Navigation\Database.png" />
|
||||
<None Remove="Resource\Navigation\Documentation.png" />
|
||||
<None Remove="Resource\Navigation\GachaLog.png" />
|
||||
<None Remove="Resource\Navigation\LaunchGame.png" />
|
||||
<None Remove="Resource\Navigation\SpiralAbyss.png" />
|
||||
@@ -224,6 +225,7 @@
|
||||
<Content Include="Resource\Navigation\Cultivation.png" />
|
||||
<Content Include="Resource\Navigation\DailyNote.png" />
|
||||
<Content Include="Resource\Navigation\Database.png" />
|
||||
<Content Include="Resource\Navigation\Documentation.png" />
|
||||
<Content Include="Resource\Navigation\GachaLog.png" />
|
||||
<Content Include="Resource\Navigation\LaunchGame.png" />
|
||||
<Content Include="Resource\Navigation\SpiralAbyss.png" />
|
||||
|
||||
@@ -20,6 +20,7 @@ internal partial class WebViewer : UserControl, IRecipient<UserChangedMessage>
|
||||
private readonly RoutedEventHandler loadEventHandler;
|
||||
private readonly RoutedEventHandler unloadEventHandler;
|
||||
|
||||
[SuppressMessage("", "IDE0052")]
|
||||
private MiHoYoJSInterface? jsInterface;
|
||||
private bool isFirstNavigate = true;
|
||||
|
||||
|
||||
@@ -16,31 +16,52 @@
|
||||
<mxi:Interaction.Behaviors>
|
||||
<shcb:InvokeCommandOnLoadedBehavior Command="{Binding OpenUICommand}"/>
|
||||
</mxi:Interaction.Behaviors>
|
||||
<StackPanel>
|
||||
<StackPanel Padding="0,4" Spacing="4">
|
||||
<StackPanel.Resources>
|
||||
<shc:BindingProxy x:Key="ViewModelBindingProxy" DataContext="{Binding}"/>
|
||||
|
||||
<StaticResource x:Key="ButtonBackground" ResourceKey="NavigationViewItemBackground"/>
|
||||
<StaticResource x:Key="ButtonBackgroundDisabled" ResourceKey="NavigationViewItemBackgroundDisabled"/>
|
||||
<StaticResource x:Key="ButtonBackgroundPointerOver" ResourceKey="NavigationViewItemBackgroundPointerOver"/>
|
||||
<StaticResource x:Key="ButtonBackgroundPressed" ResourceKey="NavigationViewItemBackgroundPressed"/>
|
||||
|
||||
<StaticResource x:Key="ButtonBorderBrush" ResourceKey="NavigationViewItemBorderBrush"/>
|
||||
<StaticResource x:Key="ButtonBorderBrushDisabled" ResourceKey="NavigationViewItemBorderBrushDisabled"/>
|
||||
<StaticResource x:Key="ButtonBorderBrushPointerOver" ResourceKey="NavigationViewItemBorderBrushPointerOver"/>
|
||||
<StaticResource x:Key="ButtonBorderBrushPressed" ResourceKey="NavigationViewItemBorderBrushPressed"/>
|
||||
|
||||
<StaticResource x:Key="ButtonForeground" ResourceKey="NavigationViewItemForeground"/>
|
||||
<StaticResource x:Key="ButtonForegroundDisabled" ResourceKey="NavigationViewItemForegroundDisabled"/>
|
||||
<StaticResource x:Key="ButtonForegroundPointerOver" ResourceKey="NavigationViewItemForegroundPointerOver"/>
|
||||
<StaticResource x:Key="ButtonForegroundPressed" ResourceKey="NavigationViewItemForegroundPressed"/>
|
||||
</StackPanel.Resources>
|
||||
|
||||
<Button
|
||||
Grid.Column="2"
|
||||
MaxHeight="40"
|
||||
Margin="4,4,4,6"
|
||||
Background="Transparent"
|
||||
BorderBrush="{x:Null}">
|
||||
<Button.Resources>
|
||||
<shc:BindingProxy x:Key="ViewModelBindingProxy" DataContext="{Binding}"/>
|
||||
Margin="4,0"
|
||||
Padding="6,6"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
Command="{Binding OpenDocumentationCommand}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<BitmapIcon
|
||||
Grid.Column="0"
|
||||
Width="24"
|
||||
Height="24"
|
||||
ShowAsMonochrome="False"
|
||||
UriSource="ms-appx:///Resource/Navigation/Documentation.png"/>
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="13,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{shcm:ResourceString Name=ViewUserDocumentationHeader}"/>
|
||||
</Grid>
|
||||
</Button>
|
||||
|
||||
<StaticResource x:Key="ButtonBackground" ResourceKey="NavigationViewItemBackground"/>
|
||||
<StaticResource x:Key="ButtonBackgroundDisabled" ResourceKey="NavigationViewItemBackgroundDisabled"/>
|
||||
<StaticResource x:Key="ButtonBackgroundPointerOver" ResourceKey="NavigationViewItemBackgroundPointerOver"/>
|
||||
<StaticResource x:Key="ButtonBackgroundPressed" ResourceKey="NavigationViewItemBackgroundPressed"/>
|
||||
|
||||
<StaticResource x:Key="ButtonBorderBrush" ResourceKey="NavigationViewItemBorderBrush"/>
|
||||
<StaticResource x:Key="ButtonBorderBrushDisabled" ResourceKey="NavigationViewItemBorderBrushDisabled"/>
|
||||
<StaticResource x:Key="ButtonBorderBrushPointerOver" ResourceKey="NavigationViewItemBorderBrushPointerOver"/>
|
||||
<StaticResource x:Key="ButtonBorderBrushPressed" ResourceKey="NavigationViewItemBorderBrushPressed"/>
|
||||
|
||||
<StaticResource x:Key="ButtonForeground" ResourceKey="NavigationViewItemForeground"/>
|
||||
<StaticResource x:Key="ButtonForegroundDisabled" ResourceKey="NavigationViewItemForegroundDisabled"/>
|
||||
<StaticResource x:Key="ButtonForegroundPointerOver" ResourceKey="NavigationViewItemForegroundPointerOver"/>
|
||||
<StaticResource x:Key="ButtonForegroundPressed" ResourceKey="NavigationViewItemForegroundPressed"/>
|
||||
</Button.Resources>
|
||||
<Button MaxHeight="40" Margin="4,0">
|
||||
<Button.Content>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -56,7 +77,7 @@
|
||||
ProfilePicture="{Binding SelectedUser.UserInfo.AvatarUrl, Mode=OneWay}"/>
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="0,0,0,2"
|
||||
Margin="1,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding SelectedUser.UserInfo.Nickname, Mode=OneWay}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
@@ -294,6 +315,7 @@
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
|
||||
<NavigationViewItemSeparator/>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -111,6 +111,12 @@ internal sealed partial class SettingViewModel : Abstraction.ViewModel
|
||||
AppInstance.Restart(string.Empty);
|
||||
}
|
||||
|
||||
[Command("StoreReviewCommand")]
|
||||
private static async Task StoreReviewAsync()
|
||||
{
|
||||
await Launcher.LaunchUriAsync(new("ms-windows-store://review/?ProductId=9PH4NXJ2JN52"));
|
||||
}
|
||||
|
||||
[Command("SetGamePathCommand")]
|
||||
private async Task SetGamePathAsync()
|
||||
{
|
||||
@@ -183,12 +189,6 @@ internal sealed partial class SettingViewModel : Abstraction.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
[Command("StoreReviewCommand")]
|
||||
private async Task StoreReviewAsync()
|
||||
{
|
||||
await Launcher.LaunchUriAsync(new("ms-windows-store://review/?ProductId=9PH4NXJ2JN52"));
|
||||
}
|
||||
|
||||
[Command("SetDataFolderCommand")]
|
||||
private async Task SetDataFolderAsync()
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@ using Snap.Hutao.View.Page;
|
||||
using Snap.Hutao.Web.Hoyolab;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using Windows.System;
|
||||
|
||||
namespace Snap.Hutao.ViewModel.User;
|
||||
|
||||
@@ -25,6 +26,7 @@ namespace Snap.Hutao.ViewModel.User;
|
||||
[Injection(InjectAs.Singleton)]
|
||||
internal sealed partial class UserViewModel : ObservableObject
|
||||
{
|
||||
private readonly IDocumentationProvider documentationProvider;
|
||||
private readonly INavigationService navigationService;
|
||||
private readonly IServiceProvider serviceProvider;
|
||||
private readonly IInfoBarService infoBarService;
|
||||
@@ -248,4 +250,10 @@ internal sealed partial class UserViewModel : ObservableObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Command("OpenDocumentationCommand")]
|
||||
private async Task OpenDocumentationAsync()
|
||||
{
|
||||
await Launcher.LaunchUriAsync(new(documentationProvider.GetDocumentation()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user