mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
fix QA issues
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
using Snap.Hutao.Win32.Foundation;
|
||||
using System.Numerics;
|
||||
using Windows.Foundation;
|
||||
using Windows.Graphics;
|
||||
|
||||
namespace Snap.Hutao.Core.Graphics;
|
||||
@@ -14,6 +15,11 @@ internal static class RectInt32Convert
|
||||
return new(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
|
||||
}
|
||||
|
||||
public static RectInt32 RectInt32(Point position, Vector2 size)
|
||||
{
|
||||
return new((int)position.X, (int)position.Y, (int)size.X, (int)size.Y);
|
||||
}
|
||||
|
||||
public static RectInt32 RectInt32(int x, int y, Vector2 size)
|
||||
{
|
||||
return new(x, y, (int)size.X, (int)size.Y);
|
||||
|
||||
@@ -27,6 +27,8 @@ internal sealed partial class UserInitializationService : IUserInitializationSer
|
||||
if (!await InitializeUserAsync(user, token).ConfigureAwait(false))
|
||||
{
|
||||
user.UserInfo = new() { Nickname = SH.ModelBindingUserInitializationFailed };
|
||||
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
user.UserGameRoles = [];
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@ using Snap.Hutao.UI.Xaml.Media.Backdrop;
|
||||
using Snap.Hutao.Win32.Foundation;
|
||||
using Snap.Hutao.Win32.Graphics.Dwm;
|
||||
using Snap.Hutao.Win32.UI.WindowsAndMessaging;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Windows.Foundation;
|
||||
using Windows.Graphics;
|
||||
using Windows.UI;
|
||||
using static Snap.Hutao.Win32.DwmApi;
|
||||
@@ -106,17 +108,17 @@ internal sealed class XamlWindowController
|
||||
|
||||
if (XamlApplicationLifetime.LaunchedWithNotifyIcon && !XamlApplicationLifetime.Exiting)
|
||||
{
|
||||
if (!IsNotifyIconVisible())
|
||||
{
|
||||
new AppNotificationBuilder()
|
||||
.AddText(SH.CoreWindowingNotifyIconPromotedHint)
|
||||
.Show();
|
||||
}
|
||||
|
||||
ICurrentXamlWindowReference currentXamlWindowReference = serviceProvider.GetRequiredService<ICurrentXamlWindowReference>();
|
||||
if (currentXamlWindowReference.Window == window)
|
||||
{
|
||||
currentXamlWindowReference.Window = default!;
|
||||
|
||||
if (!IsNotifyIconVisible())
|
||||
{
|
||||
new AppNotificationBuilder()
|
||||
.AddText(SH.CoreWindowingNotifyIconPromotedHint)
|
||||
.Show();
|
||||
}
|
||||
}
|
||||
|
||||
GC.Collect(GC.MaxGeneration);
|
||||
@@ -150,7 +152,7 @@ internal sealed class XamlWindowController
|
||||
|
||||
RECT iconRect = serviceProvider.GetRequiredService<NotifyIconController>().GetRect();
|
||||
|
||||
if (UniversalApiContract.IsPresent(WindowsVersion.Windows11))
|
||||
if (Core.UniversalApiContract.IsPresent(WindowsVersion.Windows11))
|
||||
{
|
||||
RECT primaryRect = DisplayArea.Primary.OuterBounds.ToRECT();
|
||||
return IntersectRect(out _, in primaryRect, in iconRect);
|
||||
@@ -331,8 +333,13 @@ internal sealed class XamlWindowController
|
||||
return;
|
||||
}
|
||||
|
||||
RectInt32 dragRect = RectInt32Convert.RectInt32(0, 0, xamlWindow.TitleBarAccess.ActualSize).Scale(window.GetRasterizationScale());
|
||||
window.GetInputNonClientPointerSource().SetRegionRects(NonClientRegionKind.Caption, [dragRect]);
|
||||
// E_UNEXPECTED will be thrown if the Content is not loaded.
|
||||
if (xamlWindow.TitleBarAccess.IsLoaded)
|
||||
{
|
||||
Point position = xamlWindow.TitleBarAccess.TransformToVisual(window.Content).TransformPoint(default);
|
||||
RectInt32 dragRect = RectInt32Convert.RectInt32(position, xamlWindow.TitleBarAccess.ActualSize).Scale(window.GetRasterizationScale());
|
||||
window.GetInputNonClientPointerSource().SetRegionRects(NonClientRegionKind.Caption, [dragRect]);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -50,7 +50,7 @@
|
||||
PanePlacement="Right">
|
||||
<SplitView.Pane>
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="16" Spacing="3">
|
||||
<StackPanel Margin="16" Spacing="16">
|
||||
<Border cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
||||
<Border Style="{ThemeResource AcrylicBorderCardStyle}">
|
||||
<cwcont:SettingsExpander
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<RowDefinition Height="44"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid x:Name="TitleArea">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
@@ -21,22 +21,28 @@
|
||||
<Button
|
||||
x:Name="GoBackButton"
|
||||
Grid.Column="0"
|
||||
MinWidth="42"
|
||||
Height="44"
|
||||
MinWidth="44"
|
||||
Command="{x:Bind GoBackCommand}"
|
||||
FontSize="12"
|
||||
Style="{StaticResource NavigationBackButtonSmallStyle}"/>
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
MinWidth="42"
|
||||
Height="44"
|
||||
MinWidth="44"
|
||||
Command="{x:Bind RefreshCommand}"
|
||||
Content=""
|
||||
FontSize="12"
|
||||
Style="{StaticResource NavigationBackButtonSmallStyle}"/>
|
||||
<TextBlock
|
||||
x:Name="DocumentTitle"
|
||||
<Grid
|
||||
x:Name="TitleArea"
|
||||
Grid.Column="2"
|
||||
Margin="12,0,0,0"
|
||||
VerticalAlignment="Center"/>
|
||||
IsHitTestVisible="False">
|
||||
<TextBlock
|
||||
x:Name="DocumentTitle"
|
||||
Margin="12,0,0,0"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<WebView2
|
||||
x:Name="WebView"
|
||||
|
||||
@@ -13,7 +13,7 @@ internal interface IViewModel : IPageScoped, IResurrectable
|
||||
|
||||
SemaphoreSlim DisposeLock { get; set; }
|
||||
|
||||
IDeferContentLoader DeferContentLoader { get; set; }
|
||||
IDeferContentLoader? DeferContentLoader { get; set; }
|
||||
|
||||
bool IsViewDisposed { get; set; }
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ internal abstract partial class ViewModel : ObservableObject, IViewModel
|
||||
|
||||
public SemaphoreSlim DisposeLock { get; set; } = new(1);
|
||||
|
||||
public IDeferContentLoader DeferContentLoader { get; set; } = default!;
|
||||
public IDeferContentLoader? DeferContentLoader { get; set; }
|
||||
|
||||
public bool IsViewDisposed { get; set; }
|
||||
|
||||
@@ -39,7 +39,7 @@ internal abstract partial class ViewModel : ObservableObject, IViewModel
|
||||
{
|
||||
UninitializeOverride();
|
||||
IsViewDisposed = true;
|
||||
DeferContentLoader = default!;
|
||||
DeferContentLoader = default;
|
||||
}
|
||||
|
||||
[Command("LoadCommand")]
|
||||
|
||||
@@ -67,7 +67,7 @@ internal sealed partial class AnnouncementViewModel : Abstraction.ViewModel
|
||||
AnnouncementWrapper announcementWrapper = await announcementService.GetAnnouncementWrapperAsync(cultureOptions.LanguageCode, appOptions.Region, CancellationToken).ConfigureAwait(false);
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
Announcement = announcementWrapper;
|
||||
DeferContentLoader.Load("GameAnnouncementPivot");
|
||||
DeferContentLoader?.Load("GameAnnouncementPivot");
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
@@ -81,7 +81,7 @@ internal sealed partial class AnnouncementViewModel : Abstraction.ViewModel
|
||||
ObservableCollection<Web.Hutao.HutaoAsAService.Announcement> hutaoAnnouncements = await hutaoAsAService.GetHutaoAnnouncementCollectionAsync().ConfigureAwait(false);
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
HutaoAnnouncements = hutaoAnnouncements;
|
||||
DeferContentLoader.Load("HutaoAnnouncementControl");
|
||||
DeferContentLoader?.Load("HutaoAnnouncementControl");
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user