This commit is contained in:
Lightczx
2024-06-20 17:15:30 +08:00
parent ab91f4e738
commit 44ddae602d
79 changed files with 478 additions and 606 deletions

View File

@@ -1,10 +0,0 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
namespace Snap.Hutao.Control.Builder.ButtonBase;
internal class ButtonBaseBuilder<TButton> : IButtonBaseBuilder<TButton>
where TButton : Microsoft.UI.Xaml.Controls.Primitives.ButtonBase, new()
{
public TButton Button { get; } = new();
}

View File

@@ -1,25 +0,0 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Core.Abstraction.Extension;
namespace Snap.Hutao.Control.Builder.ButtonBase;
internal static class ButtonBaseBuilderExtension
{
public static TBuilder SetContent<TBuilder, TButton>(this TBuilder builder, object? content)
where TBuilder : IButtonBaseBuilder<TButton>
where TButton : Microsoft.UI.Xaml.Controls.Primitives.ButtonBase
{
builder.Configure(builder => builder.Button.Content = content);
return builder;
}
public static TBuilder SetCommand<TBuilder, TButton>(this TBuilder builder, ICommand command)
where TBuilder : IButtonBaseBuilder<TButton>
where TButton : Microsoft.UI.Xaml.Controls.Primitives.ButtonBase
{
builder.Configure(builder => builder.Button.Command = command);
return builder;
}
}

View File

@@ -1,8 +0,0 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
namespace Snap.Hutao.Control.Builder.ButtonBase;
internal sealed class ButtonBuilder : ButtonBaseBuilder<Button>;

View File

@@ -1,19 +0,0 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
namespace Snap.Hutao.Control.Builder.ButtonBase;
internal static class ButtonBuilderExtension
{
public static ButtonBuilder SetContent(this ButtonBuilder builder, object? content)
{
return builder.SetContent<ButtonBuilder, Button>(content);
}
public static ButtonBuilder SetCommand(this ButtonBuilder builder, ICommand command)
{
return builder.SetCommand<ButtonBuilder, Button>(command);
}
}

View File

@@ -1,12 +0,0 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Core.Abstraction;
namespace Snap.Hutao.Control.Builder.ButtonBase;
internal interface IButtonBaseBuilder<TButton> : IBuilder
where TButton : Microsoft.UI.Xaml.Controls.Primitives.ButtonBase
{
TButton Button { get; }
}

View File

@@ -1,38 +0,0 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Microsoft.UI.Xaml;
namespace Snap.Hutao.Control.Helper;
[SuppressMessage("", "SH001")]
[DependencyProperty("SquareLength", typeof(double), 0D, nameof(OnSquareLengthChanged), IsAttached = true, AttachedType = typeof(FrameworkElement))]
[DependencyProperty("IsActualThemeBindingEnabled", typeof(bool), false, nameof(OnIsActualThemeBindingEnabled), IsAttached = true, AttachedType = typeof(FrameworkElement))]
[DependencyProperty("ActualTheme", typeof(ElementTheme), ElementTheme.Default, IsAttached = true, AttachedType = typeof(FrameworkElement))]
public sealed partial class FrameworkElementHelper
{
private static void OnSquareLengthChanged(DependencyObject dp, DependencyPropertyChangedEventArgs e)
{
FrameworkElement element = (FrameworkElement)dp;
element.Width = (double)e.NewValue;
element.Height = (double)e.NewValue;
}
private static void OnIsActualThemeBindingEnabled(DependencyObject dp, DependencyPropertyChangedEventArgs e)
{
FrameworkElement element = (FrameworkElement)dp;
if ((bool)e.NewValue)
{
element.ActualThemeChanged += OnActualThemeChanged;
}
else
{
element.ActualThemeChanged -= OnActualThemeChanged;
}
static void OnActualThemeChanged(FrameworkElement sender, object args)
{
SetActualTheme(sender, sender.ActualTheme);
}
}
}

View File

