mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
drop CommunityToolkit.WinUI.UI.Core
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cwcw="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:cwuc="using:CommunityToolkit.WinUI.UI.Converters"
|
||||
xmlns:cwc="using:CommunityToolkit.WinUI.Converters"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
xmlns:shci="using:Snap.Hutao.Control.Image"
|
||||
xmlns:shmmc="using:Snap.Hutao.Model.Metadata.Converter"
|
||||
@@ -13,6 +13,7 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<muxc:XamlControlsResources/>
|
||||
<ResourceDictionary Source="Control/Theme/FontStyle.xaml"/>
|
||||
<ResourceDictionary Source="Control/Loading.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
@@ -117,9 +118,9 @@
|
||||
<x:String x:Key="FontIconContentAsteriskBadge12"></x:String>
|
||||
<x:String x:Key="FontIconContentZipFolder"></x:String>
|
||||
<!-- Converters -->
|
||||
<cwuc:BoolNegationConverter x:Key="BoolNegationConverter"/>
|
||||
<cwuc:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
<cwuc:FileSizeToFriendlyStringConverter x:Key="FileSizeToFriendlyStringConverter"/>
|
||||
<cwc:BoolNegationConverter x:Key="BoolNegationConverter"/>
|
||||
<cwc:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
<cwc:FileSizeToFriendlyStringConverter x:Key="FileSizeToFriendlyStringConverter"/>
|
||||
<shmmc:AchievementIconConverter x:Key="AchievementIconConverter"/>
|
||||
<shmmc:AvatarCardConverter x:Key="AvatarCardConverter"/>
|
||||
<shmmc:AvatarIconConverter x:Key="AvatarIconConverter"/>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.UI.Controls;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
using Snap.Hutao.Core.Caching;
|
||||
@@ -13,7 +12,7 @@ namespace Snap.Hutao.Control.Image;
|
||||
/// 缓存图像
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
internal sealed class CachedImage : ImageEx
|
||||
internal sealed class CachedImage : Implementation.ImageEx
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造一个新的缓存图像
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// 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;
|
||||
|
||||
internal class ImageEx : ImageExBase
|
||||
{
|
||||
private static readonly DependencyProperty NineGridProperty = DependencyProperty.Register(nameof(NineGrid), typeof(Thickness), typeof(ImageEx), new PropertyMetadata(default(Thickness)));
|
||||
|
||||
public ImageEx()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
public Thickness NineGrid
|
||||
{
|
||||
get => (Thickness)GetValue(NineGridProperty);
|
||||
set => SetValue(NineGridProperty, value);
|
||||
}
|
||||
|
||||
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!;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,468 @@
|
||||
// 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 System.IO;
|
||||
using Windows.Foundation;
|
||||
|
||||
namespace Snap.Hutao.Control.Image.Implementation;
|
||||
|
||||
internal delegate void ImageExFailedEventHandler(object sender, ImageExFailedEventArgs e);
|
||||
|
||||
internal delegate void ImageExOpenedEventHandler(object sender, ImageExOpenedEventArgs e);
|
||||
|
||||
[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))]
|
||||
internal abstract class ImageExBase : Microsoft.UI.Xaml.Controls.Control, IAlphaMaskProvider
|
||||
{
|
||||
protected const string PartImage = "Image";
|
||||
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 static readonly DependencyProperty StretchProperty = DependencyProperty.Register(nameof(Stretch), typeof(Stretch), typeof(ImageExBase), new PropertyMetadata(Stretch.Uniform));
|
||||
private static readonly DependencyProperty DecodePixelHeightProperty = DependencyProperty.Register(nameof(DecodePixelHeight), typeof(int), typeof(ImageExBase), new PropertyMetadata(0));
|
||||
private static readonly DependencyProperty DecodePixelTypeProperty = DependencyProperty.Register(nameof(DecodePixelType), typeof(int), typeof(ImageExBase), new PropertyMetadata(DecodePixelType.Physical));
|
||||
private static readonly DependencyProperty DecodePixelWidthProperty = DependencyProperty.Register(nameof(DecodePixelWidth), typeof(int), typeof(ImageExBase), new PropertyMetadata(0));
|
||||
private static readonly DependencyProperty IsCacheEnabledProperty = DependencyProperty.Register(nameof(IsCacheEnabled), typeof(bool), typeof(ImageExBase), new PropertyMetadata(false));
|
||||
private static readonly DependencyProperty EnableLazyLoadingProperty = DependencyProperty.Register(nameof(EnableLazyLoading), typeof(bool), typeof(ImageExBase), new PropertyMetadata(false, EnableLazyLoadingChanged));
|
||||
private static readonly DependencyProperty LazyLoadingThresholdProperty = DependencyProperty.Register(nameof(LazyLoadingThreshold), typeof(double), typeof(ImageExBase), new PropertyMetadata(default(double), LazyLoadingThresholdChanged));
|
||||
private static readonly DependencyProperty PlaceholderSourceProperty = DependencyProperty.Register(nameof(PlaceholderSource), typeof(ImageSource), typeof(ImageExBase), new PropertyMetadata(default(ImageSource), PlaceholderSourceChanged));
|
||||
private static readonly DependencyProperty PlaceholderStretchProperty = DependencyProperty.Register(nameof(PlaceholderStretch), typeof(Stretch), typeof(ImageExBase), new PropertyMetadata(default(Stretch)));
|
||||
private static readonly DependencyProperty SourceProperty = DependencyProperty.Register(nameof(Source), typeof(object), typeof(ImageExBase), new PropertyMetadata(null, SourceChanged));
|
||||
|
||||
private CancellationTokenSource? tokenSource;
|
||||
private object? lazyLoadingSource;
|
||||
private bool isInViewport;
|
||||
|
||||
public event ImageExFailedEventHandler? ImageExFailed;
|
||||
|
||||
public event ImageExOpenedEventHandler? ImageExOpened;
|
||||
|
||||
public event EventHandler? ImageExInitialized;
|
||||
|
||||
public bool IsInitialized { get; private set; }
|
||||
|
||||
public int DecodePixelHeight
|
||||
{
|
||||
get => (int)GetValue(DecodePixelHeightProperty);
|
||||
set => SetValue(DecodePixelHeightProperty, value);
|
||||
}
|
||||
|
||||
public DecodePixelType DecodePixelType
|
||||
{
|
||||
get => (DecodePixelType)GetValue(DecodePixelTypeProperty);
|
||||
set => SetValue(DecodePixelTypeProperty, value);
|
||||
}
|
||||
|
||||
public int DecodePixelWidth
|
||||
{
|
||||
get => (int)GetValue(DecodePixelWidthProperty);
|
||||
set => SetValue(DecodePixelWidthProperty, value);
|
||||
}
|
||||
|
||||
public Stretch Stretch
|
||||
{
|
||||
get => (Stretch)GetValue(StretchProperty);
|
||||
set => SetValue(StretchProperty, value);
|
||||
}
|
||||
|
||||
public bool IsCacheEnabled
|
||||
{
|
||||
get => (bool)GetValue(IsCacheEnabledProperty);
|
||||
set => SetValue(IsCacheEnabledProperty, value);
|
||||
}
|
||||
|
||||
public bool EnableLazyLoading
|
||||
{
|
||||
get => (bool)GetValue(EnableLazyLoadingProperty);
|
||||
set => SetValue(EnableLazyLoadingProperty, value);
|
||||
}
|
||||
|
||||
public double LazyLoadingThreshold
|
||||
{
|
||||
get => (double)GetValue(LazyLoadingThresholdProperty);
|
||||
set => SetValue(LazyLoadingThresholdProperty, value);
|
||||
}
|
||||
|
||||
public ImageSource PlaceholderSource
|
||||
{
|
||||
get => (ImageSource)GetValue(PlaceholderSourceProperty);
|
||||
set => SetValue(PlaceholderSourceProperty, value);
|
||||
}
|
||||
|
||||
public Stretch PlaceholderStretch
|
||||
{
|
||||
get => (Stretch)GetValue(PlaceholderStretchProperty);
|
||||
set => SetValue(PlaceholderStretchProperty, value);
|
||||
}
|
||||
|
||||
public object Source
|
||||
{
|
||||
get => GetValue(SourceProperty);
|
||||
set => SetValue(SourceProperty, value);
|
||||
}
|
||||
|
||||
public bool WaitUntilLoaded
|
||||
{
|
||||
get => true;
|
||||
}
|
||||
|
||||
protected object? Image { get; private set; }
|
||||
|
||||
public abstract CompositionBrush GetAlphaMask();
|
||||
|
||||
protected virtual void OnPlaceholderSourceChanged(DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual Task<ImageSource?> ProvideCachedResourceAsync(Uri imageUri, CancellationToken token)
|
||||
{
|
||||
// By default we just use the built-in UWP image cache provided within the Image control.
|
||||
return Task.FromResult<ImageSource?>(new BitmapImage(imageUri));
|
||||
}
|
||||
|
||||
protected virtual void OnImageOpened(object sender, RoutedEventArgs e)
|
||||
{
|
||||
VisualStateManager.GoToState(this, LoadedState, true);
|
||||
ImageExOpened?.Invoke(this, new ImageExOpenedEventArgs());
|
||||
}
|
||||
|
||||
protected virtual void OnImageFailed(object sender, ExceptionRoutedEventArgs e)
|
||||
{
|
||||
VisualStateManager.GoToState(this, FailedState, true);
|
||||
ImageExFailed?.Invoke(this, new ImageExFailedEventArgs(new FileNotFoundException(e.ErrorMessage)));
|
||||
}
|
||||
|
||||
protected 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;
|
||||
}
|
||||
}
|
||||
|
||||
protected 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;
|
||||
}
|
||||
}
|
||||
|
||||
protected 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;
|
||||
}
|
||||
}
|
||||
|
||||
protected 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;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate()
|
||||
{
|
||||
RemoveImageOpened(OnImageOpened);
|
||||
RemoveImageFailed(OnImageFailed);
|
||||
|
||||
Image = GetTemplateChild(PartImage);
|
||||
|
||||
IsInitialized = true;
|
||||
|
||||
ImageExInitialized?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
if (Source is null || !EnableLazyLoading || isInViewport)
|
||||
{
|
||||
lazyLoadingSource = null;
|
||||
SetSource(Source);
|
||||
}
|
||||
else
|
||||
{
|
||||
lazyLoadingSource = Source;
|
||||
}
|
||||
|
||||
AttachImageOpened(OnImageOpened);
|
||||
AttachImageFailed(OnImageFailed);
|
||||
|
||||
base.OnApplyTemplate();
|
||||
}
|
||||
|
||||
private static void EnableLazyLoadingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is ImageExBase control)
|
||||
{
|
||||
bool value = (bool)e.NewValue;
|
||||
if (value)
|
||||
{
|
||||
control.LayoutUpdated += control.ImageExBase_LayoutUpdated;
|
||||
|
||||
control.InvalidateLazyLoading();
|
||||
}
|
||||
else
|
||||
{
|
||||
control.LayoutUpdated -= control.ImageExBase_LayoutUpdated;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void LazyLoadingThresholdChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is ImageExBase control && control.EnableLazyLoading)
|
||||
{
|
||||
control.InvalidateLazyLoading();
|
||||
}
|
||||
}
|
||||
|
||||
private static void PlaceholderSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is ImageExBase control)
|
||||
{
|
||||
control.OnPlaceholderSourceChanged(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is not ImageExBase control)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.OldValue is null || e.NewValue is null || !e.OldValue.Equals(e.NewValue))
|
||||
{
|
||||
if (e.NewValue is null || !control.EnableLazyLoading || control.isInViewport)
|
||||
{
|
||||
control.lazyLoadingSource = null;
|
||||
control.SetSource(e.NewValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
control.lazyLoadingSource = e.NewValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsHttpUri(Uri uri)
|
||||
{
|
||||
return uri.IsAbsoluteUri && (uri.Scheme == "http" || uri.Scheme == "https");
|
||||
}
|
||||
|
||||
private void AttachSource(ImageSource? source)
|
||||
{
|
||||
// Setting the source at this point should call ImageExOpened/VisualStateManager.GoToState
|
||||
// as we register to both the ImageOpened/ImageFailed events of the underlying control.
|
||||
// We only need to call those methods if we fail in other cases before we get here.
|
||||
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 if (source is BitmapSource { PixelHeight: > 0, PixelWidth: > 0 })
|
||||
{
|
||||
VisualStateManager.GoToState(this, LoadedState, true);
|
||||
ImageExOpened?.Invoke(this, new ImageExOpenedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("", "IDE0019")]
|
||||
private async void SetSource(object? source)
|
||||
{
|
||||
if (!IsInitialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tokenSource?.Cancel();
|
||||
|
||||
tokenSource = new CancellationTokenSource();
|
||||
|
||||
AttachSource(null);
|
||||
|
||||
if (source is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VisualStateManager.GoToState(this, LoadingState, true);
|
||||
|
||||
ImageSource? imageSource = source as ImageSource;
|
||||
if (imageSource is not null)
|
||||
{
|
||||
AttachSource(imageSource);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Uri? uri = source as Uri;
|
||||
if (uri is null)
|
||||
{
|
||||
string? url = source as string ?? source.ToString();
|
||||
if (!Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out uri))
|
||||
{
|
||||
VisualStateManager.GoToState(this, FailedState, true);
|
||||
ImageExFailed?.Invoke(this, new ImageExFailedEventArgs(new UriFormatException("Invalid uri specified.")));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsHttpUri(uri) && !uri.IsAbsoluteUri)
|
||||
{
|
||||
uri = new Uri("ms-appx:///" + uri.OriginalString.TrimStart('/'));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await LoadImageAsync(uri, tokenSource.Token).ConfigureAwait(true);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// nothing to do as cancellation has been requested.
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
VisualStateManager.GoToState(this, FailedState, true);
|
||||
ImageExFailed?.Invoke(this, new ImageExFailedEventArgs(e));
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadImageAsync(Uri imageUri, CancellationToken token)
|
||||
{
|
||||
if (imageUri is not null)
|
||||
{
|
||||
if (IsCacheEnabled)
|
||||
{
|
||||
ImageSource? img = await ProvideCachedResourceAsync(imageUri, token).ConfigureAwait(true);
|
||||
|
||||
ArgumentNullException.ThrowIfNull(tokenSource);
|
||||
if (!tokenSource.IsCancellationRequested)
|
||||
{
|
||||
// Only attach our image if we still have a valid request.
|
||||
AttachSource(img);
|
||||
}
|
||||
}
|
||||
else if (string.Equals(imageUri.Scheme, "data", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string source = imageUri.OriginalString;
|
||||
const string base64Head = "base64,";
|
||||
int index = source.IndexOf(base64Head, StringComparison.Ordinal);
|
||||
if (index >= 0)
|
||||
{
|
||||
byte[] bytes = Convert.FromBase64String(source[(index + base64Head.Length)..]);
|
||||
BitmapImage bitmap = new();
|
||||
await bitmap.SetSourceAsync(new MemoryStream(bytes).AsRandomAccessStream());
|
||||
|
||||
ArgumentNullException.ThrowIfNull(tokenSource);
|
||||
if (!tokenSource.IsCancellationRequested)
|
||||
{
|
||||
AttachSource(bitmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AttachSource(new BitmapImage(imageUri)
|
||||
{
|
||||
CreateOptions = BitmapCreateOptions.IgnoreImageCache,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ImageExBase_LayoutUpdated(object? sender, object e)
|
||||
{
|
||||
InvalidateLazyLoading();
|
||||
}
|
||||
|
||||
private void InvalidateLazyLoading()
|
||||
{
|
||||
if (!IsLoaded)
|
||||
{
|
||||
isInViewport = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the first ascendant ScrollViewer, if not found, use the root element.
|
||||
FrameworkElement? hostElement = default;
|
||||
IEnumerable<FrameworkElement> ascendants = this.FindAscendants().OfType<FrameworkElement>();
|
||||
foreach (FrameworkElement ascendant in ascendants)
|
||||
{
|
||||
hostElement = ascendant;
|
||||
if (hostElement is Microsoft.UI.Xaml.Controls.ScrollViewer)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hostElement is null)
|
||||
{
|
||||
isInViewport = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Rect controlRect = TransformToVisual(hostElement)
|
||||
.TransformBounds(new Rect(0, 0, ActualWidth, ActualHeight));
|
||||
double lazyLoadingThreshold = LazyLoadingThreshold;
|
||||
Rect hostRect = new(
|
||||
0 - lazyLoadingThreshold,
|
||||
0 - lazyLoadingThreshold,
|
||||
hostElement.ActualWidth + (2 * lazyLoadingThreshold),
|
||||
hostElement.ActualHeight + (2 * lazyLoadingThreshold));
|
||||
|
||||
if (controlRect.IntersectsWith(hostRect))
|
||||
{
|
||||
isInViewport = true;
|
||||
|
||||
if (lazyLoadingSource is not null)
|
||||
{
|
||||
object source = lazyLoadingSource;
|
||||
lazyLoadingSource = null;
|
||||
SetSource(source);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isInViewport = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Control.Image.Implementation;
|
||||
|
||||
internal sealed class ImageExFailedEventArgs : EventArgs
|
||||
{
|
||||
public ImageExFailedEventArgs(Exception errorException)
|
||||
{
|
||||
ErrorMessage = ErrorException?.Message;
|
||||
ErrorException = errorException;
|
||||
}
|
||||
|
||||
public Exception? ErrorException { get; private set; }
|
||||
|
||||
public string? ErrorMessage { get; private set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Control.Image.Implementation;
|
||||
|
||||
internal sealed class ImageExOpenedEventArgs : EventArgs
|
||||
{
|
||||
}
|
||||
47
src/Snap.Hutao/Snap.Hutao/Control/Loading.cs
Normal file
47
src/Snap.Hutao/Snap.Hutao/Control/Loading.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
namespace Snap.Hutao.Control;
|
||||
|
||||
[TemplateVisualState(Name = "LoadingIn", GroupName = "CommonStates")]
|
||||
[TemplateVisualState(Name = "LoadingOut", GroupName = "CommonStates")]
|
||||
internal class Loading : Microsoft.UI.Xaml.Controls.ContentControl
|
||||
{
|
||||
private static readonly DependencyProperty IsLoadingProperty = DependencyProperty.Register(nameof(IsLoading), typeof(bool), typeof(Loading), new PropertyMetadata(default(bool), IsLoadingPropertyChanged));
|
||||
|
||||
private FrameworkElement? presenter;
|
||||
|
||||
public Loading()
|
||||
{
|
||||
DefaultStyleKey = typeof(Loading);
|
||||
DefaultStyleResourceUri = new("ms-appx:///Control/Loading.xaml");
|
||||
}
|
||||
|
||||
public bool IsLoading
|
||||
{
|
||||
get => (bool)GetValue(IsLoadingProperty);
|
||||
set => SetValue(IsLoadingProperty, value);
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
private static void IsLoadingPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
Loading control = (Loading)d;
|
||||
control.presenter ??= control.GetTemplateChild("ContentGrid") as FrameworkElement;
|
||||
|
||||
control?.Update();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
VisualStateManager.GoToState(this, IsLoading ? "LoadingIn" : "LoadingOut", true);
|
||||
}
|
||||
}
|
||||
85
src/Snap.Hutao/Snap.Hutao/Control/Loading.xaml
Normal file
85
src/Snap.Hutao/Snap.Hutao/Control/Loading.xaml
Normal file
@@ -0,0 +1,85 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:shc="using:Snap.Hutao.Control">
|
||||
|
||||
<Style TargetType="shc:Loading">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="shc:Loading">
|
||||
<Border
|
||||
x:Name="RootGrid"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Opacity="0"
|
||||
Visibility="Collapsed">
|
||||
<ContentPresenter
|
||||
x:Name="ContentGrid"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
||||
<ContentPresenter.RenderTransform>
|
||||
<CompositeTransform/>
|
||||
</ContentPresenter.RenderTransform>
|
||||
</ContentPresenter>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="LoadingIn">
|
||||
<Storyboard>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Opacity">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0" Value="0">
|
||||
<EasingDoubleKeyFrame.EasingFunction>
|
||||
<QuadraticEase EasingMode="EaseInOut"/>
|
||||
</EasingDoubleKeyFrame.EasingFunction>
|
||||
</EasingDoubleKeyFrame>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1">
|
||||
<EasingDoubleKeyFrame.EasingFunction>
|
||||
<QuadraticEase EasingMode="EaseInOut"/>
|
||||
</EasingDoubleKeyFrame.EasingFunction>
|
||||
</EasingDoubleKeyFrame>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0">
|
||||
<DiscreteObjectKeyFrame.Value>
|
||||
<Visibility>Visible</Visibility>
|
||||
</DiscreteObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="LoadingOut">
|
||||
<Storyboard>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Opacity">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0" Value="1">
|
||||
<EasingDoubleKeyFrame.EasingFunction>
|
||||
<QuadraticEase EasingMode="EaseInOut"/>
|
||||
</EasingDoubleKeyFrame.EasingFunction>
|
||||
</EasingDoubleKeyFrame>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0">
|
||||
<EasingDoubleKeyFrame.EasingFunction>
|
||||
<QuadraticEase EasingMode="EaseInOut"/>
|
||||
</EasingDoubleKeyFrame.EasingFunction>
|
||||
</EasingDoubleKeyFrame>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0.3">
|
||||
<DiscreteObjectKeyFrame.Value>
|
||||
<Visibility>Collapsed</Visibility>
|
||||
</DiscreteObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -20,6 +20,7 @@ namespace Snap.Hutao.Control.Text;
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
[DependencyProperty("Description", typeof(string), "", nameof(OnDescriptionChanged))]
|
||||
[DependencyProperty("TextStyle", typeof(Style), default(Style), nameof(OnTextStyleChanged))]
|
||||
internal sealed partial class DescriptionTextBlock : ContentControl
|
||||
{
|
||||
private static readonly int ColorTagFullLength = "<color=#FFFFFFFF></color>".Length;
|
||||
@@ -40,6 +41,7 @@ internal sealed partial class DescriptionTextBlock : ContentControl
|
||||
Content = new TextBlock()
|
||||
{
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
Style = TextStyle,
|
||||
};
|
||||
|
||||
actualThemeChangedEventHandler = OnActualThemeChanged;
|
||||
@@ -54,6 +56,12 @@ internal sealed partial class DescriptionTextBlock : ContentControl
|
||||
UpdateDescription(textBlock, description);
|
||||
}
|
||||
|
||||
private static void OnTextStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
TextBlock textBlock = (TextBlock)((DescriptionTextBlock)d).Content;
|
||||
textBlock.Style = (Style)e.NewValue;
|
||||
}
|
||||
|
||||
private static void UpdateDescription(TextBlock textBlock, in ReadOnlySpan<char> description)
|
||||
{
|
||||
textBlock.Inlines.Clear();
|
||||
|
||||
@@ -34,6 +34,11 @@ internal sealed class Monster
|
||||
/// </summary>
|
||||
public string MonsterName { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
<None Remove="Assets\Wide310x150Logo.scale-200.png" />
|
||||
<None Remove="Assets\Wide310x150Logo.scale-400.png" />
|
||||
<None Remove="CodeMetricsConfig.txt" />
|
||||
<None Remove="Control\Loading.xaml" />
|
||||
<None Remove="Control\Panel\PanelSelector.xaml" />
|
||||
<None Remove="Control\Theme\FontStyle.xaml" />
|
||||
<None Remove="GuideWindow.xaml" />
|
||||
@@ -242,13 +243,13 @@
|
||||
<PackageReference Include="CommunityToolkit.Labs.WinUI.TransitionHelper" Version="0.1.230809" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2-build.1" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.0.230907" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Collections" Version="8.0.230907" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.HeaderedControls" Version="8.0.230907" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.0.230907" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.0.230907" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.230907" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.0.230907" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Notifications" Version="7.1.2" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Core" Version="7.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.10">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
@@ -302,6 +303,12 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="Control\Loading.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="View\Dialog\CultivatePromotionDeltaBatchDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -1,102 +1,29 @@
|
||||
<cwuc:Loading
|
||||
<shc:Loading
|
||||
x:Class="Snap.Hutao.View.Control.LoadingView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:clw="using:CommunityToolkit.Labs.WinUI"
|
||||
xmlns:cwuc="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:shc="using:Snap.Hutao.Control"
|
||||
xmlns:shci="using:Snap.Hutao.Control.Image"
|
||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
mc:Ignorable="d">
|
||||
<cwuc:Loading.Style>
|
||||
<Style TargetType="cwuc:Loading">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="cwuc:Loading">
|
||||
<Border
|
||||
x:Name="RootGrid"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Opacity="0"
|
||||
Visibility="Collapsed">
|
||||
<Grid>
|
||||
<clw:Shimmer IsActive="{x:Bind IsLoading, Mode=OneWay}"/>
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<shci:CachedImage
|
||||
Width="120"
|
||||
Height="120"
|
||||
EnableLazyLoading="False"
|
||||
Source="{StaticResource UI_EmotionIcon272}"/>
|
||||
<TextBlock
|
||||
Margin="0,16,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||
Text="{shcm:ResourceString Name=ViewControlLoadingText}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="LoadingIn">
|
||||
<Storyboard>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Opacity">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0" Value="0">
|
||||
<EasingDoubleKeyFrame.EasingFunction>
|
||||
<QuadraticEase EasingMode="EaseInOut"/>
|
||||
</EasingDoubleKeyFrame.EasingFunction>
|
||||
</EasingDoubleKeyFrame>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1">
|
||||
<EasingDoubleKeyFrame.EasingFunction>
|
||||
<QuadraticEase EasingMode="EaseInOut"/>
|
||||
</EasingDoubleKeyFrame.EasingFunction>
|
||||
</EasingDoubleKeyFrame>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0">
|
||||
<DiscreteObjectKeyFrame.Value>
|
||||
<Visibility>Visible</Visibility>
|
||||
</DiscreteObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="LoadingOut">
|
||||
<Storyboard>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Opacity">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0" Value="1">
|
||||
<EasingDoubleKeyFrame.EasingFunction>
|
||||
<QuadraticEase EasingMode="EaseInOut"/>
|
||||
</EasingDoubleKeyFrame.EasingFunction>
|
||||
</EasingDoubleKeyFrame>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0">
|
||||
<EasingDoubleKeyFrame.EasingFunction>
|
||||
<QuadraticEase EasingMode="EaseInOut"/>
|
||||
</EasingDoubleKeyFrame.EasingFunction>
|
||||
</EasingDoubleKeyFrame>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0.3">
|
||||
<DiscreteObjectKeyFrame.Value>
|
||||
<Visibility>Collapsed</Visibility>
|
||||
</DiscreteObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</cwuc:Loading.Style>
|
||||
|
||||
</cwuc:Loading>
|
||||
<Grid>
|
||||
<clw:Shimmer IsActive="{x:Bind IsLoading, Mode=OneWay}"/>
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<shci:CachedImage
|
||||
Width="120"
|
||||
Height="120"
|
||||
EnableLazyLoading="False"
|
||||
Source="{StaticResource UI_EmotionIcon272}"/>
|
||||
<TextBlock
|
||||
Margin="0,16,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||
Text="{shcm:ResourceString Name=ViewControlLoadingText}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</shc:Loading>
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.UI.Controls;
|
||||
using Snap.Hutao.Control;
|
||||
|
||||
namespace Snap.Hutao.View.Control;
|
||||
|
||||
|
||||
@@ -1,86 +1,14 @@
|
||||
<cwuc:Loading
|
||||
<shc:Loading
|
||||
x:Class="Snap.Hutao.View.Control.LoadingViewSlim"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:clw="using:CommunityToolkit.Labs.WinUI"
|
||||
xmlns:cwuc="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:shc="using:Snap.Hutao.Control"
|
||||
Height="{StaticResource HomeAdaptiveCardHeight}"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
mc:Ignorable="d">
|
||||
<cwuc:Loading.Style>
|
||||
<Style TargetType="cwuc:Loading">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="cwuc:Loading">
|
||||
<Border
|
||||
x:Name="RootGrid"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Opacity="0"
|
||||
Visibility="Collapsed">
|
||||
<clw:Shimmer IsActive="{x:Bind IsLoading}" Duration="0:0:1"/>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="LoadingIn">
|
||||
<Storyboard>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Opacity">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0" Value="0">
|
||||
<EasingDoubleKeyFrame.EasingFunction>
|
||||
<QuadraticEase EasingMode="EaseInOut"/>
|
||||
</EasingDoubleKeyFrame.EasingFunction>
|
||||
</EasingDoubleKeyFrame>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1">
|
||||
<EasingDoubleKeyFrame.EasingFunction>
|
||||
<QuadraticEase EasingMode="EaseInOut"/>
|
||||
</EasingDoubleKeyFrame.EasingFunction>
|
||||
</EasingDoubleKeyFrame>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0">
|
||||
<DiscreteObjectKeyFrame.Value>
|
||||
<Visibility>Visible</Visibility>
|
||||
</DiscreteObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="LoadingOut">
|
||||
<Storyboard>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Opacity">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0" Value="1">
|
||||
<EasingDoubleKeyFrame.EasingFunction>
|
||||
<QuadraticEase EasingMode="EaseInOut"/>
|
||||
</EasingDoubleKeyFrame.EasingFunction>
|
||||
</EasingDoubleKeyFrame>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0">
|
||||
<EasingDoubleKeyFrame.EasingFunction>
|
||||
<QuadraticEase EasingMode="EaseInOut"/>
|
||||
</EasingDoubleKeyFrame.EasingFunction>
|
||||
</EasingDoubleKeyFrame>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0.3">
|
||||
<DiscreteObjectKeyFrame.Value>
|
||||
<Visibility>Collapsed</Visibility>
|
||||
</DiscreteObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</cwuc:Loading.Style>
|
||||
</cwuc:Loading>
|
||||
<clw:Shimmer IsActive="{x:Bind IsLoading}" Duration="0:0:1"/>
|
||||
</shc:Loading>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.UI.Controls;
|
||||
using Snap.Hutao.Control;
|
||||
|
||||
namespace Snap.Hutao.View.Control;
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
x:Class="Snap.Hutao.View.Control.StatisticsCard"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:cwuc="using:CommunityToolkit.WinUI.UI.Converters"
|
||||
xmlns:cwcont="using:CommunityToolkit.WinUI.Controls"
|
||||
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:shch="using:Snap.Hutao.Control.Helper"
|
||||
@@ -78,7 +78,7 @@
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<cwuc:BoolToObjectConverter
|
||||
<cwconv:BoolToObjectConverter
|
||||
x:Key="BoolToBrushConverter"
|
||||
FalseValue="{ThemeResource SystemFillColorCriticalBackgroundBrush}"
|
||||
TrueValue="{ThemeResource CardBackgroundFillColorDefaultBrush}"/>
|
||||
@@ -238,11 +238,11 @@
|
||||
HorizontalAlignment="Stretch"
|
||||
IsPredictPullAvailable="{Binding IsPredictPullAvailable}"
|
||||
SelectedIndex="0"/>
|
||||
<cwc:SwitchPresenter
|
||||
<cwcont:SwitchPresenter
|
||||
Height="85"
|
||||
Padding="0,12"
|
||||
Value="{x:Bind StatisticsSegmented.SelectedIndex, Mode=OneWay}">
|
||||
<cwc:Case Value="{shcm:Int32 Value=0}">
|
||||
<cwcont:Case Value="{shcm:Int32 Value=0}">
|
||||
<StackPanel Spacing="2">
|
||||
<Grid>
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="{shcm:ResourceString Name=ViewControlStatisticsCardOrangeAveragePullText}"/>
|
||||
@@ -274,8 +274,8 @@
|
||||
Text="{Binding MinOrangePullFormatted}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</cwc:Case>
|
||||
<cwc:Case Value="{shcm:Int32 Value=1}">
|
||||
</cwcont:Case>
|
||||
<cwcont:Case Value="{shcm:Int32 Value=1}">
|
||||
<StackPanel Spacing="2">
|
||||
<Grid>
|
||||
<TextBlock
|
||||
@@ -314,28 +314,28 @@
|
||||
Text="{Binding TotalBlueFormatted}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</cwc:Case>
|
||||
<cwc:Case Value="{shcm:Int32 Value=2}">
|
||||
</cwcont:Case>
|
||||
<cwcont:Case Value="{shcm:Int32 Value=2}">
|
||||
<StackPanel Spacing="2">
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="{Binding PredictedPullLeftToOrangeFormatted}"/>
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="{Binding ProbabilityOfNextPullIsOrangeFormatted}"/>
|
||||
</StackPanel>
|
||||
</cwc:Case>
|
||||
</cwc:SwitchPresenter>
|
||||
</cwcont:Case>
|
||||
</cwcont:SwitchPresenter>
|
||||
<MenuFlyoutSeparator Margin="-12,0,-12,0"/>
|
||||
</StackPanel>
|
||||
|
||||
</Expander>
|
||||
<cwc:SwitchPresenter
|
||||
<cwcont:SwitchPresenter
|
||||
Grid.Row="2"
|
||||
Margin="12,6,12,12"
|
||||
Value="{Binding ElementName=ItemsPanelSelector, Path=Current}">
|
||||
<cwc:SwitchPresenter.ContentTransitions>
|
||||
<cwcont:SwitchPresenter.ContentTransitions>
|
||||
<TransitionCollection>
|
||||
<ContentThemeTransition/>
|
||||
</TransitionCollection>
|
||||
</cwc:SwitchPresenter.ContentTransitions>
|
||||
<cwc:Case Value="List">
|
||||
</cwcont:SwitchPresenter.ContentTransitions>
|
||||
<cwcont:Case Value="List">
|
||||
<ListView
|
||||
ItemTemplate="{StaticResource OrangeListTemplate}"
|
||||
ItemsSource="{Binding OrangeList}"
|
||||
@@ -348,8 +348,8 @@
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
</ListView>
|
||||
</cwc:Case>
|
||||
<cwc:Case Value="Grid">
|
||||
</cwcont:Case>
|
||||
<cwcont:Case Value="Grid">
|
||||
<GridView
|
||||
Margin="0,0,-4,0"
|
||||
ItemTemplate="{StaticResource OrangeGridTemplate}"
|
||||
@@ -363,8 +363,8 @@
|
||||
</Style>
|
||||
</GridView.ItemContainerStyle>
|
||||
</GridView>
|
||||
</cwc:Case>
|
||||
</cwc:SwitchPresenter>
|
||||
</cwcont:Case>
|
||||
</cwcont:SwitchPresenter>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.UI.Converters;
|
||||
using CommunityToolkit.WinUI.Converters;
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
namespace Snap.Hutao.View.Converter;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.UI.Converters;
|
||||
using CommunityToolkit.WinUI.Converters;
|
||||
|
||||
namespace Snap.Hutao.View.Converter;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.UI.Converters;
|
||||
using CommunityToolkit.WinUI.Converters;
|
||||
|
||||
namespace Snap.Hutao.View.Converter;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.UI.Converters;
|
||||
using CommunityToolkit.WinUI.Converters;
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
namespace Snap.Hutao.View.Converter;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.UI.Converters;
|
||||
using CommunityToolkit.WinUI.Converters;
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
namespace Snap.Hutao.View.Converter;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.UI.Converters;
|
||||
using CommunityToolkit.WinUI.Converters;
|
||||
using Snap.Hutao.Control;
|
||||
|
||||
namespace Snap.Hutao.View.Converter;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
x:Class="Snap.Hutao.View.Page.AchievementPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cwuc="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
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:mxi="using:Microsoft.Xaml.Interactivity"
|
||||
@@ -118,13 +118,13 @@
|
||||
Label="{shcm:ResourceString Name=ViewPageAchievementSortIncompletedItemsFirst}"/>
|
||||
</CommandBar>
|
||||
</Grid>
|
||||
<cwuc:SwitchPresenter Grid.Row="1" Value="{Binding ElementName=ItemsPanelSelector, Path=Current}">
|
||||
<cwuc:SwitchPresenter.ContentTransitions>
|
||||
<cwc:SwitchPresenter Grid.Row="1" Value="{Binding ElementName=ItemsPanelSelector, Path=Current}">
|
||||
<cwc:SwitchPresenter.ContentTransitions>
|
||||
<TransitionCollection>
|
||||
<ContentThemeTransition/>
|
||||
</TransitionCollection>
|
||||
</cwuc:SwitchPresenter.ContentTransitions>
|
||||
<cwuc:Case Value="List">
|
||||
</cwc:SwitchPresenter.ContentTransitions>
|
||||
<cwc:Case Value="List">
|
||||
<SplitView
|
||||
Grid.Row="1"
|
||||
DisplayMode="Inline"
|
||||
@@ -268,8 +268,8 @@
|
||||
</ListView>
|
||||
</SplitView.Content>
|
||||
</SplitView>
|
||||
</cwuc:Case>
|
||||
<cwuc:Case Value="Grid">
|
||||
</cwc:Case>
|
||||
<cwc:Case Value="Grid">
|
||||
<GridView
|
||||
Padding="12,12,6,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
@@ -317,8 +317,8 @@
|
||||
</DataTemplate>
|
||||
</GridView.ItemTemplate>
|
||||
</GridView>
|
||||
</cwuc:Case>
|
||||
</cwuc:SwitchPresenter>
|
||||
</cwc:Case>
|
||||
</cwc:SwitchPresenter>
|
||||
</Grid>
|
||||
|
||||
<Grid Visibility="{Binding SelectedArchive, Converter={StaticResource EmptyObjectToVisibilityRevertConverter}}">
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
x:Class="Snap.Hutao.View.Page.AnnouncementPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cw="using:CommunityToolkit.WinUI"
|
||||
xmlns:cwa="using:CommunityToolkit.WinUI.Animations"
|
||||
xmlns:cwb="using:CommunityToolkit.WinUI.Behaviors"
|
||||
xmlns:cwu="using:CommunityToolkit.WinUI.UI"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
|
||||
@@ -48,8 +48,8 @@
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Image Layer -->
|
||||
<Border cwu:UIElementExtensions.ClipToBounds="True">
|
||||
<Border VerticalAlignment="Top" cwu:VisualExtensions.NormalizedCenterPoint="0.5">
|
||||
<Border cw:UIElementExtensions.ClipToBounds="True">
|
||||
<Border VerticalAlignment="Top" cw:VisualExtensions.NormalizedCenterPoint="0.5">
|
||||
<shci:CachedImage Source="{Binding Banner}" Stretch="UniformToFill"/>
|
||||
|
||||
<mxi:Interaction.Behaviors>
|
||||
|
||||
@@ -2,18 +2,16 @@
|
||||
x:Class="Snap.Hutao.View.Page.AvatarPropertyPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cw="using:CommunityToolkit.WinUI"
|
||||
xmlns:cwa="using:CommunityToolkit.WinUI.Animations"
|
||||
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:cwu="using:CommunityToolkit.WinUI.UI"
|
||||
xmlns:cwucont="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
xmlns:cwuconv="using:CommunityToolkit.WinUI.UI.Converters"
|
||||
xmlns:cwcont="using:CommunityToolkit.WinUI.Controls"
|
||||
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:mxi="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:shc="using:Snap.Hutao.Control"
|
||||
xmlns:shca="using:Snap.Hutao.Control.Alternating"
|
||||
xmlns:shcb="using:Snap.Hutao.Control.Behavior"
|
||||
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"
|
||||
@@ -46,14 +44,14 @@
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
|
||||
<cwuconv:BoolToObjectConverter x:Key="BoolToOpacityConverter">
|
||||
<cwuconv:BoolToObjectConverter.TrueValue>
|
||||
<cwconv:BoolToObjectConverter x:Key="BoolToOpacityConverter">
|
||||
<cwconv:BoolToObjectConverter.TrueValue>
|
||||
<x:Double>1</x:Double>
|
||||
</cwuconv:BoolToObjectConverter.TrueValue>
|
||||
<cwuconv:BoolToObjectConverter.FalseValue>
|
||||
</cwconv:BoolToObjectConverter.TrueValue>
|
||||
<cwconv:BoolToObjectConverter.FalseValue>
|
||||
<x:Double>0.5</x:Double>
|
||||
</cwuconv:BoolToObjectConverter.FalseValue>
|
||||
</cwuconv:BoolToObjectConverter>
|
||||
</cwconv:BoolToObjectConverter.FalseValue>
|
||||
</cwconv:BoolToObjectConverter>
|
||||
|
||||
<shvconv:PanelSelectorModeConverter
|
||||
x:Key="PanelSelectorModeConverter"
|
||||
@@ -112,13 +110,13 @@
|
||||
</AppBarButton>
|
||||
</CommandBar>
|
||||
|
||||
<cwucont:SwitchPresenter Grid.Row="1" Value="{Binding ElementName=ItemsPanelSelector, Path=Current, Mode=OneWay}">
|
||||
<cwucont:SwitchPresenter.ContentTransitions>
|
||||
<cwcont:SwitchPresenter Grid.Row="1" Value="{Binding ElementName=ItemsPanelSelector, Path=Current, Mode=OneWay}">
|
||||
<cwcont:SwitchPresenter.ContentTransitions>
|
||||
<TransitionCollection>
|
||||
<ContentThemeTransition/>
|
||||
</TransitionCollection>
|
||||
</cwucont:SwitchPresenter.ContentTransitions>
|
||||
<cwucont:Case Value="Grid">
|
||||
</cwcont:SwitchPresenter.ContentTransitions>
|
||||
<cwcont:Case Value="Grid">
|
||||
<ScrollViewer>
|
||||
<StackPanel x:Name="GridImageExportPanel" Background="Transparent">
|
||||
<GridView
|
||||
@@ -234,8 +232,8 @@
|
||||
</GridView>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</cwucont:Case>
|
||||
<cwucont:Case Value="List">
|
||||
</cwcont:Case>
|
||||
<cwcont:Case Value="List">
|
||||
<SplitView
|
||||
Grid.Row="1"
|
||||
DisplayMode="Inline"
|
||||
@@ -351,14 +349,14 @@
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<shvcont:ItemIcon Icon="{Binding SelectedAvatar.Icon}" Quality="{Binding SelectedAvatar.Quality}">
|
||||
<cwu:Effects.Shadow>
|
||||
<cwu:AttachedDropShadow
|
||||
<cw:Effects.Shadow>
|
||||
<cw:AttachedDropShadow
|
||||
BlurRadius="16"
|
||||
CastTo="{Binding ElementName=ShadowTarget}"
|
||||
IsMasked="False"
|
||||
Opacity="0.6"
|
||||
Offset="4"/>
|
||||
</cwu:Effects.Shadow>
|
||||
</cw:Effects.Shadow>
|
||||
</shvcont:ItemIcon>
|
||||
<StackPanel Grid.Column="1" Margin="16,0,0,0">
|
||||
<TextBlock
|
||||
@@ -403,14 +401,14 @@
|
||||
CornerRadius="{StaticResource CompatCornerRadius}">
|
||||
<Button.Content>
|
||||
<shvcont:ItemIcon Icon="{Binding Icon}" Quality="{Binding Quality}">
|
||||
<cwu:Effects.Shadow>
|
||||
<cwu:AttachedDropShadow
|
||||
<cw:Effects.Shadow>
|
||||
<cw:AttachedDropShadow
|
||||
BlurRadius="16"
|
||||
CastTo="{Binding ElementName=ShadowTarget}"
|
||||
IsMasked="False"
|
||||
Opacity="0.6"
|
||||
Offset="4"/>
|
||||
</cwu:Effects.Shadow>
|
||||
</cw:Effects.Shadow>
|
||||
</shvcont:ItemIcon>
|
||||
</Button.Content>
|
||||
<Button.Flyout>
|
||||
@@ -422,18 +420,18 @@
|
||||
<x:Double x:Key="SettingsCardWrapThreshold">0</x:Double>
|
||||
<x:Double x:Key="SettingsCardWrapNoIconThreshold">0</x:Double>
|
||||
</StackPanel.Resources>
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
Margin="0,2,0,0"
|
||||
Padding="12"
|
||||
Header="{Binding MainProperty.Name}">
|
||||
<TextBlock Text="{Binding MainProperty.Value}"/>
|
||||
</cwc:SettingsCard>
|
||||
<cwc:SettingsCard
|
||||
</cwcont:SettingsCard>
|
||||
<cwcont:SettingsCard
|
||||
Margin="0,2,0,0"
|
||||
Padding="12"
|
||||
Header="{Binding SubProperty.Name}">
|
||||
<TextBlock Text="{Binding SubProperty.Description}"/>
|
||||
</cwc:SettingsCard>
|
||||
</cwcont:SettingsCard>
|
||||
<shct:DescriptionTextBlock
|
||||
MaxWidth="320"
|
||||
Margin="0,12,0,0"
|
||||
@@ -587,12 +585,12 @@
|
||||
<ItemsControl Margin="0,12,0,0" ItemsSource="{Binding Info.Parameters}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
Margin="0,2,0,0"
|
||||
Padding="12,0"
|
||||
Header="{Binding Description}">
|
||||
<TextBlock Margin="0,8" Text="{Binding Parameter}"/>
|
||||
</cwc:SettingsCard>
|
||||
</cwcont:SettingsCard>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
@@ -721,7 +719,7 @@
|
||||
<ItemsControl Grid.Column="2" ItemsSource="{Binding ComposedSubProperties}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<cwucont:UniformGrid
|
||||
<cwcont:UniformGrid
|
||||
ColumnSpacing="16"
|
||||
Columns="2"
|
||||
RowSpacing="8"/>
|
||||
@@ -778,7 +776,7 @@
|
||||
<ItemsControl ItemsSource="{Binding PrimarySubProperties}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<cwucont:UniformGrid ColumnSpacing="8" Columns="5"/>
|
||||
<cwcont:UniformGrid ColumnSpacing="8" Columns="5"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
@@ -804,7 +802,7 @@
|
||||
<ItemsControl ItemsSource="{Binding SecondarySubProperties}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<cwucont:UniformGrid ColumnSpacing="8" Columns="5"/>
|
||||
<cwcont:UniformGrid ColumnSpacing="8" Columns="5"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
@@ -832,8 +830,8 @@
|
||||
</ScrollViewer>
|
||||
</SplitView.Content>
|
||||
</SplitView>
|
||||
</cwucont:Case>
|
||||
</cwucont:SwitchPresenter>
|
||||
</cwcont:Case>
|
||||
</cwcont:SwitchPresenter>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Visibility="{Binding Summary, Converter={StaticResource EmptyObjectToVisibilityRevertConverter}}">
|
||||
@@ -851,19 +849,19 @@
|
||||
Margin="0,24,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Spacing="{StaticResource SettingsCardSpacing}">
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
ActionIconToolTip="{shcm:ResourceString Name=ViewPageAvatarPropertyRefreshAction}"
|
||||
Command="{Binding RefreshFromEnkaApiCommand}"
|
||||
Description="{shcm:ResourceString Name=ViewPageAvatarPropertyRefreshFromEnkaApiDescription}"
|
||||
Header="{shcm:ResourceString Name=ViewPageAvatarPropertyRefreshFromEnkaApi}"
|
||||
IsClickEnabled="True"/>
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
ActionIconToolTip="{shcm:ResourceString Name=ViewPageAvatarPropertyRefreshAction}"
|
||||
Command="{Binding RefreshFromHoyolabGameRecordCommand}"
|
||||
Description="{shcm:ResourceString Name=ViewPageAvatarPropertyRefreshFromHoyolabGameRecordDescription}"
|
||||
Header="{shcm:ResourceString Name=ViewPageAvatarPropertyRefreshFromHoyolabGameRecord}"
|
||||
IsClickEnabled="True"/>
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
ActionIconToolTip="{shcm:ResourceString Name=ViewPageAvatarPropertyRefreshAction}"
|
||||
Command="{Binding RefreshFromHoyolabCalculateCommand}"
|
||||
Description="{shcm:ResourceString Name=ViewPageAvatarPropertyRefreshFromHoyolabCalculateDescription}"
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
x:Class="Snap.Hutao.View.Page.CultivationPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cwa="using:CommunityToolkit.WinUI.Animations"
|
||||
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:cwucont="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
xmlns:cwuconv="using:CommunityToolkit.WinUI.UI.Converters"
|
||||
xmlns:cwcont="using:CommunityToolkit.WinUI.Controls"
|
||||
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:mxi="using:Microsoft.Xaml.Interactivity"
|
||||
@@ -24,25 +22,25 @@
|
||||
<Page.Resources>
|
||||
<shc:BindingProxy x:Key="BindingProxy" DataContext="{Binding}"/>
|
||||
|
||||
<cwuconv:BoolToObjectConverter x:Key="BoolToOpacityConverter">
|
||||
<cwuconv:BoolToObjectConverter.TrueValue>
|
||||
<cwconv:BoolToObjectConverter x:Key="BoolToOpacityConverter">
|
||||
<cwconv:BoolToObjectConverter.TrueValue>
|
||||
<x:Double>0.4</x:Double>
|
||||
</cwuconv:BoolToObjectConverter.TrueValue>
|
||||
<cwuconv:BoolToObjectConverter.FalseValue>
|
||||
</cwconv:BoolToObjectConverter.TrueValue>
|
||||
<cwconv:BoolToObjectConverter.FalseValue>
|
||||
<x:Double>1</x:Double>
|
||||
</cwuconv:BoolToObjectConverter.FalseValue>
|
||||
</cwuconv:BoolToObjectConverter>
|
||||
</cwconv:BoolToObjectConverter.FalseValue>
|
||||
</cwconv:BoolToObjectConverter>
|
||||
|
||||
<cwuconv:BoolToObjectConverter
|
||||
<cwconv:BoolToObjectConverter
|
||||
x:Key="BoolToStyleSelector"
|
||||
FalseValue="{StaticResource BodyTextBlockStyle}"
|
||||
TrueValue="{StaticResource BaseTextBlockStyle}"/>
|
||||
|
||||
<cwuconv:BoolToObjectConverter x:Key="BoolToBrushSelector" FalseValue="{StaticResource ControlFillColorTransparentBrush}">
|
||||
<cwuconv:BoolToObjectConverter.TrueValue>
|
||||
<cwconv:BoolToObjectConverter x:Key="BoolToBrushSelector" FalseValue="{StaticResource ControlFillColorTransparentBrush}">
|
||||
<cwconv:BoolToObjectConverter.TrueValue>
|
||||
<SolidColorBrush Color="#20A5D610"/>
|
||||
</cwuconv:BoolToObjectConverter.TrueValue>
|
||||
</cwuconv:BoolToObjectConverter>
|
||||
</cwconv:BoolToObjectConverter.TrueValue>
|
||||
</cwconv:BoolToObjectConverter>
|
||||
</Page.Resources>
|
||||
|
||||
<mxi:Interaction.Behaviors>
|
||||
@@ -309,7 +307,7 @@
|
||||
<x:Double x:Key="SettingsCardWrapNoIconThreshold">0</x:Double>
|
||||
<x:Double x:Key="SettingsCardMinHeight">0</x:Double>
|
||||
</StackPanel.Resources>
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
ActionIconToolTip="{shcm:ResourceString Name=ViewPageCultivationNavigateAction}"
|
||||
Command="{Binding NavigateToPageCommand}"
|
||||
CommandParameter="Snap.Hutao.View.Page.WikiAvatarPage"
|
||||
@@ -317,7 +315,7 @@
|
||||
Header="{shcm:ResourceString Name=ViewWikiAvatarHeader}"
|
||||
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/WikiAvatar.png}"
|
||||
IsClickEnabled="True"/>
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
ActionIconToolTip="{shcm:ResourceString Name=ViewPageCultivationNavigateAction}"
|
||||
Command="{Binding NavigateToPageCommand}"
|
||||
CommandParameter="Snap.Hutao.View.Page.WikiWeaponPage"
|
||||
@@ -325,7 +323,7 @@
|
||||
Header="{shcm:ResourceString Name=ViewWikiWeaponHeader}"
|
||||
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/WikiWeapon.png}"
|
||||
IsClickEnabled="True"/>
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
ActionIconToolTip="{shcm:ResourceString Name=ViewPageCultivationNavigateAction}"
|
||||
Command="{Binding NavigateToPageCommand}"
|
||||
CommandParameter="Snap.Hutao.View.Page.AvatarPropertyPage"
|
||||
@@ -340,7 +338,7 @@
|
||||
<ScrollView HorizontalScrollBarVisibility="Hidden">
|
||||
<ItemsRepeater Margin="16" ItemsSource="{Binding InventoryItems}">
|
||||
<ItemsRepeater.Layout>
|
||||
<cwc:WrapLayout HorizontalSpacing="12" VerticalSpacing="12"/>
|
||||
<cwcont:WrapLayout HorizontalSpacing="12" VerticalSpacing="12"/>
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate>
|
||||
@@ -400,7 +398,7 @@
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||
Text="{shcm:ResourceString Name=ViewPageCultivationAddProjectContinue}"/>
|
||||
<StackPanel Margin="0,24,0,0" HorizontalAlignment="Center">
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
ActionIconToolTip="{shcm:ResourceString Name=ViewPageCultivationAddProjectAction}"
|
||||
Command="{Binding AddProjectCommand}"
|
||||
Description="{shcm:ResourceString Name=ViewPageCultivationAddProjectDescription}"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:cwuc="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
|
||||
@@ -483,7 +482,7 @@
|
||||
ItemsSource="{Binding DailyNote.Expeditions, Mode=OneWay}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<cwuc:UniformGrid
|
||||
<cwc:UniformGrid
|
||||
ColumnSpacing="8"
|
||||
Columns="2"
|
||||
RowSpacing="8"/>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:cwuc="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
|
||||
@@ -297,7 +296,7 @@
|
||||
<ItemsControl Grid.Column="1" ItemsSource="{Binding Rates}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<cwuc:UniformGrid Columns="7"/>
|
||||
<cwc:UniformGrid Columns="7"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:cwuc="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
|
||||
@@ -83,7 +82,7 @@
|
||||
<ItemsControl HorizontalAlignment="Left" ItemsSource="{Binding Reveals}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<cwuc:UniformGrid ColumnSpacing="16" Columns="4"/>
|
||||
<cwc:UniformGrid ColumnSpacing="16" Columns="4"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
x:Class="Snap.Hutao.View.Page.WikiAvatarPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cwuc="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
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:mxi="using:Microsoft.Xaml.Interactivity"
|
||||
@@ -99,13 +99,13 @@
|
||||
Icon="{shcm:FontIcon Glyph=}"
|
||||
Label="{shcm:ResourceString Name=ViewPageWiKiGeneralAddToDevPlanButtonLabel}"/>
|
||||
</CommandBar>
|
||||
<cwuc:SwitchPresenter Grid.Row="1" Value="{Binding ElementName=ItemsPanelSelector, Path=Current}">
|
||||
<cwuc:SwitchPresenter.ContentTransitions>
|
||||
<cwc:SwitchPresenter Grid.Row="1" Value="{Binding ElementName=ItemsPanelSelector, Path=Current}">
|
||||
<cwc:SwitchPresenter.ContentTransitions>
|
||||
<TransitionCollection>
|
||||
<ContentThemeTransition/>
|
||||
</TransitionCollection>
|
||||
</cwuc:SwitchPresenter.ContentTransitions>
|
||||
<cwuc:Case Value="List">
|
||||
</cwc:SwitchPresenter.ContentTransitions>
|
||||
<cwc:Case Value="List">
|
||||
<SplitView
|
||||
Grid.Row="1"
|
||||
DisplayMode="Inline"
|
||||
@@ -208,7 +208,7 @@
|
||||
Text="{Binding Selected.FetterInfo.Detail}"
|
||||
TextWrapping="NoWrap"/>
|
||||
|
||||
<cwuc:UniformGrid
|
||||
<cwc:UniformGrid
|
||||
Margin="0,12,0,0"
|
||||
ColumnSpacing="12"
|
||||
Columns="4">
|
||||
@@ -236,9 +236,9 @@
|
||||
Text="{Binding Selected.FetterInfo.BirthFormatted}"
|
||||
TextWrapping="NoWrap"/>
|
||||
</StackPanel>
|
||||
</cwuc:UniformGrid>
|
||||
</cwc:UniformGrid>
|
||||
|
||||
<cwuc:UniformGrid
|
||||
<cwc:UniformGrid
|
||||
Margin="0,12,0,0"
|
||||
ColumnSpacing="12"
|
||||
Columns="4">
|
||||
@@ -274,7 +274,7 @@
|
||||
Text="{Binding Selected.FetterInfo.CvKorean}"
|
||||
TextWrapping="NoWrap"/>
|
||||
</StackPanel>
|
||||
</cwuc:UniformGrid>
|
||||
</cwc:UniformGrid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<!-- 属性 -->
|
||||
@@ -366,11 +366,11 @@
|
||||
<GridView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<shvc:BottomTextControl Text="{Binding Rate}" ToolTipService.ToolTip="{Binding Name}">
|
||||
<cwuc:SwitchPresenter Value="{Binding Icons.Count, Mode=OneWay}">
|
||||
<cwuc:Case IsDefault="True">
|
||||
<cwuc:Case.Value>
|
||||
<cwc:SwitchPresenter Value="{Binding Icons.Count, Mode=OneWay}">
|
||||
<cwc:Case IsDefault="True">
|
||||
<cwc:Case.Value>
|
||||
<x:Int32>0</x:Int32>
|
||||
</cwuc:Case.Value>
|
||||
</cwc:Case.Value>
|
||||
<Grid>
|
||||
<shvc:ItemIcon
|
||||
Width="80"
|
||||
@@ -378,11 +378,11 @@
|
||||
Icon="{StaticResource UI_ItemIcon_None}"
|
||||
Quality="QUALITY_ORANGE"/>
|
||||
</Grid>
|
||||
</cwuc:Case>
|
||||
<cwuc:Case>
|
||||
<cwuc:Case.Value>
|
||||
</cwc:Case>
|
||||
<cwc:Case>
|
||||
<cwc:Case.Value>
|
||||
<x:Int32>1</x:Int32>
|
||||
</cwuc:Case.Value>
|
||||
</cwc:Case.Value>
|
||||
<Grid>
|
||||
<shvc:ItemIcon
|
||||
Width="80"
|
||||
@@ -390,11 +390,11 @@
|
||||
Icon="{Binding Icons[0]}"
|
||||
Quality="QUALITY_ORANGE"/>
|
||||
</Grid>
|
||||
</cwuc:Case>
|
||||
<cwuc:Case>
|
||||
<cwuc:Case.Value>
|
||||
</cwc:Case>
|
||||
<cwc:Case>
|
||||
<cwc:Case.Value>
|
||||
<x:Int32>2</x:Int32>
|
||||
</cwuc:Case.Value>
|
||||
</cwc:Case.Value>
|
||||
<Grid>
|
||||
<shvc:ItemIcon Quality="QUALITY_ORANGE"/>
|
||||
<shci:CachedImage
|
||||
@@ -410,8 +410,8 @@
|
||||
VerticalAlignment="Bottom"
|
||||
Source="{Binding Icons[1]}"/>
|
||||
</Grid>
|
||||
</cwuc:Case>
|
||||
</cwuc:SwitchPresenter>
|
||||
</cwc:Case>
|
||||
</cwc:SwitchPresenter>
|
||||
</shvc:BottomTextControl>
|
||||
</DataTemplate>
|
||||
</GridView.ItemTemplate>
|
||||
@@ -585,8 +585,8 @@
|
||||
</Grid>
|
||||
</SplitView.Content>
|
||||
</SplitView>
|
||||
</cwuc:Case>
|
||||
<cwuc:Case Value="Grid">
|
||||
</cwc:Case>
|
||||
<cwc:Case Value="Grid">
|
||||
<GridView
|
||||
Padding="12,12,2,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
@@ -606,8 +606,8 @@
|
||||
</DataTemplate>
|
||||
</GridView.ItemTemplate>
|
||||
</GridView>
|
||||
</cwuc:Case>
|
||||
</cwuc:SwitchPresenter>
|
||||
</cwc:Case>
|
||||
</cwc:SwitchPresenter>
|
||||
|
||||
</Grid>
|
||||
<shvc:LoadingView IsLoading="{Binding Avatars, Converter={StaticResource EmptyObjectToBoolRevertConverter}}"/>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
x:Class="Snap.Hutao.View.Page.WikiMonsterPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:clw="using:CommunityToolkit.Labs.WinUI"
|
||||
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:cwuc="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
|
||||
@@ -13,6 +13,7 @@
|
||||
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:shvc="using:Snap.Hutao.View.Control"
|
||||
xmlns:shvw="using:Snap.Hutao.ViewModel.Wiki"
|
||||
d:DataContext="{d:DesignInstance Type=shvw:WikiMonsterViewModel}"
|
||||
@@ -55,8 +56,8 @@
|
||||
</AppBarElementContainer>
|
||||
</CommandBar>
|
||||
|
||||
<cwuc:SwitchPresenter Grid.Row="1" Value="{Binding ElementName=ItemsPanelSelector, Path=Current}">
|
||||
<cwuc:Case Value="List">
|
||||
<cwc:SwitchPresenter Grid.Row="1" Value="{Binding ElementName=ItemsPanelSelector, Path=Current}">
|
||||
<cwc:Case Value="List">
|
||||
<SplitView
|
||||
DisplayMode="Inline"
|
||||
IsPaneOpen="True"
|
||||
@@ -88,7 +89,7 @@
|
||||
Grid.Column="1"
|
||||
Margin="12,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title}"/>
|
||||
Text="{Binding Name}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
@@ -108,18 +109,17 @@
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||
Text="{Binding Selected.Title}"/>
|
||||
<ItemsControl Margin="16,8,0,0" ItemsSource="{Binding Selected.Affixes}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<cwuc:WrapPanel HorizontalSpacing="8" Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}"/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<shct:DescriptionTextBlock
|
||||
Margin="16,16,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Description="{Binding Selected.Description}"
|
||||
Opacity="0.7"
|
||||
TextStyle="{StaticResource CaptionTextBlockStyle}"/>
|
||||
<clw:TokenView
|
||||
Margin="16,16,16,0"
|
||||
ItemsSource="{Binding Selected.Affixes}"
|
||||
SelectionMode="None"/>
|
||||
<shvc:BaseValueSlider
|
||||
Margin="16,16,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
@@ -134,7 +134,7 @@
|
||||
</ItemsControl.Resources>
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<cwuc:UniformGrid
|
||||
<cwc:UniformGrid
|
||||
ColumnSpacing="2"
|
||||
Columns="2"
|
||||
RowSpacing="2"/>
|
||||
@@ -172,8 +172,8 @@
|
||||
</ScrollViewer>
|
||||
</SplitView.Content>
|
||||
</SplitView>
|
||||
</cwuc:Case>
|
||||
<cwuc:Case Value="Grid">
|
||||
</cwc:Case>
|
||||
<cwc:Case Value="Grid">
|
||||
<GridView
|
||||
Padding="12,12,2,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
@@ -192,14 +192,14 @@
|
||||
</GridView.ItemsPanel>
|
||||
<GridView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<shvc:BottomTextControl Text="{Binding Title}">
|
||||
<shvc:BottomTextControl Text="{Binding Name}">
|
||||
<shvc:ItemIcon Icon="{Binding Icon, Converter={StaticResource MonsterIconConverter}, Mode=OneWay}" Quality="QUALITY_NONE"/>
|
||||
</shvc:BottomTextControl>
|
||||
</DataTemplate>
|
||||
</GridView.ItemTemplate>
|
||||
</GridView>
|
||||
</cwuc:Case>
|
||||
</cwuc:SwitchPresenter>
|
||||
</cwc:Case>
|
||||
</cwc:SwitchPresenter>
|
||||
|
||||
</Grid>
|
||||
<shvc:LoadingView IsLoading="{Binding Monsters, Converter={StaticResource EmptyObjectToBoolRevertConverter}}"/>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
x:Class="Snap.Hutao.View.Page.WikiWeaponPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cwuc="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
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:mxi="using:Microsoft.Xaml.Interactivity"
|
||||
@@ -69,13 +69,13 @@
|
||||
Icon="{shcm:FontIcon Glyph=}"
|
||||
Label="{shcm:ResourceString Name=ViewPageWiKiGeneralAddToDevPlanButtonLabel}"/>
|
||||
</CommandBar>
|
||||
<cwuc:SwitchPresenter Grid.Row="1" Value="{Binding ElementName=ItemsPanelSelector, Path=Current}">
|
||||
<cwuc:SwitchPresenter.ContentTransitions>
|
||||
<cwc:SwitchPresenter Grid.Row="1" Value="{Binding ElementName=ItemsPanelSelector, Path=Current}">
|
||||
<cwc:SwitchPresenter.ContentTransitions>
|
||||
<TransitionCollection>
|
||||
<ContentThemeTransition/>
|
||||
</TransitionCollection>
|
||||
</cwuc:SwitchPresenter.ContentTransitions>
|
||||
<cwuc:Case Value="List">
|
||||
</cwc:SwitchPresenter.ContentTransitions>
|
||||
<cwc:Case Value="List">
|
||||
<SplitView
|
||||
DisplayMode="Inline"
|
||||
IsPaneOpen="True"
|
||||
@@ -250,8 +250,8 @@
|
||||
</ScrollViewer>
|
||||
</SplitView.Content>
|
||||
</SplitView>
|
||||
</cwuc:Case>
|
||||
<cwuc:Case Value="Grid">
|
||||
</cwc:Case>
|
||||
<cwc:Case Value="Grid">
|
||||
<GridView
|
||||
Padding="12,12,2,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
@@ -271,8 +271,8 @@
|
||||
</DataTemplate>
|
||||
</GridView.ItemTemplate>
|
||||
</GridView>
|
||||
</cwuc:Case>
|
||||
</cwuc:SwitchPresenter>
|
||||
</cwc:Case>
|
||||
</cwc:SwitchPresenter>
|
||||
|
||||
</Grid>
|
||||
<shvc:LoadingView IsLoading="{Binding Weapons, Converter={StaticResource EmptyObjectToBoolRevertConverter}}"/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.UI;
|
||||
using CommunityToolkit.WinUI.Collections;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Snap.Hutao.Core.IO;
|
||||
using Snap.Hutao.Core.LifeCycle;
|
||||
@@ -185,6 +185,9 @@ internal sealed partial class AchievementViewModel : Abstraction.ViewModel, INav
|
||||
return false;
|
||||
}
|
||||
|
||||
[GeneratedRegex("\\d\\.\\d")]
|
||||
private static partial Regex VersionRegex();
|
||||
|
||||
[Command("AddArchiveCommand")]
|
||||
private async Task AddArchiveAsync()
|
||||
{
|
||||
@@ -319,7 +322,7 @@ internal sealed partial class AchievementViewModel : Abstraction.ViewModel, INav
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryGetAchievements(EntityAchievementArchive archive, List<MetadataAchievement> achievements, out List<AchievementView>? combined)
|
||||
private bool TryGetAchievements(EntityAchievementArchive archive, List<MetadataAchievement> achievements, [NotNullWhen(true)] out List<AchievementView>? combined)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -357,7 +360,7 @@ internal sealed partial class AchievementViewModel : Abstraction.ViewModel, INav
|
||||
{
|
||||
if (goal is null)
|
||||
{
|
||||
Achievements.Filter = null;
|
||||
Achievements.Filter = default!;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -413,7 +416,4 @@ internal sealed partial class AchievementViewModel : Abstraction.ViewModel, INav
|
||||
UpdateAchievementsFinishPercent();
|
||||
}
|
||||
}
|
||||
|
||||
[GeneratedRegex("\\d\\.\\d")]
|
||||
private static partial Regex VersionRegex();
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.UI;
|
||||
using CommunityToolkit.WinUI.Collections;
|
||||
using Snap.Hutao.Factory.Abstraction;
|
||||
using Snap.Hutao.Model.Calculable;
|
||||
using Snap.Hutao.Model.Entity.Primitive;
|
||||
@@ -220,7 +220,7 @@ internal sealed partial class WikiAvatarViewModel : Abstraction.ViewModel
|
||||
|
||||
Avatars.Filter = AvatarFilter.Compile(input);
|
||||
|
||||
if (Avatars.Contains(Selected))
|
||||
if (Selected is not null && Avatars.Contains(Selected))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.UI;
|
||||
using CommunityToolkit.WinUI.Collections;
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Metadata.Item;
|
||||
using Snap.Hutao.Model.Metadata.Monster;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.UI;
|
||||
using CommunityToolkit.WinUI.Collections;
|
||||
using Snap.Hutao.Factory.Abstraction;
|
||||
using Snap.Hutao.Model.Calculable;
|
||||
using Snap.Hutao.Model.Entity.Primitive;
|
||||
@@ -203,7 +203,7 @@ internal sealed partial class WikiWeaponViewModel : Abstraction.ViewModel
|
||||
|
||||
Weapons.Filter = WeaponFilter.Compile(input);
|
||||
|
||||
if (Weapons.Contains(Selected))
|
||||
if (Selected is not null && Weapons.Contains(Selected))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user