text hint improvement

This commit is contained in:
DismissedLight
2023-12-09 18:26:02 +08:00
parent 46c683c570
commit ecd17de279
8 changed files with 27 additions and 20 deletions

View File

@@ -64,6 +64,7 @@ IMemoryBufferByteAccess
// Const value
INFINITE
RPC_E_WRONG_THREAD
MAX_PATH
WM_GETMINMAXINFO
WM_HOTKEY

View File

@@ -19,7 +19,6 @@
Name="PlaceholderImage"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
Opacity="1.0"
Source="{TemplateBinding PlaceholderSource}"
Stretch="{TemplateBinding PlaceholderStretch}"/>
<Image
@@ -27,7 +26,6 @@
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
NineGrid="{TemplateBinding NineGrid}"
Opacity="0.0"
Stretch="{TemplateBinding Stretch}"/>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">

View File

@@ -80,19 +80,22 @@ internal abstract partial class CompositionImage : Microsoft.UI.Xaml.Controls.Co
ILogger<CompositionImage> logger = serviceProvider.GetRequiredService<ILogger<CompositionImage>>();
// source is valid
if (arg.NewValue is Uri inner && !string.IsNullOrEmpty(inner.OriginalString))
if (arg.NewValue is Uri inner)
{
// value is different from old one
if (inner != (arg.OldValue as Uri))
if (!string.IsNullOrEmpty(inner.OriginalString))
{
image
.ApplyImageAsync(inner, token)
.SafeForget(logger, ex => OnApplyImageFailed(serviceProvider, inner, ex));
// value is different from old one
if (inner != (arg.OldValue as Uri))
{
image
.ApplyImageAsync(inner, token)
.SafeForget(logger, ex => OnApplyImageFailed(serviceProvider, inner, ex));
}
}
else
{
image.HideAsync(token).SafeForget(logger);
}
}
else
{
image.HideAsync(token).SafeForget(logger);
}
}
@@ -130,8 +133,9 @@ internal abstract partial class CompositionImage : Microsoft.UI.Xaml.Controls.Co
{
imageSurface = await LoadImageSurfaceAsync(file, token).ConfigureAwait(true);
}
catch (COMException)
catch (COMException ex)
{
_ = ex;
imageCache.Remove(uri);
}
catch (IOException)
@@ -163,7 +167,7 @@ internal abstract partial class CompositionImage : Microsoft.UI.Xaml.Controls.Co
surface.LoadCompleted += loadedImageSourceLoadCompletedEventHandler;
if (surface.DecodedPhysicalSize.Size() <= 0D)
{
await surfaceLoadTaskCompletionSource.Task.ConfigureAwait(true);
await Task.WhenAny(surfaceLoadTaskCompletionSource.Task, Task.Delay(5000, token)).ConfigureAwait(true);
}
LoadImageSurfaceCompleted(surface);

View File

@@ -2133,7 +2133,7 @@
<value>预下载</value>
</data>
<data name="ViewPageLaunchGameSwitchAccountAttachUidNull" xml:space="preserve">
<value>该账号尚未绑定 UID</value>
<value>该账号尚未绑定实时便笺通知 UID</value>
</data>
<data name="ViewPageLaunchGameSwitchAccountAttachUidToolTip" xml:space="preserve">
<value>绑定当前用户的角色</value>

View File

@@ -7,6 +7,7 @@ using Snap.Hutao.Web.Hoyolab.Hk4e.Common.Announcement;
using Snap.Hutao.Web.Response;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
namespace Snap.Hutao.Service;
@@ -68,9 +69,9 @@ internal sealed partial class AnnouncementService : IAnnouncementService
private static void PreprocessAnnouncements(Dictionary<int, string> contentMap, List<AnnouncementListWrapper> announcementListWrappers)
{
// 将公告内容联入公告列表
foreach (ref AnnouncementListWrapper listWrapper in CollectionsMarshal.AsSpan(announcementListWrappers))
foreach (ref readonly AnnouncementListWrapper listWrapper in CollectionsMarshal.AsSpan(announcementListWrappers))
{
foreach (ref Announcement item in CollectionsMarshal.AsSpan(listWrapper.List))
foreach (ref readonly Announcement item in CollectionsMarshal.AsSpan(listWrapper.List))
{
contentMap.TryGetValue(item.AnnId, out string? rawContent);
item.Content = rawContent ?? string.Empty;
@@ -79,10 +80,11 @@ internal sealed partial class AnnouncementService : IAnnouncementService
AdjustAnnouncementTime(announcementListWrappers);
foreach (ref AnnouncementListWrapper listWrapper in CollectionsMarshal.AsSpan(announcementListWrappers))
foreach (ref readonly AnnouncementListWrapper listWrapper in CollectionsMarshal.AsSpan(announcementListWrappers))
{
foreach (ref Announcement item in CollectionsMarshal.AsSpan(listWrapper.List))
foreach (ref readonly Announcement item in CollectionsMarshal.AsSpan(listWrapper.List))
{
item.Subtitle = new StringBuilder(item.Subtitle).Replace("\r<br>", string.Empty).ToString();
item.Content = AnnouncementRegex.XmlTimeTagRegex.Replace(item.Content, x => x.Groups[1].Value);
}
}

View File

@@ -27,6 +27,7 @@ namespace Snap.Hutao.Service.Game.Package;
internal sealed partial class PackageConverter
{
private const string PackageVersion = "pkg_version";
private readonly JsonSerializerOptions options;
private readonly RuntimeOptions runtimeOptions;
private readonly HttpClient httpClient;

View File

@@ -51,7 +51,7 @@ internal sealed partial class LaunchGameViewModelSlim : Abstraction.ViewModelSli
}
}
[Command("LaunchCommand", AllowConcurrentExecutions = true)]
[Command("LaunchCommand")]
private async Task LaunchAsync()
{
IInfoBarService infoBarService = ServiceProvider.GetRequiredService<IInfoBarService>();

View File

@@ -21,6 +21,7 @@ internal sealed partial class FolderViewModel : ObservableObject
async ValueTask SetFolderSizeAsync()
{
await taskContext.SwitchToBackgroundAsync();
long totalSize = 0;
foreach (string file in Directory.EnumerateFiles(folder, "*.*", SearchOption.AllDirectories))