@@ -1,37 +1,174 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using CommunityToolkit.WinUI;
using Microsoft.UI.Composition;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Media.Imaging;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Core.Caching;
using Snap.Hutao.Core.ExceptionService;
using Snap.Hutao.Core.IO.DataTransfer;
using Snap.Hutao.UI.Xaml;
using System.IO;
using System.Runtime.InteropServices;
using Windows.Graphics.Imaging;
using Windows.Media.Casting;
using Windows.Storage.Streams;
namespace Snap.Hutao.Control.Image;
/// <summary>
/// 缓存图像
/// </summary>
[HighQuality]
[SuppressMessage("", "CA1001")]
[SuppressMessage("", "SH003")]
[TemplateVisualState(Name = LoadingState, GroupName = CommonGroup)]
[TemplateVisualState(Name = LoadedState, GroupName = CommonGroup)]
[TemplateVisualState(Name = UnloadedState, GroupName = CommonGroup)]
[TemplateVisualState(Name = FailedState, GroupName = CommonGroup)]
[TemplatePart(Name = PartImage, Type = typeof(object))]
[TemplatePart(Name = PartPlaceholderImage, Type = typeof(object))]
[DependencyProperty("SourceName", typeof(string), "Unknown")]
[DependencyProperty("CachedName", typeof(string), "Unknown")]
internal sealed partial class CachedImage : Implementation.ImageEx
[DependencyProperty("NineGrid", typeof(Thickness))]
[DependencyProperty("Stretch", typeof(Stretch), Stretch.Uniform)]
[DependencyProperty("PlaceholderSource", typeof(object), default(object))]
[DependencyProperty("PlaceholderStretch", typeof(Stretch), Stretch.Uniform)]
[DependencyProperty("PlaceholderMargin", typeof(Thickness))]
[DependencyProperty("Source", typeof(object), default(object), nameof(SourceChanged))]
internal sealed partial class CachedImage : Microsoft.UI.Xaml.Controls.Control, IAlphaMaskProvider
{
/// <summary>
/// 构造一个新的缓存图像
/// </summary>
private const string PartImage = "Image";
private const string PartPlaceholderImage = "PlaceholderImage";
private const string CommonGroup = "CommonStates";
private const string LoadingState = "Loading";
private const string LoadedState = "Loaded";
private const string UnloadedState = "Unloaded";
private const string FailedState = "Failed";
private CancellationTokenSource? tokenSource;
public CachedImage()
{
DefaultStyleKey = typeof(CachedImage);
DefaultStyleResourceUri = "ms-appx:///Control/Image/CachedImage.xaml".ToUri();
}
/// <inheritdoc/>
protected override async Task<Uri?> ProvideCachedResourceAsync(Uri imageUri, CancellationToken token)
public bool IsInitialized { get; private set; }
public bool WaitUntilLoaded
{
get => true;
}
private object? Image { get; set; }
private object? PlaceholderImage { get; set; }
public CompositionBrush GetAlphaMask()
{
if (IsInitialized && Image is Microsoft.UI.Xaml.Controls.Image image)
{
return image.GetAlphaMask();
}
return default!;
}
public CastingSource GetAsCastingSource()
{
if (IsInitialized && Image is Microsoft.UI.Xaml.Controls.Image image)
{
return image.GetAsCastingSource();
}
return default!;
}
protected override void OnApplyTemplate()
{
RemoveImageOpened(OnImageOpened);
RemoveImageFailed(OnImageFailed);
Image = GetTemplateChild(PartImage);
IsInitialized = true;
SetSource(Source);
AttachImageOpened(OnImageOpened);
AttachImageFailed(OnImageFailed);
base.OnApplyTemplate();
void AttachImageOpened(RoutedEventHandler handler)
{
if (Image is Microsoft.UI.Xaml.Controls.Image image)
{
image.ImageOpened += handler;
}
else if (Image is ImageBrush brush)
{
brush.ImageOpened += handler;
}
}
void AttachImageFailed(ExceptionRoutedEventHandler handler)
{
if (Image is Microsoft.UI.Xaml.Controls.Image image)
{
image.ImageFailed += handler;
}
else if (Image is ImageBrush brush)
{
brush.ImageFailed += handler;
}
}
void RemoveImageOpened(RoutedEventHandler handler)
{
if (Image is Microsoft.UI.Xaml.Controls.Image image)
{
image.ImageOpened -= handler;
}
else if (Image is ImageBrush brush)
{
brush.ImageOpened -= handler;
}
}
void RemoveImageFailed(ExceptionRoutedEventHandler handler)
{
if (Image is Microsoft.UI.Xaml.Controls.Image image)
{
image.ImageFailed -= handler;
}
else if (Image is ImageBrush brush)
{
brush.ImageFailed -= handler;
}
}
}
private static void SourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is not CachedImage control)
{
return;
}
if (e.OldValue is not null && e.NewValue is not null && e.OldValue.Equals(e.NewValue))
{
return;
}
control.SetSource(e.NewValue);
}
private static bool IsHttpUri(Uri uri)
{
return uri.IsAbsoluteUri && (uri.Scheme == "http" || uri.Scheme == "https");
}
private async Task<Uri?> ProvideCachedResourceAsync(Uri imageUri, CancellationToken token)
{
SourceName = Path.GetFileName(imageUri.ToString());
IImageCache imageCache = this.ServiceProvider().GetRequiredService<IImageCache>();
@@ -52,6 +189,188 @@ internal sealed partial class CachedImage : Implementation.ImageEx
}
}
private void OnImageOpened(object sender, RoutedEventArgs e)
{
VisualStateManager.GoToState(this, LoadedState, true);
}
private void OnImageFailed(object sender, ExceptionRoutedEventArgs e)
{
VisualStateManager.GoToState(this, FailedState, true);
}
private void AttachSource(BitmapImage? source, Uri? uri)
{
if (Image is Microsoft.UI.Xaml.Controls.Image image)
{
image.Source = source;
}
else if (Image is ImageBrush brush)
{
brush.ImageSource = source;
}
if (source is null)
{
VisualStateManager.GoToState(this, UnloadedState, true);
}
else
{
// https://learn.microsoft.com/en-us/windows/uwp/debug-test-perf/optimize-animations-and-media#optimize-image-resources
source.UriSource = uri;
VisualStateManager.GoToState(this, LoadedState, true);
}
}
private void AttachPlaceholderSource(BitmapImage? source, Uri? uri)
{
if (PlaceholderImage is Microsoft.UI.Xaml.Controls.Image image)
{
image.Source = source;
}
else if (PlaceholderImage is ImageBrush brush)
{
brush.ImageSource = source;
}
if (source is null)
{
VisualStateManager.GoToState(this, UnloadedState, true);
}
else
{
// https://learn.microsoft.com/en-us/windows/uwp/debug-test-perf/optimize-animations-and-media#optimize-image-resources
source.UriSource = uri;
VisualStateManager.GoToState(this, LoadedState, true);
}
}
private async void SetSource(object? source)
{
if (!IsInitialized)
{
return;
}
tokenSource?.Cancel();
tokenSource = new CancellationTokenSource();
AttachSource(default, default);
if (source is null)
{
return;
}
VisualStateManager.GoToState(this, LoadingState, true);
if (source as Uri is not { } uri)
{
string? url = source as string ?? source.ToString();
if (!Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out uri))
{
VisualStateManager.GoToState(this, FailedState, true);
return;
}
}
if (!IsHttpUri(uri) && !uri.IsAbsoluteUri)
{
uri = new Uri("ms-appx:///" + uri.OriginalString.TrimStart('/'));
}
try
{
await LoadImageAsync(uri, tokenSource.Token).ConfigureAwait(true);
}
catch (Exception ex)
{
SetPlaceholderSource(PlaceholderSource);
if (ex is OperationCanceledException)
{
// nothing to do as cancellation has been requested.
}
else
{
VisualStateManager.GoToState(this, FailedState, true);
}
}
}
private async void SetPlaceholderSource(object? source)
{
if (!IsInitialized)
{
return;
}
tokenSource?.Cancel();
tokenSource = new();
AttachPlaceholderSource(default, default);
if (source is null)
{
return;
}
if (source as Uri is not { } uri)
{
string? url = source as string ?? source.ToString();
if (!Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out uri))
{
return;
}
}
if (!IsHttpUri(uri) && !uri.IsAbsoluteUri)
{
uri = new Uri("ms-appx:///" + uri.OriginalString.TrimStart('/'));
}
try
{
if (uri is null)
{
return;
}
Uri? actualUri = await ProvideCachedResourceAsync(uri, tokenSource.Token).ConfigureAwait(true);
ArgumentNullException.ThrowIfNull(tokenSource);
if (!tokenSource.IsCancellationRequested)
{
// Only attach our image if we still have a valid request.
AttachPlaceholderSource(new BitmapImage(), actualUri);
}
}
catch (OperationCanceledException)
{
// nothing to do as cancellation has been requested.
}
catch
{
}
}
private async Task LoadImageAsync(Uri imageUri, CancellationToken token)
{
if (imageUri is null)
{
return;
}
Uri? actualUri = await ProvideCachedResourceAsync(imageUri, token).ConfigureAwait(true);
ArgumentNullException.ThrowIfNull(tokenSource);
if (!tokenSource.IsCancellationRequested)
{
// Only attach our image if we still have a valid request.
AttachSource(new BitmapImage(), actualUri);
}
}
[Command("CopyToClipboardCommand")]
private async Task CopyToClipboard()
{

View File

@@ -1,7 +1,8 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:shci="using:Snap.Hutao.Control.Image">
xmlns:shci="using:Snap.Hutao.Control.Image"
xmlns:shcm="using:Snap.Hutao.Control.Markup">
<Style TargetType="shci:CachedImage">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{ThemeResource ApplicationForegroundThemeBrush}"/>
@@ -18,7 +19,7 @@
<MenuFlyout>
<MenuFlyoutItem IsEnabled="False" Text="{TemplateBinding SourceName}"/>
<MenuFlyoutItem IsEnabled="False" Text="{TemplateBinding CachedName}"/>
<MenuFlyoutItem Command="{Binding CopyToClipboardCommand, RelativeSource={RelativeSource TemplatedParent}}" Text="复制图像"/>
<MenuFlyoutItem Command="{Binding CopyToClipboardCommand, RelativeSource={RelativeSource TemplatedParent}}" Text="{shcm:ResourceString Name=UIXamlControlCachedImageCopyImage}"/>
</MenuFlyout>
</Grid.ContextFlyout>
<Image

View File

@@ -6,9 +6,9 @@ using Microsoft.UI.Composition;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Hosting;
using Microsoft.UI.Xaml.Media;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Core.Caching;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.UI.Xaml;
using Snap.Hutao.UI.Xaml.Media.Animation;
using System.IO;
using System.Net.Http;

View File

@@ -1,37 +0,0 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Microsoft.UI.Composition;
using Microsoft.UI.Xaml;
using Windows.Media.Casting;
namespace Snap.Hutao.Control.Image.Implementation;
[DependencyProperty("NineGrid", typeof(Thickness))]
internal partial class ImageEx : ImageExBase
{
public ImageEx()
: base()
{
}
public override CompositionBrush GetAlphaMask()
{
if (IsInitialized && Image is Microsoft.UI.Xaml.Controls.Image image)
{
return image.GetAlphaMask();
}
return default!;
}
public CastingSource GetAsCastingSource()
{
if (IsInitialized && Image is Microsoft.UI.Xaml.Controls.Image image)
{
return image.GetAsCastingSource();
}
return default!;
}
}

View File

@@ -1,322 +0,0 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using CommunityToolkit.WinUI;
using Microsoft.UI.Composition;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Media.Imaging;
namespace Snap.Hutao.Control.Image.Implementation;
[SuppressMessage("", "CA1001")]
[SuppressMessage("", "SH003")]
[TemplateVisualState(Name = LoadingState, GroupName = CommonGroup)]
[TemplateVisualState(Name = LoadedState, GroupName = CommonGroup)]
[TemplateVisualState(Name = UnloadedState, GroupName = CommonGroup)]
[TemplateVisualState(Name = FailedState, GroupName = CommonGroup)]
[TemplatePart(Name = PartImage, Type = typeof(object))]
[TemplatePart(Name = PartPlaceholderImage, Type = typeof(object))]
[DependencyProperty("Stretch", typeof(Stretch), Stretch.Uniform)]
[DependencyProperty("PlaceholderSource", typeof(object), default(object))]
[DependencyProperty("PlaceholderStretch", typeof(Stretch), Stretch.Uniform)]
[DependencyProperty("PlaceholderMargin", typeof(Thickness))]
[DependencyProperty("Source", typeof(object), default(object), nameof(SourceChanged))]
internal abstract partial class ImageExBase : Microsoft.UI.Xaml.Controls.Control, IAlphaMaskProvider
{
protected const string PartImage = "Image";
protected const string PartPlaceholderImage = "PlaceholderImage";
protected const string CommonGroup = "CommonStates";
protected const string LoadingState = "Loading";
protected const string LoadedState = "Loaded";
protected const string UnloadedState = "Unloaded";
protected const string FailedState = "Failed";
private CancellationTokenSource? tokenSource;
public bool IsInitialized { get; private set; }
public bool WaitUntilLoaded
{
get => true;
}
protected object? Image { get; private set; }
protected object? PlaceholderImage { get; private set; }
public abstract CompositionBrush GetAlphaMask();
protected virtual Task<Uri?> ProvideCachedResourceAsync(Uri imageUri, CancellationToken token)
{
// By default we just use the built-in UWP image cache provided within the Image control.
return Task.FromResult<Uri?>(imageUri);
}
protected virtual void OnImageOpened(object sender, RoutedEventArgs e)
{
VisualStateManager.GoToState(this, LoadedState, true);
}
protected virtual void OnImageFailed(object sender, ExceptionRoutedEventArgs e)
{
VisualStateManager.GoToState(this, FailedState, true);
}
protected override void OnApplyTemplate()
{
RemoveImageOpened(OnImageOpened);
RemoveImageFailed(OnImageFailed);
Image = GetTemplateChild(PartImage);
IsInitialized = true;
SetSource(Source);
AttachImageOpened(OnImageOpened);
AttachImageFailed(OnImageFailed);
base.OnApplyTemplate();
void AttachImageOpened(RoutedEventHandler handler)
{
if (Image is Microsoft.UI.Xaml.Controls.Image image)
{
image.ImageOpened += handler;
}
else if (Image is ImageBrush brush)
{
brush.ImageOpened += handler;
}
}
void AttachImageFailed(ExceptionRoutedEventHandler handler)
{
if (Image is Microsoft.UI.Xaml.Controls.Image image)
{
image.ImageFailed += handler;
}
else if (Image is ImageBrush brush)
{
brush.ImageFailed += handler;
}
}
void RemoveImageOpened(RoutedEventHandler handler)
{
if (Image is Microsoft.UI.Xaml.Controls.Image image)
{
image.ImageOpened -= handler;
}
else if (Image is ImageBrush brush)
{
brush.ImageOpened -= handler;
}
}
void RemoveImageFailed(ExceptionRoutedEventHandler handler)
{
if (Image is Microsoft.UI.Xaml.Controls.Image image)
{
image.ImageFailed -= handler;
}
else if (Image is ImageBrush brush)
{
brush.ImageFailed -= handler;
}
}
}
private static void SourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is not ImageExBase control)
{
return;
}
if (e.OldValue is not null && e.NewValue is not null && e.OldValue.Equals(e.NewValue))
{
return;
}
control.SetSource(e.NewValue);
}
private static bool IsHttpUri(Uri uri)
{
return uri.IsAbsoluteUri && (uri.Scheme == "http" || uri.Scheme == "https");
}
private void AttachSource(BitmapImage? source, Uri? uri)
{
if (Image is Microsoft.UI.Xaml.Controls.Image image)
{
image.Source = source;
}
else if (Image is ImageBrush brush)
{
brush.ImageSource = source;
}
if (source is null)
{
VisualStateManager.GoToState(this, UnloadedState, true);
}
else
{
// https://learn.microsoft.com/en-us/windows/uwp/debug-test-perf/optimize-animations-and-media#optimize-image-resources
source.UriSource = uri;
VisualStateManager.GoToState(this, LoadedState, true);
}
}
private void AttachPlaceholderSource(BitmapImage? source, Uri? uri)
{
if (PlaceholderImage is Microsoft.UI.Xaml.Controls.Image image)
{
image.Source = source;
}
else if (PlaceholderImage is ImageBrush brush)
{
brush.ImageSource = source;
}
if (source is null)
{
VisualStateManager.GoToState(this, UnloadedState, true);
}
else
{
// https://learn.microsoft.com/en-us/windows/uwp/debug-test-perf/optimize-animations-and-media#optimize-image-resources
source.UriSource = uri;
VisualStateManager.GoToState(this, LoadedState, true);
}
}
private async void SetSource(object? source)
{
if (!IsInitialized)
{
return;
}
tokenSource?.Cancel();
tokenSource = new CancellationTokenSource();
AttachSource(default, default);
if (source is null)
{
return;
}
VisualStateManager.GoToState(this, LoadingState, true);
if (source as Uri is not { } uri)
{
string? url = source as string ?? source.ToString();
if (!Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out uri))
{
VisualStateManager.GoToState(this, FailedState, true);
return;
}
}
if (!IsHttpUri(uri) && !uri.IsAbsoluteUri)
{
uri = new Uri("ms-appx:///" + uri.OriginalString.TrimStart('/'));
}
try
{
await LoadImageAsync(uri, tokenSource.Token).ConfigureAwait(true);
}
catch (Exception ex)
{
SetPlaceholderSource(PlaceholderSource);
if (ex is OperationCanceledException)
{
// nothing to do as cancellation has been requested.
}
else
{
VisualStateManager.GoToState(this, FailedState, true);
}
}
}
private async void SetPlaceholderSource(object? source)
{
if (!IsInitialized)
{
return;
}
tokenSource?.Cancel();
tokenSource = new();
AttachPlaceholderSource(default, default);
if (source is null)
{
return;
}
if (source as Uri is not { } uri)
{
string? url = source as string ?? source.ToString();
if (!Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out uri))
{
return;
}
}
if (!IsHttpUri(uri) && !uri.IsAbsoluteUri)
{
uri = new Uri("ms-appx:///" + uri.OriginalString.TrimStart('/'));
}
try
{
if (uri is null)
{
return;
}
Uri? actualUri = await ProvideCachedResourceAsync(uri, tokenSource.Token).ConfigureAwait(true);
ArgumentNullException.ThrowIfNull(tokenSource);
if (!tokenSource.IsCancellationRequested)
{
// Only attach our image if we still have a valid request.
AttachPlaceholderSource(new BitmapImage(), actualUri);
}
}
catch (OperationCanceledException)
{
// nothing to do as cancellation has been requested.
}
catch
{
}
}
private async Task LoadImageAsync(Uri imageUri, CancellationToken token)
{
if (imageUri is null)
{
return;
}
Uri? actualUri = await ProvideCachedResourceAsync(imageUri, token).ConfigureAwait(true);
ArgumentNullException.ThrowIfNull(tokenSource);
if (!tokenSource.IsCancellationRequested)
{
// Only attach our image if we still have a valid request.
AttachSource(new BitmapImage(), actualUri);
}
}
}

