mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
impl #1550
This commit is contained in:
@@ -1361,6 +1361,9 @@
|
||||
<data name="ViewDialogSettingDeleteUserDataTitle" xml:space="preserve">
|
||||
<value>是否永久删除用户数据</value>
|
||||
</data>
|
||||
<data name="ViewDialogUpdatePackageDownloadUpdatelogLinkContent" xml:space="preserve">
|
||||
<value>查看更新日志</value>
|
||||
</data>
|
||||
<data name="ViewDialogUserDocumentAction" xml:space="preserve">
|
||||
<value>立即前往</value>
|
||||
</data>
|
||||
@@ -2889,7 +2892,7 @@
|
||||
<value>上传数据</value>
|
||||
</data>
|
||||
<data name="ViewTitileUpdatePackageDownloadContent" xml:space="preserve">
|
||||
<value>是否立即下载</value>
|
||||
<value>是否立即下载?</value>
|
||||
</data>
|
||||
<data name="ViewTitileUpdatePackageDownloadFailedMessage" xml:space="preserve">
|
||||
<value>下载更新失败</value>
|
||||
|
||||
@@ -181,6 +181,7 @@
|
||||
<None Remove="View\Dialog\LaunchGameConfigurationFixDialog.xaml" />
|
||||
<None Remove="View\Dialog\LaunchGamePackageConvertDialog.xaml" />
|
||||
<None Remove="View\Dialog\ReconfirmDialog.xaml" />
|
||||
<None Remove="View\Dialog\UpdatePackageDownloadConfirmDialog.xaml" />
|
||||
<None Remove="View\Dialog\UserDialog.xaml" />
|
||||
<None Remove="View\Dialog\UserQRCodeDialog.xaml" />
|
||||
<None Remove="View\Guide\GuideView.xaml" />
|
||||
@@ -349,6 +350,11 @@
|
||||
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnablePreviewMsixTooling)'=='true'">
|
||||
<ProjectCapability Include="Msix" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="View\Dialog\UpdatePackageDownloadConfirmDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="View\Dialog\LaunchGameConfigurationFixDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<ContentDialog
|
||||
x:Class="Snap.Hutao.View.Dialog.UpdatePackageDownloadConfirmDialog"
|
||||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||
CloseButtonText="{shcm:ResourceString Name=ContentDialogCancelCloseButtonText}"
|
||||
DefaultButton="Primary"
|
||||
PrimaryButtonText="{shcm:ResourceString Name=ContentDialogConfirmPrimaryButtonText}"
|
||||
Style="{ThemeResource DefaultContentDialogStyle}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<StackPanel Spacing="16">
|
||||
<TextBlock Text="">
|
||||
<Run Text="{shcm:ResourceString Name=ViewTitileUpdatePackageDownloadContent}"/>
|
||||
<Hyperlink NavigateUri="https://hut.ao/statements/update-log.html">
|
||||
<Run Text="{shcm:ResourceString Name=ViewDialogUpdatePackageDownloadUpdatelogLinkContent}"/>
|
||||
</Hyperlink>
|
||||
<!-- We leave a Run here to prevent the Hyperlink Stretch -->
|
||||
<Run/>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</ContentDialog>
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Snap.Hutao.View.Dialog;
|
||||
|
||||
internal sealed partial class UpdatePackageDownloadConfirmDialog : ContentDialog
|
||||
{
|
||||
public UpdatePackageDownloadConfirmDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ using Snap.Hutao.Factory.Progress;
|
||||
using Snap.Hutao.Service.Abstraction;
|
||||
using Snap.Hutao.Service.Notification;
|
||||
using Snap.Hutao.Service.Update;
|
||||
using Snap.Hutao.View.Dialog;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
@@ -69,14 +70,15 @@ internal sealed partial class TitleViewModel : Abstraction.ViewModel
|
||||
|
||||
if (checkUpdateResult.Kind is CheckUpdateResultKind.NeedDownload)
|
||||
{
|
||||
ContentDialogResult downloadUpdateUserConsentResult = await contentDialogFactory
|
||||
.CreateForConfirmCancelAsync(
|
||||
SH.FormatViewTitileUpdatePackageDownloadTitle(UpdateStatus?.Version),
|
||||
SH.ViewTitileUpdatePackageDownloadContent,
|
||||
ContentDialogButton.Primary)
|
||||
UpdatePackageDownloadConfirmDialog dialog = await contentDialogFactory
|
||||
.CreateInstanceAsync<UpdatePackageDownloadConfirmDialog>()
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (downloadUpdateUserConsentResult is ContentDialogResult.Primary)
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
|
||||
dialog.Title = SH.FormatViewTitileUpdatePackageDownloadTitle(UpdateStatus?.Version);
|
||||
|
||||
if (await dialog.ShowAsync() is ContentDialogResult.Primary)
|
||||
{
|
||||
// This method will set CheckUpdateResult.Kind to NeedInstall if download success
|
||||
if (!await DownloadPackageAsync(progress, checkUpdateResult).ConfigureAwait(false))
|
||||
|
||||
Reference in New Issue
Block a user