mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
Compare commits
5 Commits
fix/1571
...
feat/custo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70da292f21 | ||
|
|
97c5e7d37f | ||
|
|
388f9d5657 | ||
|
|
74e11f3823 | ||
|
|
c1305cda43 |
@@ -48,7 +48,6 @@ internal sealed class WindowSubclass : IDisposable
|
||||
{
|
||||
windowProc = OnSubclassProcedure;
|
||||
bool windowHooked = SetWindowSubclass(options.Hwnd, windowProc, WindowSubclassId, 0);
|
||||
bool propHooked = SetPropW(options.Hwnd, "NonRudeHWND", BOOL.TRUE);
|
||||
hotKeyController.RegisterAll();
|
||||
|
||||
bool titleBarHooked = true;
|
||||
@@ -56,7 +55,7 @@ internal sealed class WindowSubclass : IDisposable
|
||||
// only hook up drag bar proc when use legacy Window.ExtendsContentIntoTitleBar
|
||||
if (!options.UseLegacyDragBarImplementation)
|
||||
{
|
||||
return windowHooked && propHooked && titleBarHooked;
|
||||
return windowHooked && titleBarHooked;
|
||||
}
|
||||
|
||||
titleBarHooked = false;
|
||||
@@ -64,13 +63,13 @@ internal sealed class WindowSubclass : IDisposable
|
||||
|
||||
if (hwndDragBar.IsNull)
|
||||
{
|
||||
return windowHooked && propHooked && titleBarHooked;
|
||||
return windowHooked && titleBarHooked;
|
||||
}
|
||||
|
||||
legacyDragBarProc = OnLegacyDragBarProcedure;
|
||||
titleBarHooked = SetWindowSubclass(hwndDragBar, legacyDragBarProc, DragBarSubclassId, 0);
|
||||
|
||||
return windowHooked && propHooked && titleBarHooked;
|
||||
return windowHooked && titleBarHooked;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -79,7 +78,6 @@ internal sealed class WindowSubclass : IDisposable
|
||||
hotKeyController.UnregisterAll();
|
||||
|
||||
RemoveWindowSubclass(options.Hwnd, windowProc, WindowSubclassId);
|
||||
RemovePropW(options.Hwnd, "NonRudeHWND");
|
||||
windowProc = default!;
|
||||
|
||||
if (options.UseLegacyDragBarImplementation)
|
||||
|
||||
@@ -1361,6 +1361,18 @@
|
||||
<data name="ViewDialogSettingDeleteUserDataTitle" xml:space="preserve">
|
||||
<value>是否永久删除用户数据</value>
|
||||
</data>
|
||||
<data name="ViewDialogSpiralAbyssUploadRecordHomaNotLoginCloseButtonText" xml:space="preserve">
|
||||
<value>前往登录</value>
|
||||
</data>
|
||||
<data name="ViewDialogSpiralAbyssUploadRecordHomaNotLoginHint" xml:space="preserve">
|
||||
<value>当前未登录胡桃账号,上传深渊数据无法获赠胡桃云时长</value>
|
||||
</data>
|
||||
<data name="ViewDialogSpiralAbyssUploadRecordHomaNotLoginPrimaryButtonText" xml:space="preserve">
|
||||
<value>继续上传</value>
|
||||
</data>
|
||||
<data name="ViewDialogSpiralAbyssUploadRecordHomaNotLoginTitle" xml:space="preserve">
|
||||
<value>上传深渊数据</value>
|
||||
</data>
|
||||
<data name="ViewDialogUpdatePackageDownloadUpdatelogLinkContent" xml:space="preserve">
|
||||
<value>查看更新日志</value>
|
||||
</data>
|
||||
|
||||
@@ -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\SpiralAbyssUploadRecordHomaNotLoginDialog.xaml" />
|
||||
<None Remove="View\Dialog\UpdatePackageDownloadConfirmDialog.xaml" />
|
||||
<None Remove="View\Dialog\UserDialog.xaml" />
|
||||
<None Remove="View\Dialog\UserQRCodeDialog.xaml" />
|
||||
@@ -354,6 +355,11 @@
|
||||
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnablePreviewMsixTooling)'=='true'">
|
||||
<ProjectCapability Include="Msix" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="View\Dialog\SpiralAbyssUploadRecordHomaNotLoginDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="View\Dialog\UpdatePackageDownloadConfirmDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
PlaceholderText="{shcm:ResourceString Name=ViewPageHutaoPassportUserNameHint}"
|
||||
Text="{x:Bind UserName, Mode=TwoWay}"/>
|
||||
<PasswordBox
|
||||
Width="360"
|
||||
MaxWidth="360"
|
||||
Margin="0,16,0,0"
|
||||
Password="{x:Bind Password, Mode=TwoWay}"
|
||||
PlaceholderText="{shcm:ResourceString Name=ViewPageHutaoPassportPasswordHint}"/>
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
Content="{shcm:ResourceString Name=ViewPageHutaoPassportVerifyCodeAction}"/>
|
||||
</Grid>
|
||||
<PasswordBox
|
||||
Width="360"
|
||||
MaxWidth="360"
|
||||
Margin="0,16,0,0"
|
||||
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource StringBoolConverter}, Mode=OneWay}"
|
||||
Password="{x:Bind Password, Mode=TwoWay}"
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
Content="{shcm:ResourceString Name=ViewPageHutaoPassportVerifyCodeAction}"/>
|
||||
</Grid>
|
||||
<PasswordBox
|
||||
Width="360"
|
||||
MaxWidth="360"
|
||||
Margin="0,16,0,0"
|
||||
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource StringBoolConverter}, Mode=OneWay}"
|
||||
Password="{x:Bind Password, Mode=TwoWay}"
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
Content="{shcm:ResourceString Name=ViewPageHutaoPassportVerifyCodeAction}"/>
|
||||
</Grid>
|
||||
<PasswordBox
|
||||
Width="360"
|
||||
MaxWidth="360"
|
||||
Margin="0,16,0,0"
|
||||
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource StringBoolConverter}, Mode=OneWay}"
|
||||
Password="{x:Bind Password, Mode=TwoWay}"
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<ContentDialog
|
||||
x:Class="Snap.Hutao.View.Dialog.SpiralAbyssUploadRecordHomaNotLoginDialog"
|
||||
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"
|
||||
Title="{shcm:ResourceString Name=ViewDialogSpiralAbyssUploadRecordHomaNotLoginTitle}"
|
||||
CloseButtonText="{shcm:ResourceString Name=ViewDialogSpiralAbyssUploadRecordHomaNotLoginCloseButtonText}"
|
||||
DefaultButton="Close"
|
||||
PrimaryButtonText="{shcm:ResourceString Name=ViewDialogSpiralAbyssUploadRecordHomaNotLoginPrimaryButtonText}"
|
||||
Style="{StaticResource DefaultContentDialogStyle}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<TextBlock Text="{shcm:ResourceString Name=ViewDialogSpiralAbyssUploadRecordHomaNotLoginHint}"/>
|
||||
</ContentDialog>
|
||||
@@ -0,0 +1,24 @@
|
||||
// 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 SpiralAbyssUploadRecordHomaNotLoginDialog : ContentDialog
|
||||
{
|
||||
private readonly ITaskContext taskContext;
|
||||
|
||||
public SpiralAbyssUploadRecordHomaNotLoginDialog(IServiceProvider serviceProvider)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
taskContext = serviceProvider.GetRequiredService<ITaskContext>();
|
||||
}
|
||||
|
||||
public async ValueTask<bool> ConfirmAsync()
|
||||
{
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
return await ShowAsync() is ContentDialogResult.Primary;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,16 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Snap.Hutao.Factory.ContentDialog;
|
||||
using Snap.Hutao.Message;
|
||||
using Snap.Hutao.Service.Hutao;
|
||||
using Snap.Hutao.Service.Navigation;
|
||||
using Snap.Hutao.Service.Notification;
|
||||
using Snap.Hutao.Service.SpiralAbyss;
|
||||
using Snap.Hutao.Service.User;
|
||||
using Snap.Hutao.View.Dialog;
|
||||
using Snap.Hutao.View.Page;
|
||||
using Snap.Hutao.ViewModel.Complex;
|
||||
using Snap.Hutao.ViewModel.User;
|
||||
using Snap.Hutao.Web.Hutao.Response;
|
||||
@@ -24,11 +30,14 @@ namespace Snap.Hutao.ViewModel.SpiralAbyss;
|
||||
internal sealed partial class SpiralAbyssRecordViewModel : Abstraction.ViewModel, IRecipient<UserChangedMessage>
|
||||
{
|
||||
private readonly ISpiralAbyssRecordService spiralAbyssRecordService;
|
||||
private readonly IContentDialogFactory contentDialogFactory;
|
||||
private readonly HutaoSpiralAbyssClient spiralAbyssClient;
|
||||
private readonly INavigationService navigationService;
|
||||
private readonly IInfoBarService infoBarService;
|
||||
private readonly ITaskContext taskContext;
|
||||
private readonly IUserService userService;
|
||||
private readonly HutaoDatabaseViewModel hutaoDatabaseViewModel;
|
||||
private readonly HutaoUserOptions hutaoUserOptions;
|
||||
|
||||
private ObservableCollection<SpiralAbyssView>? spiralAbyssEntries;
|
||||
private SpiralAbyssView? selectedView;
|
||||
@@ -128,6 +137,20 @@ internal sealed partial class SpiralAbyssRecordViewModel : Abstraction.ViewModel
|
||||
{
|
||||
if (UserAndUid.TryFromUser(userService.Current, out UserAndUid? userAndUid))
|
||||
{
|
||||
if (!hutaoUserOptions.IsLoggedIn)
|
||||
{
|
||||
SpiralAbyssUploadRecordHomaNotLoginDialog dialog = await contentDialogFactory
|
||||
.CreateInstanceAsync<SpiralAbyssUploadRecordHomaNotLoginDialog>()
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (!await dialog.ConfirmAsync().ConfigureAwait(false))
|
||||
{
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
await navigationService.NavigateAsync<SettingPage>(INavigationAwaiter.Default, true).ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SimpleRecord? record = await spiralAbyssClient.GetPlayerRecordAsync(userAndUid).ConfigureAwait(false);
|
||||
if (record is not null)
|
||||
{
|
||||
|
||||
@@ -85,19 +85,6 @@ internal static class User32
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern int ReleaseDC([AllowNull] HWND hWnd, HDC hDC);
|
||||
|
||||
[DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern HANDLE RemovePropW(HWND hWnd, PCWSTR lpString);
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe HANDLE RemovePropW(HWND hWnd, string str)
|
||||
{
|
||||
fixed (char* lpString = str)
|
||||
{
|
||||
return RemovePropW(hWnd, lpString);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true, SetLastError = true)]
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static unsafe extern uint SendInput(uint cInputs, INPUT* pInputs, int cbSize);
|
||||
@@ -115,19 +102,6 @@ internal static class User32
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern BOOL SetForegroundWindow(HWND hWnd);
|
||||
|
||||
[DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern BOOL SetPropW(HWND hWnd, PCWSTR lpString, [AllowNull] nint hData);
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe BOOL SetPropW(HWND hWnd, string str, [AllowNull] nint hData)
|
||||
{
|
||||
fixed (char* lpString = str)
|
||||
{
|
||||
return SetPropW(hWnd, lpString, hData);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern nint SetWindowLongPtrW(HWND hWnd, WINDOW_LONG_PTR_INDEX nIndex, nint dwNewLong);
|
||||
|
||||
Reference in New Issue
Block a user