View File

@@ -5,11 +5,11 @@ using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Documents;
using Microsoft.UI.Xaml.Media;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Control.Media;
using Snap.Hutao.Control.Text.Syntax.MiHoYo;
using Snap.Hutao.Control.Theme;
using Snap.Hutao.Metadata;
using Snap.Hutao.UI.Xaml;
using Windows.Foundation;
using Windows.UI;

View File

@@ -6,9 +6,9 @@ using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Documents;
using Microsoft.UI.Xaml.Media;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Control.Media;
using Snap.Hutao.Control.Theme;
using Snap.Hutao.UI.Xaml;
using Windows.Foundation;
using Windows.UI;

View File

@@ -1,7 +1,7 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:shch="using:Snap.Hutao.Control.Helper">
xmlns:shuxc="using:Snap.Hutao.UI.Xaml.Control">
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<AcrylicBrush
@@ -49,9 +49,10 @@
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
<x:Double x:Key="InfoBarIconFontSize">20</x:Double>
<Thickness x:Key="InfoBarIconMargin">19,16,19,16</Thickness>
<Thickness x:Key="InfoBarContentRootPadding">0,0,0,0</Thickness>
<x:Double x:Key="InfoBarIconFontSize">20</x:Double>
<Thickness x:Key="InfoBarTitleHorizontalOrientationMargin">0,0,0,0</Thickness>
<Thickness x:Key="InfoBarMessageHorizontalOrientationMargin">12,0,0,0</Thickness>
@@ -60,7 +61,7 @@
<!-- TODO: When will DefaultInfoBarStyle added -->
<Style TargetType="InfoBar">
<Setter Property="shch:InfoBarHelper.IsTextSelectionEnabled" Value="False"/>
<Setter Property="shuxc:InfoBarHelper.IsTextSelectionEnabled" Value="False"/>
<Setter Property="FontFamily" Value="{StaticResource MiSans}"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="CloseButtonStyle" Value="{StaticResource InfoBarCloseButtonStyle}"/>
@@ -144,7 +145,7 @@
Foreground="{ThemeResource InfoBarTitleForeground}"
InfoBarPanel.HorizontalOrientationMargin="{StaticResource InfoBarTitleHorizontalOrientationMargin}"
InfoBarPanel.VerticalOrientationMargin="{StaticResource InfoBarTitleVerticalOrientationMargin}"
IsTextSelectionEnabled="{TemplateBinding shch:InfoBarHelper.IsTextSelectionEnabled}"
IsTextSelectionEnabled="{TemplateBinding shuxc:InfoBarHelper.IsTextSelectionEnabled}"
Text="{TemplateBinding Title}"
TextWrapping="WrapWholeWords"/>
<TextBlock
@@ -154,7 +155,7 @@
Foreground="{ThemeResource InfoBarMessageForeground}"
InfoBarPanel.HorizontalOrientationMargin="{StaticResource InfoBarMessageHorizontalOrientationMargin}"
InfoBarPanel.VerticalOrientationMargin="{StaticResource InfoBarMessageVerticalOrientationMargin}"
IsTextSelectionEnabled="{TemplateBinding shch:InfoBarHelper.IsTextSelectionEnabled}"
IsTextSelectionEnabled="{TemplateBinding shuxc:InfoBarHelper.IsTextSelectionEnabled}"
Text="{TemplateBinding Message}"
TextWrapping="WrapWholeWords"/>
<ContentPresenter

