fix hotkey can't register

This commit is contained in:
DismissedLight
2024-06-14 11:05:56 +08:00
parent 107963b7ac
commit 7ff78def46
2 changed files with 1 additions and 3 deletions

View File

@@ -21,8 +21,6 @@ namespace Snap.Hutao.Control.Image;
[DependencyProperty("CachedName", typeof(string), "Unknown")]
internal sealed partial class CachedImage : Implementation.ImageEx
{
private string? file;
/// <summary>
/// 构造一个新的缓存图像
/// </summary>
@@ -43,7 +41,6 @@ internal sealed partial class CachedImage : Implementation.ImageEx
HutaoException.ThrowIf(string.IsNullOrEmpty(imageUri.Host), SH.ControlImageCachedImageInvalidResourceUri);
string file = await imageCache.GetFileFromCacheAsync(imageUri).ConfigureAwait(true); // BitmapImage need to be created by main thread.
CachedName = Path.GetFileName(file);
this.file = file;
token.ThrowIfCancellationRequested(); // check token state to determine whether the operation should be canceled.
return file.ToUri();
}

View File

@@ -76,6 +76,7 @@ internal sealed partial class AppActivation : IAppActivation, IAppActivationActi
return;
}
await taskContext.SwitchToMainThreadAsync();
serviceProvider.GetRequiredService<HotKeyOptions>().RegisterAll();
if (serviceProvider.GetRequiredService<AppOptions>().IsNotifyIconEnabled)