mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
fix #611
This commit is contained in:
@@ -61,8 +61,9 @@
|
||||
<!-- Uris -->
|
||||
<x:String x:Key="DocumentLink_MhyAccountSwitch">https://hut.ao/features/mhy-account-switch.html</x:String>
|
||||
<x:String x:Key="DocumentLink_BugReport">https://hut.ao/statements/bug-report.html</x:String>
|
||||
<x:String x:Key="HolographicHat_GetToken_Release">https://github.com/HolographicHat/GetToken/releases/latest</x:String>
|
||||
<x:String x:Key="DocumentLink_Translate">https://translate.hut.ao</x:String>
|
||||
<x:String x:Key="DocumentLink_Home">https://hut.ao</x:String>
|
||||
<x:String x:Key="HolographicHat_GetToken_Release">https://github.com/HolographicHat/GetToken/releases/latest</x:String>
|
||||
<x:String x:Key="Sponsor_Afadian">https://afdian.net/a/DismissedLight</x:String>
|
||||
|
||||
<x:String x:Key="UI_ItemIcon_None">https://static.snapgenshin.com/Bg/UI_ItemIcon_None.png</x:String>
|
||||
|
||||
@@ -15,7 +15,7 @@ internal static class CastableServiceExtension
|
||||
/// <typeparam name="T">目标转换类型</typeparam>
|
||||
/// <param name="service">对象</param>
|
||||
/// <returns>转换类型后的对象</returns>
|
||||
public static T? ImplictAs<T>(this ICastableService service)
|
||||
public static T? As<T>(this ICastableService service)
|
||||
where T : class
|
||||
{
|
||||
return service as T;
|
||||
|
||||
@@ -188,7 +188,7 @@ internal static class Activation
|
||||
|
||||
Ioc.Default
|
||||
.GetRequiredService<IMetadataService>()
|
||||
.ImplictAs<IMetadataServiceInitialization>()?
|
||||
.As<IMetadataServiceInitialization>()?
|
||||
.InitializeInternalAsync()
|
||||
.SafeForget();
|
||||
}
|
||||
|
||||
@@ -1950,6 +1950,24 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 该操作是不可逆的,所有用户登录状态会丢失 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string ViewDialogSettingDeleteUserDataContent {
|
||||
get {
|
||||
return ResourceManager.GetString("ViewDialogSettingDeleteUserDataContent", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 是否永久删除用户数据 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string ViewDialogSettingDeleteUserDataTitle {
|
||||
get {
|
||||
return ResourceManager.GetString("ViewDialogSettingDeleteUserDataTitle", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 立即前往 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -4290,6 +4308,15 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 前往官网 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string ViewPageSettingOfficialSiteNavigate {
|
||||
get {
|
||||
return ResourceManager.GetString("ViewPageSettingOfficialSiteNavigate", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 重置 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -1788,4 +1788,13 @@
|
||||
<data name="ViewDialogUserTitle" xml:space="preserve">
|
||||
<value>设置 Cookie</value>
|
||||
</data>
|
||||
<data name="ViewPageSettingOfficialSiteNavigate" xml:space="preserve">
|
||||
<value>前往官网</value>
|
||||
</data>
|
||||
<data name="ViewDialogSettingDeleteUserDataContent" xml:space="preserve">
|
||||
<value>该操作是不可逆的,所有用户登录状态会丢失</value>
|
||||
</data>
|
||||
<data name="ViewDialogSettingDeleteUserDataTitle" xml:space="preserve">
|
||||
<value>是否永久删除用户数据</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -18,52 +18,56 @@
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="16,16,24,16" Spacing="{StaticResource SettingsCardSpacing}">
|
||||
<Border Height="240" Style="{StaticResource BorderCardStyle}">
|
||||
<Border Height="280" Style="{StaticResource BorderCardStyle}">
|
||||
<Grid>
|
||||
<Image
|
||||
VerticalAlignment="Center"
|
||||
Source="ms-appx:///Assets/Square44x44Logo.targetsize-256.png"
|
||||
Stretch="UniformToFill"/>
|
||||
<Grid Background="{ThemeResource AcrylicInAppFillColorDefaultBrush}">
|
||||
<Image Margin="48" Source="ms-appx:///Assets/Square44x44Logo.targetsize-256.png"/>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Image
|
||||
Grid.Row="0"
|
||||
Margin="48"
|
||||
Source="ms-appx:///Assets/Square44x44Logo.targetsize-256.png"/>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="8"
|
||||
VerticalAlignment="Bottom"
|
||||
Orientation="Horizontal">
|
||||
<HyperlinkButton
|
||||
Margin="0,0,0,0"
|
||||
Command="{Binding UpdateCheckCommand}"
|
||||
Content="{shcm:ResourceString Name=ViewPageSettingUpdateCheckAction}"/>
|
||||
<HyperlinkButton
|
||||
Margin="12,0,0,0"
|
||||
Content="{shcm:ResourceString Name=ViewPageSettingOfficialSiteNavigate}"
|
||||
NavigateUri="{StaticResource DocumentLink_Home}"/>
|
||||
<HyperlinkButton
|
||||
Margin="12,0,0,0"
|
||||
Content="{shcm:ResourceString Name=ViewPageSettingFeedbackNavigate}"
|
||||
NavigateUri="{StaticResource DocumentLink_BugReport}"/>
|
||||
<HyperlinkButton
|
||||
Margin="12,0,0,0"
|
||||
Content="{shcm:ResourceString Name=ViewPageSettingTranslateNavigate}"
|
||||
NavigateUri="{StaticResource DocumentLink_Translate}"/>
|
||||
<HyperlinkButton
|
||||
Margin="12,0,0,0"
|
||||
Content="{shcm:ResourceString Name=ViewPageSettingSponsorNavigate}"
|
||||
NavigateUri="{StaticResource Sponsor_Afadian}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Margin="0,4"
|
||||
Text="Copyright © 2022 - 2023 DGP Studio. All Rights Reserved."
|
||||
TextWrapping="Wrap"/>
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" Text="{shcm:ResourceString Name=ViewPageSettingAboutHeader}"/>
|
||||
<Grid Margin="0,4,0,16" RowSpacing="8">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Bottom"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="{shcm:ResourceString Name=ViewPageSettingLinks}"/>
|
||||
<HyperlinkButton
|
||||
Margin="12,0,0,0"
|
||||
Command="{Binding UpdateCheckCommand}"
|
||||
Content="{shcm:ResourceString Name=ViewPageSettingUpdateCheckAction}"/>
|
||||
<HyperlinkButton
|
||||
Margin="12,0,0,0"
|
||||
Content="{shcm:ResourceString Name=ViewPageSettingFeedbackNavigate}"
|
||||
NavigateUri="{StaticResource DocumentLink_BugReport}"/>
|
||||
<HyperlinkButton
|
||||
Margin="12,0,0,0"
|
||||
Content="{shcm:ResourceString Name=ViewPageSettingTranslateNavigate}"
|
||||
NavigateUri="{StaticResource DocumentLink_Translate}"/>
|
||||
<HyperlinkButton
|
||||
Margin="12,0,0,0"
|
||||
Content="{shcm:ResourceString Name=ViewPageSettingSponsorNavigate}"
|
||||
NavigateUri="{StaticResource Sponsor_Afadian}"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
<clw:SettingsCard
|
||||
Description="{Binding AppVersion}"
|
||||
Header="{shcm:ResourceString Name=AppName}"
|
||||
|
||||
@@ -5,7 +5,9 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.Windows.AppLifecycle;
|
||||
using Snap.Hutao.Factory.Abstraction;
|
||||
using Snap.Hutao.Model.Entity.Database;
|
||||
using Snap.Hutao.Service.Abstraction;
|
||||
using Windows.Storage;
|
||||
@@ -64,9 +66,18 @@ internal sealed class ExperimentalFeaturesViewModel : ObservableObject
|
||||
{
|
||||
using (IServiceScope scope = serviceProvider.CreateScope())
|
||||
{
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
await appDbContext.Users.ExecuteDeleteAsync().ConfigureAwait(false);
|
||||
AppInstance.Restart(string.Empty);
|
||||
ContentDialogResult result = await scope.ServiceProvider
|
||||
.GetRequiredService<IContentDialogFactory>()
|
||||
.ConfirmCancelAsync(SH.ViewDialogSettingDeleteUserDataTitle, SH.ViewDialogSettingDeleteUserDataContent)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (result == ContentDialogResult.Primary)
|
||||
{
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
await appDbContext.Users.ExecuteDeleteAsync().ConfigureAwait(false);
|
||||
|
||||
AppInstance.Restart(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,7 +204,7 @@ internal sealed class WelcomeViewModel : ObservableObject
|
||||
|
||||
private void ExtractFiles(string file)
|
||||
{
|
||||
IImageCacheFilePathOperation imageCache = serviceProvider.GetRequiredService<IImageCache>().ImplictAs<IImageCacheFilePathOperation>()!;
|
||||
IImageCacheFilePathOperation imageCache = serviceProvider.GetRequiredService<IImageCache>().As<IImageCacheFilePathOperation>()!;
|
||||
try
|
||||
{
|
||||
using (ZipArchive archive = ZipFile.OpenRead(file))
|
||||
|
||||
Reference in New Issue
Block a user