View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:shch="using:Snap.Hutao.Control.Helper">
xmlns:shuxc="using:Snap.Hutao.UI.Xaml.Control">
<Style x:Key="TwoPanelScrollViewerStyle" TargetType="ScrollViewer">
<Setter Property="HorizontalScrollMode" Value="Auto"/>
<Setter Property="VerticalScrollMode" Value="Auto"/>
@@ -46,7 +45,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ScrollContentPresenter x:Name="ScrollContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}"/>
<ContentPresenter Grid.Column="1" Content="{Binding Path=(shch:ScrollViewerHelper.RightPanel), RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
<ContentPresenter Grid.Column="1" Content="{Binding Path=(shuxc:ScrollViewerHelper.RightPanel), RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
</Grid>
<Grid Grid.RowSpan="2" Grid.ColumnSpan="2"/>

View File

@@ -2,7 +2,7 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.UI.Xaml;
using Snap.Hutao.ViewModel;
namespace Snap.Hutao.Core.Windowing.NotifyIcon;

View File

@@ -3,9 +3,9 @@
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Core.Windowing;
using Snap.Hutao.Core.Windowing.Abstraction;
using Snap.Hutao.UI.Xaml;
using Snap.Hutao.ViewModel.Game;
using Snap.Hutao.Win32.UI.WindowsAndMessaging;
using Windows.Graphics;

View File

@@ -1094,6 +1094,9 @@
<data name="ServiceUserProcessCookieRequestUserInfoFailed" xml:space="preserve">
<value>输入的 Cookie 无法获取用户信息</value>
</data>
<data name="UIXamlControlCachedImageCopyImage" xml:space="preserve">
<value>复制图像</value>
</data>
<data name="ViewAchievementHeader" xml:space="preserve">
<value>成就管理</value>
</data>

View File

@@ -2,13 +2,13 @@
// Licensed under the MIT license.
using Microsoft.Win32.SafeHandles;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Core.Setting;
using Snap.Hutao.Factory.ContentDialog;
using Snap.Hutao.Factory.Progress;
using Snap.Hutao.Model.Intrinsic;
using Snap.Hutao.Service.Game.Configuration;
using Snap.Hutao.Service.Game.Package;
using Snap.Hutao.UI.Xaml.Control;
using Snap.Hutao.View.Dialog;
using Snap.Hutao.Web.Hoyolab.HoyoPlay.Connect;
using Snap.Hutao.Web.Hoyolab.HoyoPlay.Connect.ChannelSDK;

View File

@@ -1,7 +1,7 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
namespace Snap.Hutao.Control.Extension;
namespace Snap.Hutao.UI.Input;
internal static class CommandInvocation
{

View File

@@ -3,7 +3,7 @@
using CommunityToolkit.WinUI.Behaviors;
using Microsoft.UI.Xaml;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.UI.Input;
namespace Snap.Hutao.UI.Xaml.Behavior;

View File

@@ -3,7 +3,7 @@
using CommunityToolkit.WinUI.Behaviors;
using Microsoft.UI.Xaml;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.UI.Input;
namespace Snap.Hutao.UI.Xaml.Behavior;

View File

@@ -5,19 +5,18 @@ using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Data;
namespace Snap.Hutao.Control.Collection.Selector;
namespace Snap.Hutao.UI.Xaml.Control;
[DependencyProperty("EnableMemberPath", typeof(string))]
internal sealed partial class ComboBox2 : ComboBox
{
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
{
base.PrepareContainerForItemOverride(element, item);
if (element is ComboBoxItem comboBoxItem)
{
Binding binding = new() { Path = new(EnableMemberPath) };
comboBoxItem.SetBinding(IsEnabledProperty, binding);
comboBoxItem.SetBinding(IsEnabledProperty, new Binding() { Path = new(EnableMemberPath) });
}
base.PrepareContainerForItemOverride(element, item);
}
}

View File

@@ -3,7 +3,7 @@
using Microsoft.UI.Xaml.Controls;
namespace Snap.Hutao.Control.Extension;
namespace Snap.Hutao.UI.Xaml.Control;
/// <summary>
/// 对话框扩展
@@ -17,13 +17,13 @@ internal static class ContentDialogExtension
/// <param name="contentDialog">对话框</param>
/// <param name="taskContext">任务上下文</param>
/// <returns>用于恢复用户交互</returns>
public static async ValueTask<ContentDialogHideToken> BlockAsync(this ContentDialog contentDialog, ITaskContext taskContext)
public static async ValueTask<ContentDialogScope> BlockAsync(this ContentDialog contentDialog, ITaskContext taskContext)
{
await taskContext.SwitchToMainThreadAsync();
// E_ASYNC_OPERATION_NOT_STARTED 0x80000019
// Only a single ContentDialog can be open at any time.
contentDialog.ShowAsync().AsTask().SafeForget();
return new ContentDialogHideToken(contentDialog, taskContext);
_ = contentDialog.ShowAsync();
return new ContentDialogScope(contentDialog, taskContext);
}
}

View File

@@ -3,9 +3,9 @@
using Microsoft.UI.Xaml.Controls;
namespace Snap.Hutao.Control.Extension;
namespace Snap.Hutao.UI.Xaml.Control;
internal struct ContentDialogHideToken : IDisposable, IAsyncDisposable
internal struct ContentDialogScope : IDisposable, IAsyncDisposable
{
private readonly ContentDialog contentDialog;
private readonly ITaskContext taskContext;
@@ -13,7 +13,7 @@ internal struct ContentDialogHideToken : IDisposable, IAsyncDisposable
private bool disposing = false;
private bool disposed = false;
public ContentDialogHideToken(ContentDialog contentDialog, ITaskContext taskContext)
public ContentDialogScope(ContentDialog contentDialog, ITaskContext taskContext)
{
this.contentDialog = contentDialog;
this.taskContext = taskContext;

View File

@@ -4,7 +4,7 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
namespace Snap.Hutao.Control.Helper;
namespace Snap.Hutao.UI.Xaml.Control;
[SuppressMessage("", "SH001")]
[DependencyProperty("IsTextSelectionEnabled", typeof(bool), false, IsAttached = true, AttachedType = typeof(InfoBar))]

View File

@@ -5,7 +5,7 @@ using CommunityToolkit.WinUI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
namespace Snap.Hutao.Control.Helper;
namespace Snap.Hutao.UI.Xaml.Control;
[SuppressMessage("", "SH001")]
[DependencyProperty("PaneCornerRadius", typeof(CornerRadius), default, nameof(OnPaneCornerRadiusChanged), IsAttached = true, AttachedType = typeof(NavigationView))]
@@ -18,22 +18,27 @@ public sealed partial class NavigationViewHelper
if (navigationView.IsLoaded)
{
SetNavigationViewPaneCornerRadius(navigationView, newValue);
SetLoadedNavigationViewPaneCornerRadius(navigationView, newValue);
return;
}
navigationView.Loaded += (s, e) =>
{
NavigationView loadedNavigationView = (NavigationView)s;
SetNavigationViewPaneCornerRadius(loadedNavigationView, newValue);
};
navigationView.Loaded += SetNavigationViewPaneCornerRadius;
}
private static void SetNavigationViewPaneCornerRadius(NavigationView navigationView, CornerRadius value)
private static void SetNavigationViewPaneCornerRadius(object sender, RoutedEventArgs args)
{
NavigationView navigationView = (NavigationView)sender;
CornerRadius value = GetPaneCornerRadius(navigationView);
SetLoadedNavigationViewPaneCornerRadius(navigationView, value);
navigationView.Loaded -= SetNavigationViewPaneCornerRadius;
}
private static void SetLoadedNavigationViewPaneCornerRadius(NavigationView navigationView, CornerRadius value)
{
if (navigationView.FindDescendant("RootSplitView") is SplitView splitView)
{
splitView.CornerRadius = value;
}
}
}
}

