mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
fix window issue
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Windowing;
|
||||
using Snap.Hutao.Core.Setting;
|
||||
using Snap.Hutao.Win32;
|
||||
using System.Runtime.InteropServices;
|
||||
using Windows.Graphics;
|
||||
using Windows.Win32.Foundation;
|
||||
@@ -25,11 +26,11 @@ internal static class Persistence
|
||||
// Set first launch size.
|
||||
HWND hwnd = (HWND)Win32Interop.GetWindowFromWindowId(appWindow.Id);
|
||||
SizeInt32 size = TransformSizeForWindow(new(1200, 741), hwnd);
|
||||
RectInt32 rect = new(0, 0, size.Width, size.Height);
|
||||
RectInt32 rect = StructMarshal.RectInt32(size);
|
||||
|
||||
// Make it centralized
|
||||
TransformToCenterScreen(ref rect);
|
||||
RectInt32 target = (CompactRect)LocalSetting.Get(SettingKeys.WindowRect, (ulong)(CompactRect)rect);
|
||||
//if(target.Width*target.Height)
|
||||
TransformToCenterScreen(ref target);
|
||||
appWindow.MoveAndResize(target);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public class DetailedCertification : Certification
|
||||
/// Id
|
||||
/// </summary>
|
||||
[JsonPropertyName("id")]
|
||||
public int Id { get; set; }
|
||||
public string Id { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 认证Id
|
||||
|
||||
@@ -7,7 +7,7 @@ using Windows.Win32.System.Diagnostics.ToolHelp;
|
||||
namespace Snap.Hutao.Win32;
|
||||
|
||||
/// <summary>
|
||||
/// 内存拓展
|
||||
/// 内存拓展 for <see cref="Memory{T}"/> <see cref="Span{T}"/>
|
||||
/// </summary>
|
||||
internal static class MemoryExtensions
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Windows.Graphics;
|
||||
using Windows.Win32.System.Diagnostics.ToolHelp;
|
||||
|
||||
namespace Snap.Hutao.Win32;
|
||||
@@ -19,6 +20,16 @@ internal static class StructMarshal
|
||||
return new() { dwSize = (uint)sizeof(MODULEENTRY32) };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构造一个新的<see cref="Windows.Graphics.RectInt32"/>
|
||||
/// </summary>
|
||||
/// <param name="size">尺寸</param>
|
||||
/// <returns>新的实例</returns>
|
||||
public static RectInt32 RectInt32(SizeInt32 size)
|
||||
{
|
||||
return new(0, 0, size.Width, size.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断结构实例是否为默认结构
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user