View File

@@ -4,7 +4,7 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
namespace Snap.Hutao.Control.Helper;
namespace Snap.Hutao.UI.Xaml.Control;
[SuppressMessage("", "SH001")]
[DependencyProperty("RightPanel", typeof(UIElement), IsAttached = true, AttachedType = typeof(ScrollViewer))]

View File

@@ -4,7 +4,7 @@
using CommunityToolkit.WinUI.Controls;
using Microsoft.UI.Xaml;
namespace Snap.Hutao.Control.Helper;
namespace Snap.Hutao.UI.Xaml.Control;
[SuppressMessage("", "SH001")]
[DependencyProperty("IsItemsEnabled", typeof(bool), true, nameof(OnIsItemsEnabledChanged), IsAttached = true, AttachedType = typeof(SettingsExpander))]

View File

@@ -6,7 +6,7 @@ using CommunityToolkit.WinUI.Controls;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.UI.Input;
using System.Collections;
namespace Snap.Hutao.UI.Xaml.Control.Tokenizing;

View File

@@ -13,7 +13,7 @@ using Windows.Foundation;
using Windows.Foundation.Collections;
using NotifyCollectionChangedAction = System.Collections.Specialized.NotifyCollectionChangedAction;
namespace Snap.Hutao.Control.Collection.AdvancedCollectionView;
namespace Snap.Hutao.UI.Xaml.Data;
internal sealed class AdvancedCollectionView<T> : IAdvancedCollectionView<T>, INotifyPropertyChanged, ISupportIncrementalLoading, IComparer<object>
where T : class

View File

@@ -5,7 +5,7 @@ using CommunityToolkit.WinUI.Collections;
using Microsoft.UI.Xaml.Data;
using System.Collections;
namespace Snap.Hutao.Control.Collection.AdvancedCollectionView;
namespace Snap.Hutao.UI.Xaml.Data;
internal interface IAdvancedCollectionView<T> : ICollectionView, IEnumerable
where T : class

View File

@@ -3,7 +3,7 @@
using Windows.Foundation.Collections;
namespace Snap.Hutao.Control.Collection.AdvancedCollectionView;
namespace Snap.Hutao.UI.Xaml.Data;
internal sealed class VectorChangedEventArgs : IVectorChangedEventArgs
{

View File

@@ -4,7 +4,7 @@
using Microsoft.UI.Xaml;
using System.Runtime.CompilerServices;
namespace Snap.Hutao.Control.Extension;
namespace Snap.Hutao.UI.Xaml;
internal static class DependencyObjectExtension
{

View File

@@ -3,7 +3,7 @@
using Microsoft.UI.Xaml;
namespace Snap.Hutao.Control.Extension;
namespace Snap.Hutao.UI.Xaml;
internal static class FrameworkElementExtension
{

View File

@@ -0,0 +1,18 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Microsoft.UI.Xaml;
namespace Snap.Hutao.UI.Xaml;
[SuppressMessage("", "SH001")]
[DependencyProperty("SquareLength", typeof(double), 0D, nameof(OnSquareLengthChanged), IsAttached = true, AttachedType = typeof(FrameworkElement))]
public sealed partial class FrameworkElementHelper
{
private static void OnSquareLengthChanged(DependencyObject dp, DependencyPropertyChangedEventArgs e)
{
FrameworkElement element = (FrameworkElement)dp;
element.Width = (double)e.NewValue;
element.Height = (double)e.NewValue;
}
}

View File

@@ -3,7 +3,7 @@
using Microsoft.UI.Xaml;
namespace Snap.Hutao.Control.Helper;
namespace Snap.Hutao.UI.Xaml;
[SuppressMessage("", "SH001")]
[DependencyProperty("VisibilityObject", typeof(object), null, nameof(OnVisibilityObjectChanged), IsAttached = true, AttachedType = typeof(UIElement))]

View File

@@ -2,7 +2,7 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.UI.Xaml;
namespace Snap.Hutao.View.Card;

View File

@@ -2,7 +2,7 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.UI.Xaml;
namespace Snap.Hutao.View.Card;

View File

@@ -2,7 +2,7 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.UI.Xaml;
namespace Snap.Hutao.View.Card;

View File

@@ -2,7 +2,7 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.UI.Xaml;
namespace Snap.Hutao.View.Card;

View File

@@ -4,13 +4,13 @@
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:shch="using:Snap.Hutao.Control.Helper"
xmlns:shci="using:Snap.Hutao.Control.Image"
xmlns:shux="using:Snap.Hutao.UI.Xaml"
Style="{ThemeResource GridCardStyle}"
mc:Ignorable="d">
<StackPanel VerticalAlignment="Center">
<shci:CachedImage shch:FrameworkElementHelper.SquareLength="{x:Bind IconSquareLength}" Source="{x:Bind ImageSource, Mode=OneWay}"/>
<shci:CachedImage shux:FrameworkElementHelper.SquareLength="{x:Bind IconSquareLength}" Source="{x:Bind ImageSource, Mode=OneWay}"/>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
@@ -21,7 +21,7 @@
Margin="8"
HorizontalAlignment="Right"
VerticalAlignment="Top"
shch:FrameworkElementHelper.SquareLength="8"
shux:FrameworkElementHelper.SquareLength="8"
Style="{ThemeResource AttentionDotInfoBadgeStyle}"
Visibility="{x:Bind IsDotVisible, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}"/>
</Grid>

View File

@@ -14,6 +14,7 @@ internal sealed partial class CardBlock : Grid
{
public CardBlock()
{
// TODO: Convert to custom control
InitializeComponent();
}
}

View File

@@ -4,9 +4,9 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.Web.WebView2.Core;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Control.Theme;
using Snap.Hutao.Web.Hoyolab.Hk4e.Common.Announcement;
using Snap.Hutao.Web.WebView2;
using System.Collections.Frozen;
using System.Text;
using System.Text.RegularExpressions;

View File

@@ -6,9 +6,9 @@
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:shch="using:Snap.Hutao.Control.Helper"
xmlns:shci="using:Snap.Hutao.Control.Image"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
xmlns:shux="using:Snap.Hutao.UI.Xaml"
xmlns:shvcont="using:Snap.Hutao.View.Control"
xmlns:shvg="using:Snap.Hutao.ViewModel.GachaLog"
cw:Effects.Shadow="{ThemeResource CompatCardShadow}"
@@ -19,7 +19,7 @@
<DataTemplate x:Key="GridTemplate" d:DataType="shvg:StatisticsItem">
<shvcont:BottomTextControl Text="{Binding Count}" TextStyle="{StaticResource CaptionTextBlockStyle}">
<shvcont:ItemIcon
shch:FrameworkElementHelper.SquareLength="40"
shux:FrameworkElementHelper.SquareLength="40"
Icon="{Binding Icon}"
Quality="{Binding Quality}"/>
</shvcont:BottomTextControl>

View File

@@ -4,17 +4,16 @@
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:shch="using:Snap.Hutao.Control.Helper"
xmlns:shci="using:Snap.Hutao.Control.Image"
xmlns:shmmc="using:Snap.Hutao.Model.Metadata.Converter"
shch:FrameworkElementHelper.SquareLength="80"
xmlns:shux="using:Snap.Hutao.UI.Xaml"
shux:FrameworkElementHelper.SquareLength="80"
mc:Ignorable="d">
<UserControl.Resources>
<shmmc:QualityConverter x:Key="QualityConverter"/>
</UserControl.Resources>
<Grid>
<Grid CornerRadius="{StaticResource ControlCornerRadius}">
<!-- Disable some CachedImage's LazyLoading function here can increase response speed -->
<shci:CachedImage Source="{x:Bind Quality, Converter={StaticResource QualityConverter}, Mode=OneWay}"/>
<shci:CachedImage Source="{StaticResource UI_ImgSign_ItemIcon}"/>
<shci:CachedImage Source="{x:Bind Icon, Mode=OneWay}"/>
@@ -22,7 +21,7 @@
Margin="2"
HorizontalAlignment="Left"
VerticalAlignment="Top"
shch:FrameworkElementHelper.SquareLength="16"
shux:FrameworkElementHelper.SquareLength="16"
Source="{x:Bind Badge, Mode=OneWay}"/>
</Grid>
</Grid>

View File

@@ -5,9 +5,9 @@
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:shch="using:Snap.Hutao.Control.Helper"
xmlns:shci="using:Snap.Hutao.Control.Image"
xmlns:shmmc="using:Snap.Hutao.Model.Metadata.Converter"
xmlns:shux="using:Snap.Hutao.UI.Xaml"
mc:Ignorable="d">
<UserControl.Resources>
@@ -19,7 +19,7 @@
<DataTemplate x:Key="SkillHeaderTemplate">
<StackPanel Background="Transparent" ToolTipService.ToolTip="{Binding Name}">
<shci:MonoChrome shch:FrameworkElementHelper.SquareLength="36" Source="{Binding Icon, Converter={StaticResource SkillIconConverter}}"/>
<shci:MonoChrome shux:FrameworkElementHelper.SquareLength="36" Source="{Binding Icon, Converter={StaticResource SkillIconConverter}}"/>
</StackPanel>
</DataTemplate>
</UserControl.Resources>

View File

@@ -7,11 +7,10 @@
xmlns:cwconv="using:CommunityToolkit.WinUI.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:shcb="using:Snap.Hutao.Control.Brush"
xmlns:shch="using:Snap.Hutao.Control.Helper"
xmlns:shci="using:Snap.Hutao.Control.Image"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
xmlns:shcp="using:Snap.Hutao.Control.Panel"
xmlns:shux="using:Snap.Hutao.UI.Xaml"
xmlns:shvcont="using:Snap.Hutao.View.Control"
xmlns:shvconv="using:Snap.Hutao.View.Converter"
xmlns:shvcp="using:Snap.Hutao.View.Card.Primitive"
@@ -49,7 +48,7 @@
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<shci:CachedImage
shch:FrameworkElementHelper.SquareLength="40"
shux:FrameworkElementHelper.SquareLength="40"
CornerRadius="{ThemeResource ControlCornerRadius}"
Source="{Binding Icon}"/>
<TextBlock
@@ -103,7 +102,7 @@
<SolidColorBrush Color="{Binding Color}"/>
</shvcont:BottomTextControl.Foreground>
<shvcont:ItemIcon
shch:FrameworkElementHelper.SquareLength="40"
shux:FrameworkElementHelper.SquareLength="40"
Icon="{Binding Icon}"
Quality="{Binding Quality}"/>
</shvcont:BottomTextControl>

View File

@@ -5,12 +5,12 @@ using CommunityToolkit.Mvvm.Messaging;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.Web.WebView2.Core;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Message;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.Service.User;
using Snap.Hutao.ViewModel.User;
using Snap.Hutao.Web.Bridge;
using Snap.Hutao.Web.WebView2;
using Windows.Foundation;
namespace Snap.Hutao.View.Control;

View File

@@ -5,8 +5,8 @@
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:shch="using:Snap.Hutao.Control.Helper"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
xmlns:shux="using:Snap.Hutao.UI.Xaml"
xmlns:shvc="using:Snap.Hutao.View.Control"
Title="{shcm:ResourceString Name=ViewDialogGachaLogRefreshProgressTitle}"
Style="{StaticResource DefaultContentDialogStyle}"
@@ -15,7 +15,7 @@
<ContentDialog.Resources>
<DataTemplate x:Key="GachaItemDataTemplate">
<shvc:ItemIcon
shch:FrameworkElementHelper.SquareLength="60"
shux:FrameworkElementHelper.SquareLength="60"
Badge="{Binding Badge}"
Icon="{Binding Icon}"
Quality="{Binding Quality}"/>

View File

@@ -4,8 +4,8 @@
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:shccs="using:Snap.Hutao.Control.Collection.Selector"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
xmlns:shuxc="using:Snap.Hutao.UI.Xaml.Control"
xmlns:shvd="using:Snap.Hutao.View.Dialog"
Title="{shcm:ResourceString Name=ViewDialogLaunchGameConfigurationFixDialogTitle}"
d:DataContext="{d:DesignInstance shvd:LaunchGameConfigurationFixDialog}"
@@ -14,7 +14,7 @@
Style="{StaticResource DefaultContentDialogStyle}"
mc:Ignorable="d">
<shccs:ComboBox2
<shuxc:ComboBox2
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
DisplayMemberPath="DisplayName"

View File

@@ -2,7 +2,7 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.UI.Xaml;
using Snap.Hutao.ViewModel.Guide;
namespace Snap.Hutao.View.Guide;

View File

@@ -5,9 +5,9 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
xmlns:shch="using:Snap.Hutao.Control.Helper"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
xmlns:shuxb="using:Snap.Hutao.UI.Xaml.Behavior"
xmlns:shuxc="using:Snap.Hutao.UI.Xaml.Control"
xmlns:shv="using:Snap.Hutao.View"
xmlns:shvcs="using:Snap.Hutao.View.Converter.Specialized"
xmlns:shvh="using:Snap.Hutao.View.Helper"
@@ -45,7 +45,7 @@
<NavigationView
x:Name="NavView"
Margin="0,0,0,0"
shch:NavigationViewHelper.PaneCornerRadius="0"
shuxc:NavigationViewHelper.PaneCornerRadius="0"
CompactPaneLength="48"
IsBackEnabled="{x:Bind ContentFrame.CanGoBack, Mode=OneWay}"
IsPaneOpen="True"

View File

@@ -2,8 +2,8 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Service.Navigation;
using Snap.Hutao.UI.Xaml;
using Snap.Hutao.View.Page;
using Snap.Hutao.ViewModel;

View File

@@ -9,10 +9,10 @@
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
xmlns:mxic="using:Microsoft.Xaml.Interactions.Core"
xmlns:shc="using:Snap.Hutao.Control"
xmlns:shch="using:Snap.Hutao.Control.Helper"
xmlns:shci="using:Snap.Hutao.Control.Image"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
xmlns:shcp="using:Snap.Hutao.Control.Panel"
xmlns:shux="using:Snap.Hutao.UI.Xaml"
xmlns:shuxb="using:Snap.Hutao.UI.Xaml.Behavior"
xmlns:shva="using:Snap.Hutao.ViewModel.Achievement"
d:DataContext="{d:DesignInstance shva:AchievementViewModel}"
@@ -159,7 +159,7 @@
Visibility="{Binding IsChecked, Converter={StaticResource BoolToVisibilityConverter}}"/>
<shci:CachedImage
Grid.Column="2"
shch:FrameworkElementHelper.SquareLength="32"
shux:FrameworkElementHelper.SquareLength="32"
Source="{StaticResource UI_ItemIcon_201}"/>
<TextBlock
Grid.Column="3"

View File

@@ -10,11 +10,11 @@
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
xmlns:mxic="using:Microsoft.Xaml.Interactions.Core"
xmlns:shc="using:Snap.Hutao.Control"
xmlns:shch="using:Snap.Hutao.Control.Helper"
xmlns:shci="using:Snap.Hutao.Control.Image"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
xmlns:shuxb="using:Snap.Hutao.UI.Xaml.Behavior"
xmlns:shuxba="using:Snap.Hutao.UI.Xaml.Behavior.Action"
xmlns:shuxc="using:Snap.Hutao.UI.Xaml.Control"
xmlns:shuxma="using:Snap.Hutao.UI.Xaml.Media.Animation"
xmlns:shvco="using:Snap.Hutao.View.Control"
xmlns:shvcp="using:Snap.Hutao.View.Card.Primitive"
@@ -178,7 +178,7 @@
<InfoBar
Title="{Binding Title}"
Margin="0,0,0,0"
shch:InfoBarHelper.IsTextSelectionEnabled="True"
shuxc:InfoBarHelper.IsTextSelectionEnabled="True"
CloseButtonCommand="{Binding DismissCommand}"
CloseButtonCommandParameter="{Binding}"
IsOpen="True"

View File

@@ -9,10 +9,10 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
xmlns:shc="using:Snap.Hutao.Control"
xmlns:shch="using:Snap.Hutao.Control.Helper"
xmlns:shci="using:Snap.Hutao.Control.Image"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
xmlns:shme="using:Snap.Hutao.Model.Entity"
xmlns:shux="using:Snap.Hutao.UI.Xaml"
xmlns:shuxb="using:Snap.Hutao.UI.Xaml.Behavior"
xmlns:shvc="using:Snap.Hutao.View.Control"
xmlns:shvcp="using:Snap.Hutao.View.Card.Primitive"
@@ -92,7 +92,7 @@
Margin="8,0,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Stretch"
shch:FrameworkElementHelper.SquareLength="40"
shux:FrameworkElementHelper.SquareLength="40"
Background="Transparent"
BorderBrush="{x:Null}"
BorderThickness="0"
@@ -104,7 +104,7 @@
<Button
Margin="8,0,0,0"
VerticalAlignment="Stretch"
shch:FrameworkElementHelper.SquareLength="40"
shux:FrameworkElementHelper.SquareLength="40"
Background="Transparent"
BorderBrush="{x:Null}"
BorderThickness="0"
@@ -138,7 +138,7 @@
Grid.Column="0"
Margin="4"
VerticalAlignment="Center"
shch:FrameworkElementHelper.SquareLength="32"
shux:FrameworkElementHelper.SquareLength="32"
Source="{Binding DailyNote.IsArchonQuestFinished, Converter={StaticResource ArchonQuestIconConverter}}"/>
<StackPanel
Grid.Column="1"
@@ -175,7 +175,7 @@
Grid.Column="0"
Margin="4"
VerticalAlignment="Center"
shch:FrameworkElementHelper.SquareLength="32"
shux:FrameworkElementHelper.SquareLength="32"
Source="{StaticResource UI_ItemIcon_210}"/>
<StackPanel
Grid.Column="1"
@@ -212,7 +212,7 @@
Grid.Column="0"
Margin="4"
VerticalAlignment="Center"
shch:FrameworkElementHelper.SquareLength="32"
shux:FrameworkElementHelper.SquareLength="32"
Source="{StaticResource UI_ItemIcon_204}"/>
<StackPanel
Grid.Column="1"
@@ -250,7 +250,7 @@
Grid.Column="0"
Margin="4"
VerticalAlignment="Center"
shch:FrameworkElementHelper.SquareLength="32"
shux:FrameworkElementHelper.SquareLength="32"
Source="{Binding DailyNote.DailyTask.IsExtraTaskRewardReceived, Converter={StaticResource DailyTaskIconConverter}}"/>
<StackPanel
Grid.Column="1"
@@ -316,7 +316,7 @@
Grid.Column="0"
Margin="4"
VerticalAlignment="Center"
shch:FrameworkElementHelper.SquareLength="32"
shux:FrameworkElementHelper.SquareLength="32"
Source="{StaticResource UI_MarkTower}"/>
<StackPanel
Grid.Column="1"
@@ -353,7 +353,7 @@
Grid.Column="0"
Margin="4"
VerticalAlignment="Center"
shch:FrameworkElementHelper.SquareLength="32"
shux:FrameworkElementHelper.SquareLength="32"
Source="{StaticResource UI_ItemIcon_220021}"/>
<StackPanel
Grid.Column="1"
@@ -406,7 +406,7 @@
Value="{Binding PassedTime, Mode=OneWay}"/>
<shci:CachedImage
Margin="0,0,0,8"
shch:FrameworkElementHelper.SquareLength="32"
shux:FrameworkElementHelper.SquareLength="32"
Source="{Binding AvatarSideIcon, Mode=OneWay}"/>
<TextBlock
Grid.Column="1"

View File

@@ -2,11 +2,11 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Service.Navigation;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.Service.User;
using Snap.Hutao.Web.Bridge;
using Snap.Hutao.Web.WebView2;
namespace Snap.Hutao.View.Page;

View File

@@ -8,11 +8,11 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
xmlns:shc="using:Snap.Hutao.Control"
xmlns:shccs="using:Snap.Hutao.Control.Collection.Selector"
xmlns:shch="using:Snap.Hutao.Control.Helper"
xmlns:shci="using:Snap.Hutao.Control.Image"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
xmlns:shuxb="using:Snap.Hutao.UI.Xaml.Behavior"
xmlns:shuxc="using:Snap.Hutao.UI.Xaml.Control"
xmlns:shvc="using:Snap.Hutao.View.Control"
xmlns:shvg="using:Snap.Hutao.ViewModel.Game"
d:DataContext="{d:DesignInstance shvg:LaunchGameViewModel}"
@@ -172,7 +172,7 @@
<StackPanel Orientation="Horizontal" Spacing="{ThemeResource SettingsCardContentControlSpacing}">
<shvc:Elevation Visibility="{Binding RuntimeOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
<shc:SizeRestrictedContentControl>
<shccs:ComboBox2
<shuxc:ComboBox2
DisplayMemberPath="DisplayName"
EnableMemberPath="IsNotCompatOnly"
ItemsSource="{Binding KnownSchemes}"
@@ -237,7 +237,7 @@
Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
Text="{shcm:ResourceString Name=ViewPageLaunchGameProcessHeader}"/>
<cwc:SettingsExpander
shch:SettingsExpanderHelper.IsItemsEnabled="{Binding LaunchOptions.IsEnabled}"
shuxc:SettingsExpanderHelper.IsItemsEnabled="{Binding LaunchOptions.IsEnabled}"
Description="{shcm:ResourceString Name=ViewPageLaunchGameArgumentsDescription}"
Header="{shcm:ResourceString Name=ViewPageLaunchGameArgumentsHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE943;}"

View File

@@ -10,9 +10,9 @@
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
xmlns:mxic="using:Microsoft.Xaml.Interactions.Core"
xmlns:shc="using:Snap.Hutao.Control"
xmlns:shch="using:Snap.Hutao.Control.Helper"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
xmlns:shuxb="using:Snap.Hutao.UI.Xaml.Behavior"
xmlns:shuxc="using:Snap.Hutao.UI.Xaml.Control"
xmlns:shvc="using:Snap.Hutao.View.Control"
xmlns:shvs="using:Snap.Hutao.ViewModel.Setting"
d:DataContext="{d:DesignInstance shvs:SettingViewModel}"
@@ -25,7 +25,7 @@
<Grid x:Name="SettingPageGrid">
<ScrollViewer Style="{StaticResource TwoPanelScrollViewerStyle}">
<shch:ScrollViewerHelper.RightPanel>
<shuxc:ScrollViewerHelper.RightPanel>
<Border
x:Name="ScrollViwerRightPanel"
Width="400"
@@ -109,7 +109,7 @@
</StackPanel>
</Grid>
</Border>
</shch:ScrollViewerHelper.RightPanel>
</shuxc:ScrollViewerHelper.RightPanel>
<Grid HorizontalAlignment="Left">
<StackPanel
Grid.Column="0"
@@ -595,7 +595,7 @@
<ToggleSwitch Width="120" IsOn="{Binding IsAllocConsoleDebugModeEnabled, Mode=TwoWay}"/>
</cwc:SettingsCard>
<cwc:SettingsExpander
shch:SettingsExpanderHelper.IsItemsEnabled="{Binding RuntimeOptions.IsElevated}"
shuxc:SettingsExpanderHelper.IsItemsEnabled="{Binding RuntimeOptions.IsElevated}"
Header="{shcm:ResourceString Name=ViewPageSettingIsAdvancedLaunchOptionsEnabledHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE730;}"
IsEnabled="{Binding RuntimeOptions.IsElevated}"

View File

@@ -9,11 +9,11 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
xmlns:shc="using:Snap.Hutao.Control"
xmlns:shch="using:Snap.Hutao.Control.Helper"
xmlns:shci="using:Snap.Hutao.Control.Image"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
xmlns:shcp="using:Snap.Hutao.Control.Panel"
xmlns:shct="using:Snap.Hutao.Control.Text"
xmlns:shux="using:Snap.Hutao.UI.Xaml"
xmlns:shuxb="using:Snap.Hutao.UI.Xaml.Behavior"
xmlns:shvcom="using:Snap.Hutao.ViewModel.Complex"
xmlns:shvcon="using:Snap.Hutao.View.Control"
@@ -509,7 +509,7 @@
<shvcon:ItemIcon
Width="40"
Height="40"
shch:UIElementHelper.OpacityObject="{Binding Icon}"
shux:UIElementHelper.OpacityObject="{Binding Icon}"
Icon="{Binding Icon}"
Opacity="0"
Quality="{Binding Quality}"/>

View File

@@ -3,7 +3,7 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.UI.Xaml;
using Snap.Hutao.ViewModel;
namespace Snap.Hutao.View;

View File

@@ -2,7 +2,7 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.UI.Xaml;
using Snap.Hutao.ViewModel.User;
namespace Snap.Hutao.View;

View File

@@ -2,12 +2,12 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Core.IO;
using Snap.Hutao.Factory.Picker;
using Snap.Hutao.Model.InterChange.Achievement;
using Snap.Hutao.Service.Achievement;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.UI.Xaml.Control;
using Snap.Hutao.View.Dialog;
using EntityAchievementArchive = Snap.Hutao.Model.Entity.AchievementArchive;

View File

@@ -2,7 +2,6 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Collection.AdvancedCollectionView;
using Snap.Hutao.Core.ExceptionService;
using Snap.Hutao.Core.IO;
using Snap.Hutao.Core.LifeCycle;
@@ -12,6 +11,7 @@ using Snap.Hutao.Service.Metadata;
using Snap.Hutao.Service.Metadata.ContextAbstraction;
using Snap.Hutao.Service.Navigation;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.UI.Xaml.Data;
using Snap.Hutao.View.Dialog;
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;

View File

@@ -5,7 +5,6 @@ using CommunityToolkit.Mvvm.Messaging;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Imaging;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Control.Media;
using Snap.Hutao.Core.ExceptionService;
using Snap.Hutao.Core.IO.DataTransfer;
@@ -17,6 +16,7 @@ using Snap.Hutao.Service.AvatarInfo;
using Snap.Hutao.Service.Cultivation;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.Service.User;
using Snap.Hutao.UI.Xaml.Control;
using Snap.Hutao.View.Dialog;
using Snap.Hutao.ViewModel.User;
using Snap.Hutao.Web.Hoyolab.Takumi.Event.Calculate;

View File

@@ -2,7 +2,6 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Core.ExceptionService;
using Snap.Hutao.Factory.ContentDialog;
using Snap.Hutao.Model.Entity;
@@ -12,6 +11,7 @@ using Snap.Hutao.Service.Metadata;
using Snap.Hutao.Service.Metadata.ContextAbstraction;
using Snap.Hutao.Service.Navigation;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.UI.Xaml.Control;
using Snap.Hutao.View.Dialog;
using System.Collections.ObjectModel;

View File

@@ -2,7 +2,6 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Core;
using Snap.Hutao.Core.ExceptionService;
using Snap.Hutao.Factory.ContentDialog;
@@ -12,6 +11,7 @@ using Snap.Hutao.Service.DailyNote;
using Snap.Hutao.Service.Metadata;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.Service.User;
using Snap.Hutao.UI.Xaml.Control;
using Snap.Hutao.View.Control;
using Snap.Hutao.View.Dialog;
using Snap.Hutao.ViewModel.User;

View File

@@ -2,7 +2,6 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Core.Database;
using Snap.Hutao.Core.ExceptionService;
using Snap.Hutao.Core.IO;
@@ -14,6 +13,7 @@ using Snap.Hutao.Model.InterChange.GachaLog;
using Snap.Hutao.Service.GachaLog;
using Snap.Hutao.Service.GachaLog.QueryProvider;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.UI.Xaml.Control;
using Snap.Hutao.View.Dialog;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices;
@@ -152,7 +152,7 @@ internal sealed partial class GachaLogViewModel : Abstraction.ViewModel
GachaLogRefreshProgressDialog dialog = await contentDialogFactory.CreateInstanceAsync<GachaLogRefreshProgressDialog>().ConfigureAwait(false);
ContentDialogHideToken hideToken;
ContentDialogScope hideToken;
try
{
hideToken = await dialog.BlockAsync(taskContext).ConfigureAwait(false);

View File

@@ -2,13 +2,13 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Factory.ContentDialog;
using Snap.Hutao.Model.Entity;
using Snap.Hutao.Service.GachaLog;
using Snap.Hutao.Service.Hutao;
using Snap.Hutao.Service.Navigation;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.UI.Xaml.Control;
using Snap.Hutao.Web.Hutao.GachaLog;
using Snap.Hutao.Web.Response;
using System.Collections.ObjectModel;

View File

@@ -2,7 +2,6 @@
// Licensed under the MIT license.
using Microsoft.Extensions.Caching.Memory;
using Snap.Hutao.Control.Collection.AdvancedCollectionView;
using Snap.Hutao.Core;
using Snap.Hutao.Core.Database;
using Snap.Hutao.Core.Diagnostics.CodeAnalysis;
@@ -15,6 +14,7 @@ using Snap.Hutao.Service.Game.PathAbstraction;
using Snap.Hutao.Service.Game.Scheme;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.Service.User;
using Snap.Hutao.UI.Xaml.Data;
using Snap.Hutao.Web.Hoyolab.HoyoPlay.Connect;
using Snap.Hutao.Web.Hoyolab.HoyoPlay.Connect.Package;
using System.Collections.Immutable;

View File

@@ -1,11 +1,11 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Control.Collection.AdvancedCollectionView;
using Snap.Hutao.Model.Entity;
using Snap.Hutao.Service.Game;
using Snap.Hutao.Service.Game.Scheme;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.UI.Xaml.Data;
using System.Collections.ObjectModel;
namespace Snap.Hutao.ViewModel.Game;

View File

@@ -5,7 +5,6 @@ using CommunityToolkit.Mvvm.Messaging;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.Windows.AppLifecycle;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Core;
using Snap.Hutao.Core.Caching;
using Snap.Hutao.Core.Logging;
@@ -24,6 +23,7 @@ using Snap.Hutao.Service.Hutao;
using Snap.Hutao.Service.Navigation;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.Service.User;
using Snap.Hutao.UI.Xaml.Control;
using Snap.Hutao.View.Dialog;
using Snap.Hutao.ViewModel.Guide;
using Snap.Hutao.Web.Hoyolab;

View File

@@ -2,7 +2,6 @@
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Core;
using Snap.Hutao.Core.Windowing.HotKey;
using Snap.Hutao.Factory.ContentDialog;
@@ -10,6 +9,7 @@ using Snap.Hutao.Factory.Progress;
using Snap.Hutao.Service.Abstraction;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.Service.Update;
using Snap.Hutao.UI.Xaml.Control;
using Snap.Hutao.View.Dialog;
using System.Globalization;
using System.Text;

View File

@@ -1,7 +1,6 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Control.Collection.AdvancedCollectionView;
using Snap.Hutao.Core.ExceptionService;
using Snap.Hutao.Factory.ContentDialog;
using Snap.Hutao.Model.Calculable;
@@ -19,6 +18,7 @@ using Snap.Hutao.Service.Metadata;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.Service.User;
using Snap.Hutao.UI.Xaml.Control.Tokenizing;
using Snap.Hutao.UI.Xaml.Data;
using Snap.Hutao.View.Dialog;
using Snap.Hutao.ViewModel.User;
using Snap.Hutao.Web.Response;

View File

@@ -1,12 +1,12 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Control.Collection.AdvancedCollectionView;
using Snap.Hutao.Model.Intrinsic;
using Snap.Hutao.Model.Metadata.Item;
using Snap.Hutao.Model.Metadata.Monster;
using Snap.Hutao.Model.Primitive;
using Snap.Hutao.Service.Metadata;
using Snap.Hutao.UI.Xaml.Data;
namespace Snap.Hutao.ViewModel.Wiki;

View File

@@ -1,7 +1,6 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Control.Collection.AdvancedCollectionView;
using Snap.Hutao.Core.ExceptionService;
using Snap.Hutao.Factory.ContentDialog;
using Snap.Hutao.Model.Calculable;
@@ -19,6 +18,7 @@ using Snap.Hutao.Service.Metadata;
using Snap.Hutao.Service.Notification;
using Snap.Hutao.Service.User;
using Snap.Hutao.UI.Xaml.Control.Tokenizing;
using Snap.Hutao.UI.Xaml.Data;
using Snap.Hutao.View.Dialog;
using Snap.Hutao.ViewModel.User;
using Snap.Hutao.Web.Response;

View File

@@ -2,8 +2,8 @@
// Licensed under the MIT license.
using Microsoft.Web.WebView2.Core;
using Snap.Hutao.Control.Extension;
using Snap.Hutao.Web.Hoyolab;
using Snap.Hutao.Web.WebView2;
namespace Snap.Hutao.Web.Bridge;

View File

@@ -1,11 +1,10 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Microsoft.UI.Xaml.Controls;
using Microsoft.Web.WebView2.Core;
using System.Diagnostics;
namespace Snap.Hutao.Control.Extension;
namespace Snap.Hutao.Web.WebView2;
/// <summary>
/// Bridge 拓展
@@ -39,7 +38,7 @@ internal static class WebView2Extension
}
}
public static bool IsDisposed(this WebView2 webView2)
public static bool IsDisposed(this Microsoft.UI.Xaml.Controls.WebView2 webView2)
{
return WinRTExtension.IsDisposed(webView2);
}