mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
Compare commits
1 Commits
fix/horizo
...
fix/layout
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
660d79ce9f |
@@ -35,8 +35,7 @@ Install with Snap Hutao MSIX package, can be installed with Windows built-in App
|
|||||||
|
|
||||||
* [向我们提交 PR / Make Pull Requests](https://github.com/DGP-Studio/Snap.Hutao/pulls)
|
* [向我们提交 PR / Make Pull Requests](https://github.com/DGP-Studio/Snap.Hutao/pulls)
|
||||||
* [在 Crowdin 上进行本地化 / Translate Project on Crowdin](https://translate.hut.ao/)
|
* [在 Crowdin 上进行本地化 / Translate Project on Crowdin](https://translate.hut.ao/)
|
||||||
* [为我们更新文档 / Enhance our Document](https://github.com/DGP-Studio/Snap.Hutao.Docs)
|
* [为我们更新文档 / Enhance our Document ](https://github.com/DGP-Studio/Snap.Hutao.Docs)
|
||||||
* [帮助我们测试程序 / Test Binary Package](https://hut.ao/development/contribute.html)
|
|
||||||
|
|
||||||
## 特别感谢 / Special Thanks
|
## 特别感谢 / Special Thanks
|
||||||
|
|
||||||
|
|||||||
24
build.cake
24
build.cake
@@ -69,15 +69,6 @@ else if (AppVeyor.IsRunningOnAppVeyor)
|
|||||||
})[..^2];
|
})[..^2];
|
||||||
Information($"Version: {version}");
|
Information($"Version: {version}");
|
||||||
}
|
}
|
||||||
else // Local
|
|
||||||
{
|
|
||||||
repoDir = System.Environment.CurrentDirectory;
|
|
||||||
outputPath = System.IO.Path.Combine(repoDir, "src", "output");
|
|
||||||
|
|
||||||
version = System.DateTime.Now.ToString("yyyy.M.d.") + ((int)((System.DateTime.Now - System.DateTime.Today).TotalSeconds / 86400 * 65535)).ToString();
|
|
||||||
|
|
||||||
Information($"Version: {version}");
|
|
||||||
}
|
|
||||||
|
|
||||||
Task("Build")
|
Task("Build")
|
||||||
.IsDependentOn("Build binary package")
|
.IsDependentOn("Build binary package")
|
||||||
@@ -121,17 +112,6 @@ Task("Generate AppxManifest")
|
|||||||
Information("Using Release configuration");
|
Information("Using Release configuration");
|
||||||
content = System.Text.RegularExpressions.Regex.Replace(content, " Publisher=\"([^\"]*)\"", " Publisher=\"CN=SignPath Foundation, O=SignPath Foundation, L=Lewes, S=Delaware, C=US\"");
|
content = System.Text.RegularExpressions.Regex.Replace(content, " Publisher=\"([^\"]*)\"", " Publisher=\"CN=SignPath Foundation, O=SignPath Foundation, L=Lewes, S=Delaware, C=US\"");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Information("Using Local configuration.");
|
|
||||||
content = content
|
|
||||||
.Replace("Snap Hutao", "Snap Hutao Local")
|
|
||||||
.Replace("胡桃", "胡桃 Local")
|
|
||||||
.Replace("DGP Studio", "DGP Studio CI");
|
|
||||||
content = System.Text.RegularExpressions.Regex.Replace(content, " Name=\"([^\"]*)\"", " Name=\"E8B6E2B3-D2A0-4435-A81D-2A16AAF405C7\"");
|
|
||||||
content = System.Text.RegularExpressions.Regex.Replace(content, " Publisher=\"([^\"]*)\"", " Publisher=\"E=admin@dgp-studio.cn, CN=DGP Studio CI, OU=CI, O=DGP-Studio, L=San Jose, S=CA, C=US\"");
|
|
||||||
content = System.Text.RegularExpressions.Regex.Replace(content, " Version=\"([0-9\\.]+)\"", $" Version=\"{version}\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
System.IO.File.WriteAllText(manifest, content);
|
System.IO.File.WriteAllText(manifest, content);
|
||||||
|
|
||||||
@@ -193,10 +173,6 @@ Task("Build MSIX")
|
|||||||
{
|
{
|
||||||
arguments = "pack /d " + binPath + " /p " + System.IO.Path.Combine(outputPath, $"Snap.Hutao-{version}.msix");
|
arguments = "pack /d " + binPath + " /p " + System.IO.Path.Combine(outputPath, $"Snap.Hutao-{version}.msix");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
arguments = "pack /d " + binPath + " /p " + System.IO.Path.Combine(outputPath, $"Snap.Hutao.Local-{version}.msix");
|
|
||||||
}
|
|
||||||
var p = StartProcess(
|
var p = StartProcess(
|
||||||
"makeappx.exe",
|
"makeappx.exe",
|
||||||
new ProcessSettings
|
new ProcessSettings
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
<ResourceDictionary Source="ms-appx:///CommunityToolkit.WinUI.Controls.TokenizingTextBox/TokenizingTextBox.xaml"/>
|
<ResourceDictionary Source="ms-appx:///CommunityToolkit.WinUI.Controls.TokenizingTextBox/TokenizingTextBox.xaml"/>
|
||||||
<ResourceDictionary Source="ms-appx:///Control/Loading.xaml"/>
|
<ResourceDictionary Source="ms-appx:///Control/Loading.xaml"/>
|
||||||
<ResourceDictionary Source="ms-appx:///Control/Image/CachedImage.xaml"/>
|
<ResourceDictionary Source="ms-appx:///Control/Image/CachedImage.xaml"/>
|
||||||
|
<ResourceDictionary Source="ms-appx:///Control/Segmented/Segmented.xaml"/>
|
||||||
|
<ResourceDictionary Source="ms-appx:///Control/Segmented/SegmentedItem.xaml"/>
|
||||||
<ResourceDictionary Source="ms-appx:///Control/Theme/Card.xaml"/>
|
<ResourceDictionary Source="ms-appx:///Control/Theme/Card.xaml"/>
|
||||||
<ResourceDictionary Source="ms-appx:///Control/Theme/Color.xaml"/>
|
<ResourceDictionary Source="ms-appx:///Control/Theme/Color.xaml"/>
|
||||||
<ResourceDictionary Source="ms-appx:///Control/Theme/ComboBox.xaml"/>
|
<ResourceDictionary Source="ms-appx:///Control/Theme/ComboBox.xaml"/>
|
||||||
@@ -23,7 +25,6 @@
|
|||||||
<ResourceDictionary Source="ms-appx:///Control/Theme/PageOverride.xaml"/>
|
<ResourceDictionary Source="ms-appx:///Control/Theme/PageOverride.xaml"/>
|
||||||
<ResourceDictionary Source="ms-appx:///Control/Theme/PivotOverride.xaml"/>
|
<ResourceDictionary Source="ms-appx:///Control/Theme/PivotOverride.xaml"/>
|
||||||
<ResourceDictionary Source="ms-appx:///Control/Theme/ScrollViewer.xaml"/>
|
<ResourceDictionary Source="ms-appx:///Control/Theme/ScrollViewer.xaml"/>
|
||||||
<ResourceDictionary Source="ms-appx:///Control/Theme/SegmentedOverride.xaml"/>
|
|
||||||
<ResourceDictionary Source="ms-appx:///Control/Theme/SettingsStyle.xaml"/>
|
<ResourceDictionary Source="ms-appx:///Control/Theme/SettingsStyle.xaml"/>
|
||||||
<ResourceDictionary Source="ms-appx:///Control/Theme/Thickness.xaml"/>
|
<ResourceDictionary Source="ms-appx:///Control/Theme/Thickness.xaml"/>
|
||||||
<ResourceDictionary Source="ms-appx:///Control/Theme/TransitionCollection.xaml"/>
|
<ResourceDictionary Source="ms-appx:///Control/Theme/TransitionCollection.xaml"/>
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using CommunityToolkit.WinUI;
|
||||||
using CommunityToolkit.WinUI.Controls;
|
using CommunityToolkit.WinUI.Controls;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||||
using Snap.Hutao.Control.Extension;
|
using Snap.Hutao.Control.Extension;
|
||||||
|
|
||||||
namespace Snap.Hutao.Control.AutoSuggestBox;
|
namespace Snap.Hutao.Control.AutoSuggestBox;
|
||||||
|
|||||||
@@ -168,7 +168,6 @@ internal abstract partial class CompositionImage : Microsoft.UI.Xaml.Controls.Co
|
|||||||
if (surface.DecodedPhysicalSize.Size() <= 0D)
|
if (surface.DecodedPhysicalSize.Size() <= 0D)
|
||||||
{
|
{
|
||||||
await Task.WhenAny(surfaceLoadTaskCompletionSource.Task, Task.Delay(5000, token)).ConfigureAwait(true);
|
await Task.WhenAny(surfaceLoadTaskCompletionSource.Task, Task.Delay(5000, token)).ConfigureAwait(true);
|
||||||
await Task.Delay(50, token).ConfigureAwait(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadImageSurfaceCompleted(surface);
|
LoadImageSurfaceCompleted(surface);
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Microsoft.UI.Xaml;
|
|
||||||
using Windows.Foundation;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Control.Panel;
|
|
||||||
|
|
||||||
[DependencyProperty("MinItemWidth", typeof(double))]
|
|
||||||
[DependencyProperty("Spacing", typeof(double))]
|
|
||||||
internal partial class HorizontalEqualPanel : Microsoft.UI.Xaml.Controls.Panel
|
|
||||||
{
|
|
||||||
public HorizontalEqualPanel()
|
|
||||||
{
|
|
||||||
Loaded += OnLoaded;
|
|
||||||
SizeChanged += OnSizeChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Size MeasureOverride(Size availableSize)
|
|
||||||
{
|
|
||||||
foreach (UIElement child in Children)
|
|
||||||
{
|
|
||||||
// ScrollViewer will always return an Infinity Size, we should use ActualWidth for this situation.
|
|
||||||
double availableWidth = double.IsInfinity(availableSize.Width)
|
|
||||||
? ActualWidth
|
|
||||||
: availableSize.Width;
|
|
||||||
|
|
||||||
double childAvailableWidth = (availableWidth + Spacing) / Children.Count;
|
|
||||||
double childMaxAvailableWidth = Math.Max(MinItemWidth, childAvailableWidth);
|
|
||||||
child.Measure(new(childMaxAvailableWidth, availableSize.Height));
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.MeasureOverride(availableSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Size ArrangeOverride(Size finalSize)
|
|
||||||
{
|
|
||||||
int itemCount = Children.Count;
|
|
||||||
|
|
||||||
// 计算总间距
|
|
||||||
double totalSpacing = Spacing * (itemCount - 1);
|
|
||||||
|
|
||||||
// 添加间距后的总宽度
|
|
||||||
double totalWidthWithSpacing = finalSize.Width - totalSpacing;
|
|
||||||
|
|
||||||
// 计算每个子元素可用的宽度(考虑间距)
|
|
||||||
double availableWidthPerItem = (totalWidthWithSpacing - totalSpacing) / itemCount;
|
|
||||||
|
|
||||||
// 实际子元素宽度为最小宽度和可用宽度的较大值
|
|
||||||
double actualItemWidth = Math.Max(MinItemWidth, availableWidthPerItem);
|
|
||||||
|
|
||||||
double x = 0;
|
|
||||||
|
|
||||||
// 设置子元素的位置和大小
|
|
||||||
foreach (UIElement child in Children)
|
|
||||||
{
|
|
||||||
child.Arrange(new Rect(x, 0, actualItemWidth, finalSize.Height));
|
|
||||||
x += actualItemWidth + Spacing;
|
|
||||||
}
|
|
||||||
|
|
||||||
return finalSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
MinWidth = (MinItemWidth * Children.Count) + (Spacing * (Children.Count - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnSizeChanged(object sender, SizeChangedEventArgs e)
|
|
||||||
{
|
|
||||||
InvalidateMeasure();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
<cwc:Segmented
|
<shcs:Segmented
|
||||||
x:Class="Snap.Hutao.Control.Panel.PanelSelector"
|
x:Class="Snap.Hutao.Control.Panel.PanelSelector"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||||
|
xmlns:shcs="using:Snap.Hutao.Control.Segmented"
|
||||||
Style="{StaticResource DefaultSegmentedStyle}"
|
Style="{StaticResource DefaultSegmentedStyle}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<cwc:SegmentedItem
|
<shcs:SegmentedItem
|
||||||
Icon="{shcm:FontIcon Glyph={StaticResource FontIconContentBulletedList}}"
|
Icon="{shcm:FontIcon Glyph={StaticResource FontIconContentBulletedList}}"
|
||||||
Tag="List"
|
Tag="List"
|
||||||
ToolTipService.ToolTip="{shcm:ResourceString Name=ControlPanelPanelSelectorDropdownListName}"/>
|
ToolTipService.ToolTip="{shcm:ResourceString Name=ControlPanelPanelSelectorDropdownListName}"/>
|
||||||
<cwc:SegmentedItem
|
<shcs:SegmentedItem
|
||||||
Icon="{shcm:FontIcon Glyph={StaticResource FontIconContentGridView}}"
|
Icon="{shcm:FontIcon Glyph={StaticResource FontIconContentGridView}}"
|
||||||
Tag="Grid"
|
Tag="Grid"
|
||||||
ToolTipService.ToolTip="{shcm:ResourceString Name=ControlPanelPanelSelectorDropdownGridName}"/>
|
ToolTipService.ToolTip="{shcm:ResourceString Name=ControlPanelPanelSelectorDropdownGridName}"/>
|
||||||
|
|
||||||
</cwc:Segmented>
|
</shcs:Segmented>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using CommunityToolkit.WinUI.Controls;
|
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
|
using Snap.Hutao.Control.Segmented;
|
||||||
using Snap.Hutao.Core.Setting;
|
using Snap.Hutao.Core.Setting;
|
||||||
using System.Collections.Frozen;
|
using System.Collections.Frozen;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ namespace Snap.Hutao.Control.Panel;
|
|||||||
[DependencyProperty("Current", typeof(string), List)]
|
[DependencyProperty("Current", typeof(string), List)]
|
||||||
[DependencyProperty("LocalSettingKeySuffixForCurrent", typeof(string))]
|
[DependencyProperty("LocalSettingKeySuffixForCurrent", typeof(string))]
|
||||||
[DependencyProperty("LocalSettingKeyExtraForCurrent", typeof(string), "")]
|
[DependencyProperty("LocalSettingKeyExtraForCurrent", typeof(string), "")]
|
||||||
internal sealed partial class PanelSelector : Segmented
|
internal sealed partial class PanelSelector : Segmented.Segmented
|
||||||
{
|
{
|
||||||
public const string List = nameof(List);
|
public const string List = nameof(List);
|
||||||
public const string Grid = nameof(Grid);
|
public const string Grid = nameof(Grid);
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
|
|
||||||
namespace Snap.Hutao.Control.Panel;
|
namespace Snap.Hutao.Control.Segmented;
|
||||||
|
|
||||||
[DependencyProperty("Spacing", typeof(double), default(double), nameof(OnSpacingChanged))]
|
[DependencyProperty("Spacing", typeof(double), default(double), nameof(OnSpacingChanged))]
|
||||||
internal partial class EqualPanel : Microsoft.UI.Xaml.Controls.Panel
|
internal partial class EqualPanel : Microsoft.UI.Xaml.Controls.Panel
|
||||||
@@ -25,10 +24,10 @@ internal partial class EqualPanel : Microsoft.UI.Xaml.Controls.Panel
|
|||||||
maxItemWidth = 0;
|
maxItemWidth = 0;
|
||||||
maxItemHeight = 0;
|
maxItemHeight = 0;
|
||||||
|
|
||||||
List<UIElement> elements = [.. Children.Where(element => element.Visibility == Visibility.Visible)];
|
IEnumerable<UIElement> elements = Children.Where(static e => e.Visibility == Visibility.Visible);
|
||||||
visibleItemsCount = elements.Count;
|
visibleItemsCount = elements.Count();
|
||||||
|
|
||||||
foreach (ref readonly UIElement child in CollectionsMarshal.AsSpan(elements))
|
foreach (UIElement child in elements)
|
||||||
{
|
{
|
||||||
child.Measure(availableSize);
|
child.Measure(availableSize);
|
||||||
maxItemWidth = Math.Max(maxItemWidth, child.DesiredSize.Width);
|
maxItemWidth = Math.Max(maxItemWidth, child.DesiredSize.Width);
|
||||||
@@ -39,7 +38,7 @@ internal partial class EqualPanel : Microsoft.UI.Xaml.Controls.Panel
|
|||||||
{
|
{
|
||||||
// Return equal widths based on the widest item
|
// Return equal widths based on the widest item
|
||||||
// In very specific edge cases the AvailableWidth might be infinite resulting in a crash.
|
// In very specific edge cases the AvailableWidth might be infinite resulting in a crash.
|
||||||
if (HorizontalAlignment is not HorizontalAlignment.Stretch || double.IsInfinity(availableSize.Width))
|
if (HorizontalAlignment != HorizontalAlignment.Stretch || double.IsInfinity(availableSize.Width))
|
||||||
{
|
{
|
||||||
return new Size((maxItemWidth * visibleItemsCount) + (Spacing * (visibleItemsCount - 1)), maxItemHeight);
|
return new Size((maxItemWidth * visibleItemsCount) + (Spacing * (visibleItemsCount - 1)), maxItemHeight);
|
||||||
}
|
}
|
||||||
@@ -79,11 +78,12 @@ internal partial class EqualPanel : Microsoft.UI.Xaml.Controls.Panel
|
|||||||
|
|
||||||
private static void OnSpacingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
private static void OnSpacingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
(d as EqualPanel)?.InvalidateMeasure();
|
EqualPanel panel = (EqualPanel)d;
|
||||||
|
panel.InvalidateMeasure();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnHorizontalAlignmentChanged(DependencyObject sender, DependencyProperty dp)
|
private void OnHorizontalAlignmentChanged(DependencyObject sender, DependencyProperty dp)
|
||||||
{
|
{
|
||||||
InvalidateMeasure();
|
InvalidateMeasure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
127
src/Snap.Hutao/Snap.Hutao/Control/Segmented/Segmented.cs
Normal file
127
src/Snap.Hutao/Snap.Hutao/Control/Segmented/Segmented.cs
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Microsoft.UI.Xaml.Input;
|
||||||
|
using Windows.System;
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Control.Segmented;
|
||||||
|
|
||||||
|
internal partial class Segmented : ListViewBase
|
||||||
|
{
|
||||||
|
private int correctSelectedIndex = -1;
|
||||||
|
|
||||||
|
public Segmented()
|
||||||
|
{
|
||||||
|
DefaultStyleKey = typeof(Segmented);
|
||||||
|
|
||||||
|
RegisterPropertyChangedCallback(SelectedIndexProperty, OnSelectedIndexChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override DependencyObject GetContainerForItemOverride() => new SegmentedItem();
|
||||||
|
|
||||||
|
protected override bool IsItemItsOwnContainerOverride(object item)
|
||||||
|
{
|
||||||
|
return item is SegmentedItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnApplyTemplate()
|
||||||
|
{
|
||||||
|
base.OnApplyTemplate();
|
||||||
|
if (!IsLoaded)
|
||||||
|
{
|
||||||
|
SelectedIndex = correctSelectedIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
PreviewKeyDown -= OnPreviewKeyDown;
|
||||||
|
PreviewKeyDown += OnPreviewKeyDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
|
||||||
|
{
|
||||||
|
base.PrepareContainerForItemOverride(element, item);
|
||||||
|
if (element is SegmentedItem segmentedItem)
|
||||||
|
{
|
||||||
|
segmentedItem.Loaded += OnLoaded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnItemsChanged(object e)
|
||||||
|
{
|
||||||
|
base.OnItemsChanged(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnPreviewKeyDown(object sender, KeyRoutedEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.Key)
|
||||||
|
{
|
||||||
|
case VirtualKey.Left:
|
||||||
|
e.Handled = MoveFocus(true);
|
||||||
|
break;
|
||||||
|
case VirtualKey.Right:
|
||||||
|
e.Handled = MoveFocus(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is SegmentedItem segmentedItem)
|
||||||
|
{
|
||||||
|
segmentedItem.Loaded -= OnLoaded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool MoveFocus(bool reverse)
|
||||||
|
{
|
||||||
|
SegmentedItem? currentContainerItem = GetCurrentContainerItem();
|
||||||
|
|
||||||
|
if (currentContainerItem is null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int previousIndex = Items.IndexOf(ItemFromContainer(currentContainerItem));
|
||||||
|
|
||||||
|
if (reverse)
|
||||||
|
{
|
||||||
|
if (previousIndex > 0 && ContainerFromIndex(previousIndex - 1) is SegmentedItem newItem)
|
||||||
|
{
|
||||||
|
newItem.Focus(FocusState.Keyboard);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (previousIndex < Items.Count - 1 && ContainerFromIndex(previousIndex + 1) is SegmentedItem newItem)
|
||||||
|
{
|
||||||
|
newItem.Focus(FocusState.Keyboard);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SegmentedItem? GetCurrentContainerItem()
|
||||||
|
{
|
||||||
|
if (XamlRoot is not null)
|
||||||
|
{
|
||||||
|
return (SegmentedItem)FocusManager.GetFocusedElement(XamlRoot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (SegmentedItem)FocusManager.GetFocusedElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSelectedIndexChanged(DependencyObject sender, DependencyProperty dp)
|
||||||
|
{
|
||||||
|
// https://github.com/microsoft/microsoft-ui-xaml/issues/8257
|
||||||
|
if (correctSelectedIndex == -1 && SelectedIndex > -1)
|
||||||
|
{
|
||||||
|
correctSelectedIndex = SelectedIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
<ResourceDictionary
|
<ResourceDictionary
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:cw="using:CommunityToolkit.WinUI"
|
xmlns:cw="using:CommunityToolkit.WinUI"
|
||||||
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
|
xmlns:shcs="using:Snap.Hutao.Control.Segmented"
|
||||||
xmlns:shcp="using:Snap.Hutao.Control.Panel"
|
|
||||||
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="ms-appx:///CommunityToolkit.WinUI.Controls.Segmented/SegmentedItem/SegmentedItem.xaml"/>
|
<ResourceDictionary Source="ms-appx:///Control/Segmented/SegmentedItem.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary.ThemeDictionaries>
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
<ResourceDictionary x:Key="Default">
|
<ResourceDictionary x:Key="Default">
|
||||||
@@ -30,9 +29,9 @@
|
|||||||
<x:Double x:Key="SegmentedItemSpacing">1</x:Double>
|
<x:Double x:Key="SegmentedItemSpacing">1</x:Double>
|
||||||
<x:Double x:Key="ButtonItemSpacing">2</x:Double>
|
<x:Double x:Key="ButtonItemSpacing">2</x:Double>
|
||||||
|
|
||||||
<Style BasedOn="{StaticResource DefaultSegmentedStyle}" TargetType="cwc:Segmented"/>
|
<Style BasedOn="{StaticResource DefaultSegmentedStyle}" TargetType="shcs:Segmented"/>
|
||||||
|
|
||||||
<Style x:Key="DefaultSegmentedStyle" TargetType="cwc:Segmented">
|
<Style x:Key="DefaultSegmentedStyle" TargetType="shcs:Segmented">
|
||||||
<Style.Setters>
|
<Style.Setters>
|
||||||
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}"/>
|
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}"/>
|
||||||
<Setter Property="Background" Value="{ThemeResource SegmentedBackground}"/>
|
<Setter Property="Background" Value="{ThemeResource SegmentedBackground}"/>
|
||||||
@@ -48,16 +47,16 @@
|
|||||||
<Setter Property="ItemsPanel">
|
<Setter Property="ItemsPanel">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<shcp:EqualPanel
|
<shcs:EqualPanel
|
||||||
HorizontalAlignment="{Binding (cw:FrameworkElementExtensions.Ancestor).HorizontalAlignment, RelativeSource={RelativeSource Self}}"
|
HorizontalAlignment="{Binding (cw:FrameworkElementExtensions.Ancestor).HorizontalAlignment, RelativeSource={RelativeSource Self}}"
|
||||||
cw:FrameworkElementExtensions.AncestorType="cwc:Segmented"
|
cw:FrameworkElementExtensions.AncestorType="shcs:Segmented"
|
||||||
Spacing="{ThemeResource SegmentedItemSpacing}"/>
|
Spacing="{ThemeResource SegmentedItemSpacing}"/>
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="cwc:Segmented">
|
<ControlTemplate TargetType="shcs:Segmented">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Border
|
<Border
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
@@ -76,7 +75,7 @@
|
|||||||
<Style
|
<Style
|
||||||
x:Key="PivotSegmentedStyle"
|
x:Key="PivotSegmentedStyle"
|
||||||
BasedOn="{StaticResource DefaultSegmentedStyle}"
|
BasedOn="{StaticResource DefaultSegmentedStyle}"
|
||||||
TargetType="cwc:Segmented">
|
TargetType="shcs:Segmented">
|
||||||
<Style.Setters>
|
<Style.Setters>
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||||
@@ -96,7 +95,7 @@
|
|||||||
<Style
|
<Style
|
||||||
x:Key="ButtonSegmentedStyle"
|
x:Key="ButtonSegmentedStyle"
|
||||||
BasedOn="{StaticResource DefaultSegmentedStyle}"
|
BasedOn="{StaticResource DefaultSegmentedStyle}"
|
||||||
TargetType="cwc:Segmented">
|
TargetType="shcs:Segmented">
|
||||||
<Style.Setters>
|
<Style.Setters>
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||||
@@ -112,4 +111,4 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
</Style.Setters>
|
</Style.Setters>
|
||||||
</Style>
|
</Style>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
62
src/Snap.Hutao/Snap.Hutao/Control/Segmented/SegmentedItem.cs
Normal file
62
src/Snap.Hutao/Snap.Hutao/Control/Segmented/SegmentedItem.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Control.Segmented;
|
||||||
|
|
||||||
|
[DependencyProperty("Icon", typeof(IconElement), null, nameof(OnIconPropertyChanged))]
|
||||||
|
internal partial class SegmentedItem : ListViewItem
|
||||||
|
{
|
||||||
|
private const string IconLeftState = "IconLeft";
|
||||||
|
private const string IconOnlyState = "IconOnly";
|
||||||
|
private const string ContentOnlyState = "ContentOnly";
|
||||||
|
|
||||||
|
public SegmentedItem()
|
||||||
|
{
|
||||||
|
DefaultStyleKey = typeof(SegmentedItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnApplyTemplate()
|
||||||
|
{
|
||||||
|
base.OnApplyTemplate();
|
||||||
|
OnIconChanged();
|
||||||
|
ContentChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnContentChanged(object oldContent, object newContent)
|
||||||
|
{
|
||||||
|
base.OnContentChanged(oldContent, newContent);
|
||||||
|
ContentChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnIconPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
((SegmentedItem)d).OnIconChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ContentChanged()
|
||||||
|
{
|
||||||
|
if (Content is not null)
|
||||||
|
{
|
||||||
|
VisualStateManager.GoToState(this, IconLeftState, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VisualStateManager.GoToState(this, IconOnlyState, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnIconChanged()
|
||||||
|
{
|
||||||
|
if (Icon is not null)
|
||||||
|
{
|
||||||
|
VisualStateManager.GoToState(this, IconLeftState, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VisualStateManager.GoToState(this, ContentOnlyState, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
875
src/Snap.Hutao/Snap.Hutao/Control/Segmented/SegmentedItem.xaml
Normal file
875
src/Snap.Hutao/Snap.Hutao/Control/Segmented/SegmentedItem.xaml
Normal file
@@ -0,0 +1,875 @@
|
|||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:shcs="using:Snap.Hutao.Control.Segmented"
|
||||||
|
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
|
||||||
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
|
<ResourceDictionary x:Key="Default">
|
||||||
|
<!-- Background -->
|
||||||
|
<StaticResource x:Key="SegmentedItemBackground" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBackgroundPointerOver" ResourceKey="SubtleFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBackgroundSelected" ResourceKey="ControlFillColorDefaultBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBackgroundPressed" ResourceKey="SubtleFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBackgroundDisabled" ResourceKey="ControlFillColorDisabledBrush"/>
|
||||||
|
|
||||||
|
<!-- BorderBrush -->
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrush" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrushPointerOver" ResourceKey="SubtleFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrushSelected" ResourceKey="ControlElevationBorderBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrushPressed" ResourceKey="SubtleFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrushDisabled" ResourceKey="ControlAltFillColorSecondaryBrush"/>
|
||||||
|
<!-- Foreground -->
|
||||||
|
<StaticResource x:Key="SegmentedItemForeground" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemForegroundSelected" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemForegroundPressed" ResourceKey="TextFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemForegroundDisabled" ResourceKey="TextFillColorDisabledBrush"/>
|
||||||
|
|
||||||
|
<!-- Pill -->
|
||||||
|
<StaticResource x:Key="SegmentedPillBackground" ResourceKey="AccentFillColorDefaultBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedPillBackgroundPointerOver" ResourceKey="AccentFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedPillBackgroundPressed" ResourceKey="AccentFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedPillBackgroundDisabled" ResourceKey="AccentFillColorDisabledBrush"/>
|
||||||
|
|
||||||
|
<Thickness x:Key="SegmentedItemBorderThickness">1</Thickness>
|
||||||
|
<x:Double x:Key="SegmentedItemDisabledOpacity">0.55</x:Double>
|
||||||
|
|
||||||
|
<!-- PillSegmentedStyle -->
|
||||||
|
<!-- Background -->
|
||||||
|
<StaticResource x:Key="PivotItemBackground" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemBackgroundPointerOver" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemBackgroundSelected" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemBackgroundPressed" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemBackgroundDisabled" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
|
||||||
|
<!-- Foreground -->
|
||||||
|
<StaticResource x:Key="PivotItemForeground" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemForegroundPointerOver" ResourceKey="TextFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemForegroundPressed" ResourceKey="TextFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemForegroundSelected" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemForegroundDisabled" ResourceKey="TextFillColorDisabledBrush"/>
|
||||||
|
|
||||||
|
<!-- Pill -->
|
||||||
|
<StaticResource x:Key="PivotItemPillBackground" ResourceKey="AccentFillColorDefaultBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemPillBackgroundPointerOver" ResourceKey="AccentFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemPillBackgroundPressed" ResourceKey="AccentFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemPillBackgroundDisabled" ResourceKey="AccentFillColorDefaultBrush"/>
|
||||||
|
|
||||||
|
<!-- ButtonSegmentedStyle -->
|
||||||
|
<!-- Background -->
|
||||||
|
<StaticResource x:Key="ButtonItemBackground" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundPointerOver" ResourceKey="SubtleFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundPressed" ResourceKey="SubtleFillColorTertiary"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundSelected" ResourceKey="AccentFillColorDefaultBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundSelectedPointerOver" ResourceKey="AccentFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundSelectedPressed" ResourceKey="AccentFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundDisabled" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
|
||||||
|
<!-- Foreground -->
|
||||||
|
<StaticResource x:Key="ButtonItemForeground" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundPressed" ResourceKey="TextFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundSelected" ResourceKey="TextOnAccentFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundSelectedPointerOver" ResourceKey="TextOnAccentFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundSelectedPressed" ResourceKey="TextOnAccentFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundDisabled" ResourceKey="TextFillColorDisabledBrush"/>
|
||||||
|
</ResourceDictionary>
|
||||||
|
<ResourceDictionary x:Key="Light">
|
||||||
|
<!-- Background -->
|
||||||
|
<StaticResource x:Key="SegmentedItemBackground" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBackgroundPointerOver" ResourceKey="SubtleFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBackgroundSelected" ResourceKey="ControlFillColorDefaultBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBackgroundPressed" ResourceKey="SubtleFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBackgroundDisabled" ResourceKey="ControlFillColorDisabledBrush"/>
|
||||||
|
|
||||||
|
<!-- BorderBrush -->
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrush" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrushPointerOver" ResourceKey="SubtleFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrushSelected" ResourceKey="ControlElevationBorderBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrushPressed" ResourceKey="SubtleFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrushDisabled" ResourceKey="ControlAltFillColorSecondaryBrush"/>
|
||||||
|
|
||||||
|
<!-- Foreground -->
|
||||||
|
<StaticResource x:Key="SegmentedItemForeground" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemForegroundSelected" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemForegroundPressed" ResourceKey="TextFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemForegroundDisabled" ResourceKey="TextFillColorDisabledBrush"/>
|
||||||
|
|
||||||
|
<!-- Pill -->
|
||||||
|
<StaticResource x:Key="SegmentedPillBackground" ResourceKey="AccentFillColorDefaultBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedPillBackgroundPointerOver" ResourceKey="AccentFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedPillBackgroundPressed" ResourceKey="AccentFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedPillBackgroundDisabled" ResourceKey="AccentFillColorDisabledBrush"/>
|
||||||
|
|
||||||
|
<Thickness x:Key="SegmentedItemBorderThickness">1</Thickness>
|
||||||
|
<x:Double x:Key="SegmentedItemDisabledOpacity">0.55</x:Double>
|
||||||
|
|
||||||
|
<!-- PillSegmentedStyle -->
|
||||||
|
<!-- Background -->
|
||||||
|
<StaticResource x:Key="PivotItemBackground" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemBackgroundPointerOver" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemBackgroundSelected" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemBackgroundPressed" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemBackgroundDisabled" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
|
||||||
|
<!-- Foreground -->
|
||||||
|
<StaticResource x:Key="PivotItemForeground" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemForegroundPointerOver" ResourceKey="TextFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemForegroundPressed" ResourceKey="TextFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemForegroundSelected" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemForegroundDisabled" ResourceKey="TextFillColorDisabledBrush"/>
|
||||||
|
|
||||||
|
<!-- Pill -->
|
||||||
|
<StaticResource x:Key="PivotItemPillBackground" ResourceKey="AccentFillColorDefaultBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemPillBackgroundPointerOver" ResourceKey="AccentFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemPillBackgroundPressed" ResourceKey="AccentFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemPillBackgroundDisabled" ResourceKey="AccentFillColorDefaultBrush"/>
|
||||||
|
|
||||||
|
<!-- ButtonSegmentedStyle -->
|
||||||
|
<!-- Background -->
|
||||||
|
<StaticResource x:Key="ButtonItemBackground" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundPointerOver" ResourceKey="SubtleFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundPressed" ResourceKey="SubtleFillColorTertiary"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundSelected" ResourceKey="AccentFillColorDefaultBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundSelectedPointerOver" ResourceKey="AccentFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundSelectedPressed" ResourceKey="AccentFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundDisabled" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
|
||||||
|
<!-- Foreground -->
|
||||||
|
<StaticResource x:Key="ButtonItemForeground" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundPressed" ResourceKey="TextFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundSelected" ResourceKey="TextOnAccentFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundSelectedPointerOver" ResourceKey="TextOnAccentFillColorPrimaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundSelectedPressed" ResourceKey="TextOnAccentFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundDisabled" ResourceKey="TextFillColorDisabledBrush"/>
|
||||||
|
</ResourceDictionary>
|
||||||
|
|
||||||
|
<ResourceDictionary x:Key="HighContrast">
|
||||||
|
<!-- Background -->
|
||||||
|
<StaticResource x:Key="SegmentedItemBackground" ResourceKey="SystemColorButtonFaceColor"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBackgroundPointerOver" ResourceKey="SystemColorHighlightColor"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBackgroundSelected" ResourceKey="SystemColorHighlightColor"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBackgroundPressed" ResourceKey="SystemColorHighlightColor"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBackgroundDisabled" ResourceKey="SystemControlTransparentBrush"/>
|
||||||
|
|
||||||
|
<!-- BorderBrush -->
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrush" ResourceKey="ControlAltFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrushPointerOver" ResourceKey="ControlAltFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrushSelected" ResourceKey="ControlElevationBorderBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrushPressed" ResourceKey="ControlAltFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemBorderBrushDisabled" ResourceKey="ControlAltFillColorSecondaryBrush"/>
|
||||||
|
|
||||||
|
<!-- Foreground -->
|
||||||
|
<StaticResource x:Key="SegmentedItemForeground" ResourceKey="SystemColorButtonTextColor"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemForegroundPointerOver" ResourceKey="SystemColorHighlightTextColor"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemForegroundSelected" ResourceKey="SystemColorHighlightTextColor"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemForegroundPressed" ResourceKey="SystemColorHighlightTextColor"/>
|
||||||
|
<StaticResource x:Key="SegmentedItemForegroundDisabled" ResourceKey="SystemColorGrayTextColor"/>
|
||||||
|
|
||||||
|
<!-- Pill -->
|
||||||
|
<StaticResource x:Key="SegmentedPillBackground" ResourceKey="AccentFillColorDefaultBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedPillBackgroundPointerOver" ResourceKey="AccentFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedPillBackgroundPressed" ResourceKey="AccentFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="SegmentedPillBackgroundDisabled" ResourceKey="AccentFillColorDisabledBrush"/>
|
||||||
|
|
||||||
|
<Thickness x:Key="SegmentedItemBorderThickness">1</Thickness>
|
||||||
|
<x:Double x:Key="SegmentedItemDisabledOpacity">0.55</x:Double>
|
||||||
|
|
||||||
|
<!-- PillSegmentedStyle -->
|
||||||
|
<!-- Background -->
|
||||||
|
<StaticResource x:Key="PivotItemBackground" ResourceKey="SystemColorButtonFaceColor"/>
|
||||||
|
<StaticResource x:Key="PivotItemBackgroundPointerOver" ResourceKey="SystemColorHighlightColor"/>
|
||||||
|
<StaticResource x:Key="PivotItemBackgroundSelected" ResourceKey="SystemColorHighlightColor"/>
|
||||||
|
<StaticResource x:Key="PivotItemBackgroundPressed" ResourceKey="SystemColorHighlightColor"/>
|
||||||
|
<StaticResource x:Key="PivotItemBackgroundDisabled" ResourceKey="SystemColorButtonTextColor"/>
|
||||||
|
|
||||||
|
<!-- Pill -->
|
||||||
|
<StaticResource x:Key="PivotItemPillBackground" ResourceKey="AccentFillColorDefaultBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemPillBackgroundPointerOver" ResourceKey="AccentFillColorSecondaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemPillBackgroundPressed" ResourceKey="AccentFillColorTertiaryBrush"/>
|
||||||
|
<StaticResource x:Key="PivotItemPillBackgroundDisabled" ResourceKey="AccentFillColorDefaultBrush"/>
|
||||||
|
|
||||||
|
<!-- Foreground -->
|
||||||
|
<StaticResource x:Key="PivotItemForeground" ResourceKey="SystemColorButtonTextColor"/>
|
||||||
|
<StaticResource x:Key="PivotItemForegroundPointerOver" ResourceKey="SystemColorHighlightTextColor"/>
|
||||||
|
<StaticResource x:Key="PivotItemForegroundSelected" ResourceKey="SystemColorHighlightTextColor"/>
|
||||||
|
<StaticResource x:Key="PivotItemForegroundPressed" ResourceKey="SystemColorHighlightTextColor"/>
|
||||||
|
<StaticResource x:Key="PivotItemForegroundDisabled" ResourceKey="SystemColorGrayTextColor"/>
|
||||||
|
|
||||||
|
<!-- ButtonSegmentedStyle -->
|
||||||
|
<!-- Background -->
|
||||||
|
<StaticResource x:Key="ButtonItemBackground" ResourceKey="ControlFillColorTransparentBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundPointerOver" ResourceKey="SystemColorHighlightTextColorBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundPressed" ResourceKey="SystemColorHighlightTextColorBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundSelected" ResourceKey="SystemControlHighlightAccentBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundSelectedPointerOver" ResourceKey="SystemColorButtonTextColorBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundSelectedPressed" ResourceKey="SystemColorHighlightTextColorBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemBackgroundDisabled" ResourceKey="SystemControlBackgroundBaseLowBrush"/>
|
||||||
|
|
||||||
|
<!-- Foreground -->
|
||||||
|
<StaticResource x:Key="ButtonItemForeground" ResourceKey="SystemColorButtonTextColorBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundPointerOver" ResourceKey="SystemControlHighlightBaseHighBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundPressed" ResourceKey="SystemControlHighlightBaseHighBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundSelected" ResourceKey="SystemControlHighlightAltChromeWhiteBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundSelectedPointerOver" ResourceKey="SystemColorButtonFaceColorBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundSelectedPressed" ResourceKey="SystemColorHighlightColorBrush"/>
|
||||||
|
<StaticResource x:Key="ButtonItemForegroundDisabled" ResourceKey="SystemControlDisabledBaseMediumLowBrush"/>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
|
||||||
|
<x:String x:Key="SegmentedItemScaleAnimationDuration">00:00:00.167</x:String>
|
||||||
|
|
||||||
|
<Style BasedOn="{StaticResource DefaultSegmentedItemStyle}" TargetType="shcs:SegmentedItem"/>
|
||||||
|
|
||||||
|
<shcs:SegmentedMarginConverter
|
||||||
|
x:Name="MarginConverter"
|
||||||
|
LeftItemMargin="{StaticResource LeftItemHoverMargin}"
|
||||||
|
MiddleItemMargin="{StaticResource MiddleItemHoverMargin}"
|
||||||
|
RightItemMargin="{StaticResource RightItemHoverMargin}"/>
|
||||||
|
|
||||||
|
<Thickness x:Key="LeftItemHoverMargin">3, 3, 1, 3</Thickness>
|
||||||
|
<Thickness x:Key="MiddleItemHoverMargin">1, 3, 1, 3</Thickness>
|
||||||
|
<Thickness x:Key="RightItemHoverMargin">1, 3, 3, 3</Thickness>
|
||||||
|
<Thickness x:Key="ButtonItemPadding">11</Thickness>
|
||||||
|
<Style x:Key="DefaultSegmentedItemStyle" TargetType="shcs:SegmentedItem">
|
||||||
|
<Style.Setters>
|
||||||
|
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}"/>
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||||
|
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
|
||||||
|
<Setter Property="Background" Value="{ThemeResource SegmentedItemBackground}"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{ThemeResource SegmentedItemBorderBrush}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="{ThemeResource SegmentedItemBorderThickness}"/>
|
||||||
|
<Setter Property="Foreground" Value="{ThemeResource SegmentedItemForeground}"/>
|
||||||
|
<Setter Property="FontWeight" Value="Normal"/>
|
||||||
|
<Setter Property="TabNavigation" Value="Local"/>
|
||||||
|
<Setter Property="UseSystemFocusVisuals" Value="True"/>
|
||||||
|
<Setter Property="FocusVisualMargin" Value="-3"/>
|
||||||
|
<Setter Property="BackgroundSizing" Value="InnerBorderEdge"/>
|
||||||
|
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="shcs:SegmentedItem">
|
||||||
|
<Grid
|
||||||
|
x:Name="PART_Root"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
Control.IsTemplateFocusTarget="True"
|
||||||
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
|
<win:Grid.BackgroundTransition>
|
||||||
|
<win:BrushTransition Duration="0:0:0.083"/>
|
||||||
|
</win:Grid.BackgroundTransition>
|
||||||
|
|
||||||
|
<Border
|
||||||
|
x:Name="PART_Hover"
|
||||||
|
Margin="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource MarginConverter}}"
|
||||||
|
Background="Transparent"
|
||||||
|
CornerRadius="2"
|
||||||
|
RenderTransformOrigin="0.5, 0.5">
|
||||||
|
<win:Border.BackgroundTransition>
|
||||||
|
<win:BrushTransition Duration="0:0:0.083"/>
|
||||||
|
</win:Border.BackgroundTransition>
|
||||||
|
<Border.RenderTransform>
|
||||||
|
<CompositeTransform/>
|
||||||
|
</Border.RenderTransform>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Content -->
|
||||||
|
<Grid
|
||||||
|
x:Name="ContentHolder"
|
||||||
|
Margin="11,0,11,0"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
ColumnSpacing="8">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Viewbox
|
||||||
|
x:Name="PART_IconBox"
|
||||||
|
Width="16"
|
||||||
|
Margin="0,7,0,7"
|
||||||
|
VerticalAlignment="Center">
|
||||||
|
<ContentPresenter
|
||||||
|
x:Name="PART_IconPresenter"
|
||||||
|
win:HighContrastAdjustment="None"
|
||||||
|
Content="{TemplateBinding Icon}"
|
||||||
|
Foreground="{TemplateBinding Foreground}"/>
|
||||||
|
</Viewbox>
|
||||||
|
|
||||||
|
<ContentPresenter
|
||||||
|
x:Name="PART_ContentPresenter"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="0,5,0,6"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
win:HighContrastAdjustment="None"
|
||||||
|
win:OpticalMarginAlignment="TrimSideBearings"
|
||||||
|
BackgroundSizing="{TemplateBinding BackgroundSizing}"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTransitions="{TemplateBinding ContentTransitions}"
|
||||||
|
FontWeight="{TemplateBinding FontWeight}"
|
||||||
|
Foreground="{TemplateBinding Foreground}"/>
|
||||||
|
<Rectangle
|
||||||
|
x:Name="PART_Pill"
|
||||||
|
Grid.Column="1"
|
||||||
|
Width="4"
|
||||||
|
Height="3"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
Fill="{ThemeResource SegmentedPillBackground}"
|
||||||
|
Opacity="0"
|
||||||
|
RadiusX="0.5"
|
||||||
|
RadiusY="1"
|
||||||
|
RenderTransformOrigin="0.5, 0.5">
|
||||||
|
<Rectangle.RenderTransform>
|
||||||
|
<CompositeTransform x:Name="PillTransform" ScaleX="1"/>
|
||||||
|
</Rectangle.RenderTransform>
|
||||||
|
</Rectangle>
|
||||||
|
</Grid>
|
||||||
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
<VisualStateGroup x:Name="SegmentedIconPositionStates">
|
||||||
|
<VisualState x:Name="IconOnLeft"/>
|
||||||
|
<VisualState x:Name="IconOnly">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="PART_ContentPresenter.Visibility" Value="Collapsed"/>
|
||||||
|
<Setter Target="PART_Pill.(Grid.Column)" Value="0"/>
|
||||||
|
<Setter Target="ContentHolder.ColumnSpacing" Value="0"/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="ContentOnly">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="PART_IconBox.Visibility" Value="Collapsed"/>
|
||||||
|
<Setter Target="ContentHolder.ColumnSpacing" Value="0"/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal"/>
|
||||||
|
<VisualState x:Name="PointerOver">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Hover" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemBackgroundPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemForegroundPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemForegroundPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Pressed">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Hover" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="0.96"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Hover" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="0.96"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Hover" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemBackgroundPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemForegroundPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemForegroundPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Selected">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="4"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="Opacity">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="1"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="Fill">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedPillBackground}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemBackgroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="BorderBrush">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemBorderBrushSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemForegroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemForegroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="PointerOverSelected">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="4"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="Opacity">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="1"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="Fill">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedPillBackgroundPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemBackgroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="BorderBrush">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemBorderBrushSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemForegroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemForegroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="PressedSelected">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="2"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="Opacity">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="1"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="Fill">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedPillBackgroundPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemBackgroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="BorderBrush">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemBorderBrushSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemForegroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SegmentedItemForegroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
<VisualStateGroup x:Name="DisabledStates">
|
||||||
|
<VisualState x:Name="Enabled"/>
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation
|
||||||
|
Storyboard.TargetName="PART_Root"
|
||||||
|
Storyboard.TargetProperty="Opacity"
|
||||||
|
To="{ThemeResource SegmentedItemDisabledOpacity}"
|
||||||
|
Duration="0:0:0.083"/>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style.Setters>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style
|
||||||
|
x:Key="PivotSegmentedItemStyle"
|
||||||
|
BasedOn="{StaticResource DefaultSegmentedItemStyle}"
|
||||||
|
TargetType="shcs:SegmentedItem">
|
||||||
|
<Style.Setters>
|
||||||
|
<Setter Property="Background" Value="{ThemeResource PivotItemBackground}"/>
|
||||||
|
<Setter Property="Foreground" Value="{ThemeResource PivotItemForeground}"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="shcs:SegmentedItem">
|
||||||
|
<Grid
|
||||||
|
x:Name="PART_Root"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
Control.IsTemplateFocusTarget="True"
|
||||||
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
|
<!-- Content -->
|
||||||
|
<Grid
|
||||||
|
x:Name="ContentHolder"
|
||||||
|
Margin="12,0,12,0"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
ColumnSpacing="8">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Viewbox
|
||||||
|
x:Name="PART_IconBox"
|
||||||
|
Width="16"
|
||||||
|
Margin="0,11,0,11"
|
||||||
|
VerticalAlignment="Center">
|
||||||
|
<ContentPresenter
|
||||||
|
x:Name="PART_IconPresenter"
|
||||||
|
win:HighContrastAdjustment="None"
|
||||||
|
Content="{TemplateBinding Icon}"
|
||||||
|
Foreground="{TemplateBinding Foreground}"/>
|
||||||
|
</Viewbox>
|
||||||
|
|
||||||
|
<ContentPresenter
|
||||||
|
x:Name="PART_ContentPresenter"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="0,9,0,10"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
win:HighContrastAdjustment="None"
|
||||||
|
win:OpticalMarginAlignment="TrimSideBearings"
|
||||||
|
BackgroundSizing="{TemplateBinding BackgroundSizing}"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTransitions="{TemplateBinding ContentTransitions}"
|
||||||
|
FontWeight="{TemplateBinding FontWeight}"
|
||||||
|
Foreground="{TemplateBinding Foreground}"/>
|
||||||
|
<Rectangle
|
||||||
|
x:Name="PART_Pill"
|
||||||
|
Grid.Column="1"
|
||||||
|
Width="4"
|
||||||
|
Height="3"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
Fill="{ThemeResource PivotItemPillBackground}"
|
||||||
|
Opacity="0"
|
||||||
|
RadiusX="0.5"
|
||||||
|
RadiusY="1"
|
||||||
|
RenderTransformOrigin="0.5, 0.5">
|
||||||
|
<Rectangle.RenderTransform>
|
||||||
|
<CompositeTransform x:Name="PillTransform" ScaleX="1"/>
|
||||||
|
</Rectangle.RenderTransform>
|
||||||
|
</Rectangle>
|
||||||
|
</Grid>
|
||||||
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
<VisualStateGroup x:Name="SegmentedIconPositionStates">
|
||||||
|
<VisualState x:Name="IconOnLeft"/>
|
||||||
|
<VisualState x:Name="IconOnly">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="PART_ContentPresenter.Visibility" Value="Collapsed"/>
|
||||||
|
<Setter Target="PART_Pill.(Grid.Column)" Value="0"/>
|
||||||
|
<Setter Target="ContentHolder.ColumnSpacing" Value="0"/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="ContentOnly">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="PART_IconBox.Visibility" Value="Collapsed"/>
|
||||||
|
<Setter Target="ContentHolder.ColumnSpacing" Value="0"/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal"/>
|
||||||
|
<VisualState x:Name="PointerOver">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemBackgroundPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemForegroundPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemForegroundPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Pressed">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemBackgroundPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemForegroundPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemForegroundPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Selected">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="4"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="Opacity">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="1"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemBackgroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemForegroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemForegroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="PointerOverSelected">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="4"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="Opacity">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="1"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemBackgroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemForegroundPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemForegroundPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="PressedSelected">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="2"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Pill" Storyboard.TargetProperty="Opacity">
|
||||||
|
<SplineDoubleKeyFrame
|
||||||
|
KeySpline="0,0,0,1"
|
||||||
|
KeyTime="{ThemeResource SegmentedItemScaleAnimationDuration}"
|
||||||
|
Value="1"/>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemBackgroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemForegroundPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotItemForegroundPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
<VisualStateGroup x:Name="DisabledStates">
|
||||||
|
<VisualState x:Name="Enabled"/>
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation
|
||||||
|
Storyboard.TargetName="PART_Root"
|
||||||
|
Storyboard.TargetProperty="Opacity"
|
||||||
|
To="{ThemeResource SegmentedItemDisabledOpacity}"
|
||||||
|
Duration="0:0:0.083"/>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style.Setters>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style
|
||||||
|
x:Key="ButtonSegmentedItemStyle"
|
||||||
|
BasedOn="{StaticResource DefaultSegmentedItemStyle}"
|
||||||
|
TargetType="shcs:SegmentedItem">
|
||||||
|
<Style.Setters>
|
||||||
|
<Setter Property="Background" Value="{ThemeResource ButtonItemBackground}"/>
|
||||||
|
<Setter Property="Foreground" Value="{ThemeResource ButtonItemForeground}"/>
|
||||||
|
<Setter Property="Padding" Value="{ThemeResource ButtonItemPadding}"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="shcs:SegmentedItem">
|
||||||
|
<Grid
|
||||||
|
x:Name="PART_Root"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BackgroundSizing="{TemplateBinding BackgroundSizing}"
|
||||||
|
Control.IsTemplateFocusTarget="True"
|
||||||
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
|
<win:Grid.BackgroundTransition>
|
||||||
|
<win:BrushTransition Duration="0:0:0.083"/>
|
||||||
|
</win:Grid.BackgroundTransition>
|
||||||
|
|
||||||
|
<!-- Content -->
|
||||||
|
<Grid
|
||||||
|
x:Name="ContentHolder"
|
||||||
|
Margin="{TemplateBinding Padding}"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
ColumnSpacing="8">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Viewbox
|
||||||
|
x:Name="PART_IconBox"
|
||||||
|
Width="16"
|
||||||
|
VerticalAlignment="Center">
|
||||||
|
<ContentPresenter
|
||||||
|
x:Name="PART_IconPresenter"
|
||||||
|
win:HighContrastAdjustment="None"
|
||||||
|
Content="{TemplateBinding Icon}"
|
||||||
|
Foreground="{TemplateBinding Foreground}"/>
|
||||||
|
</Viewbox>
|
||||||
|
|
||||||
|
<ContentPresenter
|
||||||
|
x:Name="PART_ContentPresenter"
|
||||||
|
Grid.Column="1"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
win:HighContrastAdjustment="None"
|
||||||
|
win:OpticalMarginAlignment="TrimSideBearings"
|
||||||
|
BackgroundSizing="{TemplateBinding BackgroundSizing}"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTransitions="{TemplateBinding ContentTransitions}"
|
||||||
|
FontWeight="{TemplateBinding FontWeight}"
|
||||||
|
Foreground="{TemplateBinding Foreground}"/>
|
||||||
|
</Grid>
|
||||||
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
<VisualStateGroup x:Name="SegmentedIconPositionStates">
|
||||||
|
<VisualState x:Name="IconOnLeft"/>
|
||||||
|
<VisualState x:Name="IconOnly">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="PART_ContentPresenter.Visibility" Value="Collapsed"/>
|
||||||
|
<Setter Target="ContentHolder.ColumnSpacing" Value="0"/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="ContentOnly">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="PART_IconBox.Visibility" Value="Collapsed"/>
|
||||||
|
<Setter Target="ContentHolder.ColumnSpacing" Value="0"/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal"/>
|
||||||
|
<VisualState x:Name="PointerOver">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemBackgroundPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemForegroundPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemForegroundPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Pressed">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemBackgroundPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemForegroundPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemForegroundPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Selected">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemBackgroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemForegroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemForegroundSelected}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="PointerOverSelected">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemBackgroundSelectedPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemForegroundSelectedPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemForegroundSelectedPointerOver}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="PressedSelected">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Root" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemBackgroundSelectedPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemForegroundSelectedPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_IconPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonItemForegroundSelectedPressed}"/>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
<VisualStateGroup x:Name="DisabledStates">
|
||||||
|
<VisualState x:Name="Enabled"/>
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation
|
||||||
|
Storyboard.TargetName="PART_Root"
|
||||||
|
Storyboard.TargetProperty="Opacity"
|
||||||
|
To="{ThemeResource SegmentedItemDisabledOpacity}"
|
||||||
|
Duration="0:0:0.083"/>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style.Setters>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Microsoft.UI.Xaml.Data;
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Control.Segmented;
|
||||||
|
|
||||||
|
[DependencyProperty("LeftItemMargin", typeof(Thickness))]
|
||||||
|
[DependencyProperty("MiddleItemMargin", typeof(Thickness))]
|
||||||
|
[DependencyProperty("RightItemMargin", typeof(Thickness))]
|
||||||
|
internal partial class SegmentedMarginConverter : DependencyObject, IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, string language)
|
||||||
|
{
|
||||||
|
SegmentedItem segmentedItem = (SegmentedItem)value;
|
||||||
|
ItemsControl listView = ItemsControl.ItemsControlFromItemContainer(segmentedItem);
|
||||||
|
|
||||||
|
int index = listView.IndexFromContainer(segmentedItem);
|
||||||
|
|
||||||
|
if (index == 0)
|
||||||
|
{
|
||||||
|
return LeftItemMargin;
|
||||||
|
}
|
||||||
|
else if (index == listView.Items.Count - 1)
|
||||||
|
{
|
||||||
|
return RightItemMargin;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return MiddleItemMargin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
namespace Snap.Hutao.Core.ExceptionService;
|
namespace Snap.Hutao.Core.ExceptionService;
|
||||||
|
|
||||||
internal sealed class HutaoException : Exception
|
internal sealed class HutaoException : Exception
|
||||||
|
|||||||
@@ -69,10 +69,12 @@ internal sealed class WindowController
|
|||||||
window.Activate();
|
window.Activate();
|
||||||
options.BringToForeground();
|
options.BringToForeground();
|
||||||
|
|
||||||
AppOptions appOptions = serviceProvider.GetRequiredService<AppOptions>();
|
if (options.UseSystemBackdrop)
|
||||||
UpdateElementTheme(appOptions.ElementTheme);
|
{
|
||||||
UpdateSystemBackdrop(appOptions.BackdropType);
|
AppOptions appOptions = serviceProvider.GetRequiredService<AppOptions>();
|
||||||
appOptions.PropertyChanged += OnOptionsPropertyChanged;
|
UpdateSystemBackdrop(appOptions.BackdropType);
|
||||||
|
appOptions.PropertyChanged += OnOptionsPropertyChanged;
|
||||||
|
}
|
||||||
|
|
||||||
subclass.Initialize();
|
subclass.Initialize();
|
||||||
|
|
||||||
@@ -120,17 +122,13 @@ internal sealed class WindowController
|
|||||||
|
|
||||||
private void OnOptionsPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
private void OnOptionsPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is not AppOptions options)
|
if (e.PropertyName is nameof(AppOptions.BackdropType))
|
||||||
{
|
{
|
||||||
return;
|
if (sender is AppOptions options)
|
||||||
|
{
|
||||||
|
UpdateSystemBackdrop(options.BackdropType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = e.PropertyName switch
|
|
||||||
{
|
|
||||||
nameof(AppOptions.BackdropType) => UpdateSystemBackdrop(options.BackdropType),
|
|
||||||
nameof(AppOptions.ElementTheme) => UpdateElementTheme(options.ElementTheme),
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnWindowClosed(object sender, WindowEventArgs args)
|
private void OnWindowClosed(object sender, WindowEventArgs args)
|
||||||
@@ -160,7 +158,7 @@ internal sealed class WindowController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool UpdateSystemBackdrop(BackdropType backdropType)
|
private void UpdateSystemBackdrop(BackdropType backdropType)
|
||||||
{
|
{
|
||||||
window.SystemBackdrop = backdropType switch
|
window.SystemBackdrop = backdropType switch
|
||||||
{
|
{
|
||||||
@@ -170,15 +168,6 @@ internal sealed class WindowController
|
|||||||
BackdropType.Acrylic => new DesktopAcrylicBackdrop(),
|
BackdropType.Acrylic => new DesktopAcrylicBackdrop(),
|
||||||
_ => null,
|
_ => null,
|
||||||
};
|
};
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool UpdateElementTheme(ElementTheme theme)
|
|
||||||
{
|
|
||||||
((FrameworkElement)window.Content).RequestedTheme = theme;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateTitleButtonColor()
|
private void UpdateTitleButtonColor()
|
||||||
|
|||||||
@@ -41,18 +41,21 @@ internal readonly struct WindowOptions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly bool PersistSize;
|
public readonly bool PersistSize;
|
||||||
|
|
||||||
|
public readonly bool UseSystemBackdrop;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否使用 Win UI 3 自带的拓展标题栏实现
|
/// 是否使用 Win UI 3 自带的拓展标题栏实现
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly bool UseLegacyDragBarImplementation = !AppWindowTitleBar.IsCustomizationSupported();
|
public readonly bool UseLegacyDragBarImplementation = !AppWindowTitleBar.IsCustomizationSupported();
|
||||||
|
|
||||||
public WindowOptions(Window window, FrameworkElement titleBar, SizeInt32 initSize, bool persistSize = false)
|
public WindowOptions(Window window, FrameworkElement titleBar, SizeInt32 initSize, bool persistSize = false, bool useSystemBackdrop = true)
|
||||||
{
|
{
|
||||||
Hwnd = WindowNative.GetWindowHandle(window);
|
Hwnd = WindowNative.GetWindowHandle(window);
|
||||||
InputNonClientPointerSource = InputNonClientPointerSource.GetForWindowId(window.AppWindow.Id);
|
InputNonClientPointerSource = InputNonClientPointerSource.GetForWindowId(window.AppWindow.Id);
|
||||||
TitleBar = titleBar;
|
TitleBar = titleBar;
|
||||||
InitSize = initSize;
|
InitSize = initSize;
|
||||||
PersistSize = persistSize;
|
PersistSize = persistSize;
|
||||||
|
UseSystemBackdrop = useSystemBackdrop;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ internal sealed partial class SettingEntry
|
|||||||
public const string Culture = "Culture";
|
public const string Culture = "Culture";
|
||||||
|
|
||||||
public const string SystemBackdropType = "SystemBackdropType";
|
public const string SystemBackdropType = "SystemBackdropType";
|
||||||
public const string ElementTheme = "ElementTheme";
|
|
||||||
public const string BackgroundImageType = "BackgroundImageType";
|
public const string BackgroundImageType = "BackgroundImageType";
|
||||||
|
|
||||||
public const string AnnouncementRegion = "AnnouncementRegion";
|
public const string AnnouncementRegion = "AnnouncementRegion";
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using Snap.Hutao.Model.Primitive;
|
||||||
|
|
||||||
namespace Snap.Hutao.Model.Metadata.Achievement;
|
namespace Snap.Hutao.Model.Metadata.Achievement;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using Snap.Hutao.Model.Intrinsic;
|
||||||
using Snap.Hutao.Model.Primitive;
|
using Snap.Hutao.Model.Primitive;
|
||||||
|
|
||||||
namespace Snap.Hutao.Model.Metadata.Furniture;
|
namespace Snap.Hutao.Model.Metadata.Furniture;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using Snap.Hutao.Model.Intrinsic;
|
||||||
using Snap.Hutao.Model.Primitive;
|
using Snap.Hutao.Model.Primitive;
|
||||||
|
|
||||||
namespace Snap.Hutao.Model.Metadata.Furniture;
|
namespace Snap.Hutao.Model.Metadata.Furniture;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using Snap.Hutao.Model.Intrinsic;
|
||||||
using Snap.Hutao.Model.Primitive;
|
using Snap.Hutao.Model.Primitive;
|
||||||
|
|
||||||
namespace Snap.Hutao.Model.Metadata;
|
namespace Snap.Hutao.Model.Metadata;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"profiles": {
|
"profiles": {
|
||||||
"Snap.Hutao": {
|
"Snap.Hutao": {
|
||||||
"commandName": "MsixPackage",
|
"commandName": "MsixPackage",
|
||||||
"nativeDebugging": false,
|
"nativeDebugging": true,
|
||||||
"doNotLaunchApp": false,
|
"doNotLaunchApp": false,
|
||||||
"allowLocalNetworkLoopbackProperty": true
|
"allowLocalNetworkLoopbackProperty": true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -60,45 +60,45 @@
|
|||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
||||||
<xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
|
<xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:choice maxOccurs="unbounded">
|
<xsd:choice maxOccurs="unbounded">
|
||||||
<xsd:element name="metadata">
|
<xsd:element name="metadata">
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:sequence>
|
<xsd:sequence>
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
<xsd:element name="value" type="xsd:string" minOccurs="0"/>
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
<xsd:attribute name="name" use="required" type="xsd:string"/>
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
<xsd:attribute name="type" type="xsd:string"/>
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
<xsd:attribute name="mimetype" type="xsd:string"/>
|
||||||
<xsd:attribute ref="xml:space" />
|
<xsd:attribute ref="xml:space"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
<xsd:element name="assembly">
|
<xsd:element name="assembly">
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
<xsd:attribute name="alias" type="xsd:string"/>
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
<xsd:attribute name="name" type="xsd:string"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
<xsd:element name="data">
|
<xsd:element name="data">
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:sequence>
|
<xsd:sequence>
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"/>
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1"/>
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"/>
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"/>
|
||||||
<xsd:attribute ref="xml:space" />
|
<xsd:attribute ref="xml:space"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
<xsd:element name="resheader">
|
<xsd:element name="resheader">
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:sequence>
|
<xsd:sequence>
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
</xsd:choice>
|
</xsd:choice>
|
||||||
@@ -186,15 +186,6 @@
|
|||||||
<data name="CoreWebView2HelperVersionUndetected" xml:space="preserve">
|
<data name="CoreWebView2HelperVersionUndetected" xml:space="preserve">
|
||||||
<value>No WebView2 Runtime detected</value>
|
<value>No WebView2 Runtime detected</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="CoreWindowThemeDark" xml:space="preserve">
|
|
||||||
<value>Dark</value>
|
|
||||||
</data>
|
|
||||||
<data name="CoreWindowThemeLight" xml:space="preserve">
|
|
||||||
<value>Light</value>
|
|
||||||
</data>
|
|
||||||
<data name="CoreWindowThemeSystem" xml:space="preserve">
|
|
||||||
<value>System</value>
|
|
||||||
</data>
|
|
||||||
<data name="FilePickerExportCommit" xml:space="preserve">
|
<data name="FilePickerExportCommit" xml:space="preserve">
|
||||||
<value>Export</value>
|
<value>Export</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -189,15 +189,6 @@
|
|||||||
<data name="CoreWindowHotkeyCombinationRegisterFailed" xml:space="preserve">
|
<data name="CoreWindowHotkeyCombinationRegisterFailed" xml:space="preserve">
|
||||||
<value>[{0}] 热键 [{1}] 注册失败</value>
|
<value>[{0}] 热键 [{1}] 注册失败</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="CoreWindowThemeDark" xml:space="preserve">
|
|
||||||
<value>深色</value>
|
|
||||||
</data>
|
|
||||||
<data name="CoreWindowThemeLight" xml:space="preserve">
|
|
||||||
<value>浅色</value>
|
|
||||||
</data>
|
|
||||||
<data name="CoreWindowThemeSystem" xml:space="preserve">
|
|
||||||
<value>跟随系统</value>
|
|
||||||
</data>
|
|
||||||
<data name="FilePickerExportCommit" xml:space="preserve">
|
<data name="FilePickerExportCommit" xml:space="preserve">
|
||||||
<value>导出</value>
|
<value>导出</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -2229,7 +2220,7 @@
|
|||||||
<value>在游戏启动后尝试启动并使用 Better GI 进行自动化任务</value>
|
<value>在游戏启动后尝试启动并使用 Better GI 进行自动化任务</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ViewPageLaunchGameBetterGIHeader" xml:space="preserve">
|
<data name="ViewPageLaunchGameBetterGIHeader" xml:space="preserve">
|
||||||
<value>自动化任务</value>
|
<value>Better GI</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ViewPageLaunchGameCommonHeader" xml:space="preserve">
|
<data name="ViewPageLaunchGameCommonHeader" xml:space="preserve">
|
||||||
<value>常规</value>
|
<value>常规</value>
|
||||||
@@ -2247,7 +2238,7 @@
|
|||||||
<value>文件</value>
|
<value>文件</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ViewPageLaunchGameInterProcessHeader" xml:space="preserve">
|
<data name="ViewPageLaunchGameInterProcessHeader" xml:space="preserve">
|
||||||
<value>进程联动</value>
|
<value>进程间</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ViewPageLaunchGameMonitorsDescription" xml:space="preserve">
|
<data name="ViewPageLaunchGameMonitorsDescription" xml:space="preserve">
|
||||||
<value>在指定的显示器上运行</value>
|
<value>在指定的显示器上运行</value>
|
||||||
@@ -2381,9 +2372,6 @@
|
|||||||
<data name="ViewPageSettingBackgroundImageHeader" xml:space="preserve">
|
<data name="ViewPageSettingBackgroundImageHeader" xml:space="preserve">
|
||||||
<value>背景图片</value>
|
<value>背景图片</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ViewPageSettingBackgroundImageLocalFolderCopyrightHeader" xml:space="preserve">
|
|
||||||
<value>当前背景为本地图片,如遇版权问题由用户个人负责</value>
|
|
||||||
</data>
|
|
||||||
<data name="ViewPageSettingCacheFolderDescription" xml:space="preserve">
|
<data name="ViewPageSettingCacheFolderDescription" xml:space="preserve">
|
||||||
<value>图片缓存 在此处存放</value>
|
<value>图片缓存 在此处存放</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -2639,12 +2627,6 @@
|
|||||||
<data name="ViewPageSettingStoreReviewNavigate" xml:space="preserve">
|
<data name="ViewPageSettingStoreReviewNavigate" xml:space="preserve">
|
||||||
<value>评价软件</value>
|
<value>评价软件</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ViewPageSettingThemeDescription" xml:space="preserve">
|
|
||||||
<value>更改窗体的颜色主题</value>
|
|
||||||
</data>
|
|
||||||
<data name="ViewPageSettingThemeHeader" xml:space="preserve">
|
|
||||||
<value>颜色主题</value>
|
|
||||||
</data>
|
|
||||||
<data name="ViewPageSettingTranslateNavigate" xml:space="preserve">
|
<data name="ViewPageSettingTranslateNavigate" xml:space="preserve">
|
||||||
<value>贡献翻译</value>
|
<value>贡献翻译</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using Microsoft.UI.Xaml;
|
|
||||||
using Snap.Hutao.Core.Windowing;
|
using Snap.Hutao.Core.Windowing;
|
||||||
using Snap.Hutao.Model;
|
using Snap.Hutao.Model;
|
||||||
using Snap.Hutao.Model.Entity;
|
using Snap.Hutao.Model.Entity;
|
||||||
@@ -17,7 +16,6 @@ internal sealed partial class AppOptions : DbStoreOptions
|
|||||||
{
|
{
|
||||||
private bool? isEmptyHistoryWishVisible;
|
private bool? isEmptyHistoryWishVisible;
|
||||||
private BackdropType? backdropType;
|
private BackdropType? backdropType;
|
||||||
private ElementTheme? elementTheme;
|
|
||||||
private BackgroundImageType? backgroundImageType;
|
private BackgroundImageType? backgroundImageType;
|
||||||
private Region? region;
|
private Region? region;
|
||||||
private string? geetestCustomCompositeUrl;
|
private string? geetestCustomCompositeUrl;
|
||||||
@@ -36,19 +34,6 @@ internal sealed partial class AppOptions : DbStoreOptions
|
|||||||
set => SetOption(ref backdropType, SettingEntry.SystemBackdropType, value, EnumToStringOrEmpty);
|
set => SetOption(ref backdropType, SettingEntry.SystemBackdropType, value, EnumToStringOrEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Lazy<List<NameValue<ElementTheme>>> LazyElementThemes { get; } = new(() =>
|
|
||||||
[
|
|
||||||
new(SH.CoreWindowThemeLight, ElementTheme.Light),
|
|
||||||
new(SH.CoreWindowThemeDark, ElementTheme.Dark),
|
|
||||||
new(SH.CoreWindowThemeSystem, ElementTheme.Default),
|
|
||||||
]);
|
|
||||||
|
|
||||||
public ElementTheme ElementTheme
|
|
||||||
{
|
|
||||||
get => GetOption(ref elementTheme, SettingEntry.ElementTheme, EnumParse<ElementTheme>, ElementTheme.Default).Value;
|
|
||||||
set => SetOption(ref elementTheme, SettingEntry.ElementTheme, value, EnumToStringOrEmpty);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<NameValue<BackgroundImageType>> BackgroundImageTypes { get; } = CollectionsNameValue.FromEnum<BackgroundImageType>(type => type.GetLocalizedDescription());
|
public List<NameValue<BackgroundImageType>> BackgroundImageTypes { get; } = CollectionsNameValue.FromEnum<BackgroundImageType>(type => type.GetLocalizedDescription());
|
||||||
|
|
||||||
public BackgroundImageType BackgroundImageType
|
public BackgroundImageType BackgroundImageType
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ internal sealed partial class BackgroundImageService : IBackgroundImageService
|
|||||||
return new(true, default!);
|
return new(true, default!);
|
||||||
}
|
}
|
||||||
|
|
||||||
string path = System.Random.Shared.GetItems([.. backgroundSet], 1)[0];
|
string path = System.Random.Shared.GetItems([..backgroundSet], 1)[0];
|
||||||
backgroundSet.Remove(path);
|
backgroundSet.Remove(path);
|
||||||
|
|
||||||
if (string.Equals(path, previous?.Path, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(path, previous?.Path, StringComparison.OrdinalIgnoreCase))
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using Snap.Hutao.Core.ExceptionService;
|
using Snap.Hutao.Core.ExceptionService;
|
||||||
using Snap.Hutao.Model.Intrinsic;
|
using Snap.Hutao.Model.Intrinsic;
|
||||||
|
using Snap.Hutao.Model.Metadata;
|
||||||
using Snap.Hutao.Model.Metadata.Avatar;
|
using Snap.Hutao.Model.Metadata.Avatar;
|
||||||
using Snap.Hutao.Model.Metadata.Weapon;
|
using Snap.Hutao.Model.Metadata.Weapon;
|
||||||
using Snap.Hutao.Service.Metadata;
|
using Snap.Hutao.Service.Metadata;
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ internal sealed class GachaTypeComparer : IComparer<GachaType>
|
|||||||
KeyValuePair.Create(GachaType.ActivityAvatar, 0),
|
KeyValuePair.Create(GachaType.ActivityAvatar, 0),
|
||||||
KeyValuePair.Create(GachaType.SpecialActivityAvatar, 1),
|
KeyValuePair.Create(GachaType.SpecialActivityAvatar, 1),
|
||||||
KeyValuePair.Create(GachaType.ActivityWeapon, 2),
|
KeyValuePair.Create(GachaType.ActivityWeapon, 2),
|
||||||
KeyValuePair.Create(GachaType.ActivityCity, 3),
|
KeyValuePair.Create(GachaType.Standard, 3),
|
||||||
KeyValuePair.Create(GachaType.Standard, 4),
|
KeyValuePair.Create(GachaType.NewBie, 4),
|
||||||
KeyValuePair.Create(GachaType.NewBie, 5),
|
KeyValuePair.Create(GachaType.ActivityCity, 5),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Snap.Hutao.Model.Entity;
|
|||||||
using Snap.Hutao.Model.Intrinsic;
|
using Snap.Hutao.Model.Intrinsic;
|
||||||
using Snap.Hutao.Model.Metadata.Abstraction;
|
using Snap.Hutao.Model.Metadata.Abstraction;
|
||||||
using Snap.Hutao.ViewModel.GachaLog;
|
using Snap.Hutao.ViewModel.GachaLog;
|
||||||
|
using Snap.Hutao.Web.Hoyolab.Hk4e.Event.GachaInfo;
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.GachaLog.Factory;
|
namespace Snap.Hutao.Service.GachaLog.Factory;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using Snap.Hutao.Model.Entity;
|
using Snap.Hutao.Model.Entity;
|
||||||
|
using Snap.Hutao.Model.Metadata;
|
||||||
|
using Snap.Hutao.Model.Metadata.Avatar;
|
||||||
|
using Snap.Hutao.Model.Metadata.Weapon;
|
||||||
|
using Snap.Hutao.Model.Primitive;
|
||||||
using Snap.Hutao.Service.GachaLog.Factory;
|
using Snap.Hutao.Service.GachaLog.Factory;
|
||||||
using Snap.Hutao.Service.Metadata;
|
using Snap.Hutao.Service.Metadata;
|
||||||
using Snap.Hutao.Service.Metadata.ContextAbstraction;
|
using Snap.Hutao.Service.Metadata.ContextAbstraction;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Snap.Hutao.Core.Database;
|
|||||||
using Snap.Hutao.Core.Diagnostics;
|
using Snap.Hutao.Core.Diagnostics;
|
||||||
using Snap.Hutao.Model.Entity;
|
using Snap.Hutao.Model.Entity;
|
||||||
using Snap.Hutao.Model.InterChange.GachaLog;
|
using Snap.Hutao.Model.InterChange.GachaLog;
|
||||||
|
using Snap.Hutao.Model.Primitive;
|
||||||
using Snap.Hutao.Service.GachaLog.Factory;
|
using Snap.Hutao.Service.GachaLog.Factory;
|
||||||
using Snap.Hutao.Service.GachaLog.QueryProvider;
|
using Snap.Hutao.Service.GachaLog.QueryProvider;
|
||||||
using Snap.Hutao.Service.Metadata;
|
using Snap.Hutao.Service.Metadata;
|
||||||
|
|||||||
@@ -168,14 +168,9 @@ internal sealed partial class PackageConverter
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Server might close the connection shortly,
|
using (Stream remoteSteam = await httpClient.GetStreamAsync(pkgVersionUrl).ConfigureAwait(false))
|
||||||
// we have to cache the content immediately.
|
|
||||||
using (HttpResponseMessage responseMessage = await httpClient.GetAsync(pkgVersionUrl, HttpCompletionOption.ResponseContentRead).ConfigureAwait(false))
|
|
||||||
{
|
{
|
||||||
using (Stream remoteSteam = await responseMessage.Content.ReadAsStreamAsync().ConfigureAwait(false))
|
return await GetVersionItemsAsync(remoteSteam).ConfigureAwait(false);
|
||||||
{
|
|
||||||
return await GetVersionItemsAsync(remoteSteam).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
|
using Snap.Hutao.Core.DependencyInjection.Abstraction;
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Metadata;
|
namespace Snap.Hutao.Service.Metadata;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Snap.Hutao.Core.DependencyInjection.Abstraction;
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Navigation;
|
namespace Snap.Hutao.Service.Navigation;
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using Snap.Hutao.Core.Database;
|
using Snap.Hutao.Core.Database;
|
||||||
|
using Snap.Hutao.Core.ExceptionService;
|
||||||
using Snap.Hutao.Message;
|
using Snap.Hutao.Message;
|
||||||
using Snap.Hutao.ViewModel.User;
|
using Snap.Hutao.ViewModel.User;
|
||||||
using Snap.Hutao.Web.Hoyolab.Takumi.Binding;
|
using Snap.Hutao.Web.Hoyolab.Takumi.Binding;
|
||||||
|
|||||||
@@ -156,7 +156,6 @@
|
|||||||
<None Remove="View\Control\LoadingView.xaml" />
|
<None Remove="View\Control\LoadingView.xaml" />
|
||||||
<None Remove="View\Control\LoadingViewSlim.xaml" />
|
<None Remove="View\Control\LoadingViewSlim.xaml" />
|
||||||
<None Remove="View\Control\SkillPivot.xaml" />
|
<None Remove="View\Control\SkillPivot.xaml" />
|
||||||
<None Remove="View\Control\SegmentedOverride.xaml" />
|
|
||||||
<None Remove="View\Control\StatisticsCard.xaml" />
|
<None Remove="View\Control\StatisticsCard.xaml" />
|
||||||
<None Remove="View\Control\StatisticsSegmented.xaml" />
|
<None Remove="View\Control\StatisticsSegmented.xaml" />
|
||||||
<None Remove="View\Control\WebViewer.xaml" />
|
<None Remove="View\Control\WebViewer.xaml" />
|
||||||
@@ -297,7 +296,6 @@
|
|||||||
<PackageReference Include="CommunityToolkit.WinUI.Collections" Version="8.0.240109" />
|
<PackageReference Include="CommunityToolkit.WinUI.Collections" Version="8.0.240109" />
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.HeaderedControls" Version="8.0.240109" />
|
<PackageReference Include="CommunityToolkit.WinUI.Controls.HeaderedControls" Version="8.0.240109" />
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.0.240109" />
|
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.0.240109" />
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.0.240109" />
|
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.240109" />
|
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.240109" />
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.TokenizingTextBox" Version="8.0.240109" />
|
<PackageReference Include="CommunityToolkit.WinUI.Controls.TokenizingTextBox" Version="8.0.240109" />
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.0.240109" />
|
<PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.0.240109" />
|
||||||
@@ -349,11 +347,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\.editorconfig" Link=".editorconfig" />
|
<None Include="..\.editorconfig" Link=".editorconfig" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Page Update="Control\Theme\SegmentedOverride.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
</Page>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Update="Control\Theme\Thickness.xaml">
|
<Page Update="Control\Theme\Thickness.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
d:DataContext="{d:DesignInstance shva:AchievementViewModelSlim}"
|
d:DataContext="{d:DesignInstance shva:AchievementViewModelSlim}"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
BorderBrush="{x:Null}"
|
|
||||||
Command="{Binding NavigateCommand}"
|
Command="{Binding NavigateCommand}"
|
||||||
Style="{ThemeResource DefaultButtonStyle}"
|
Style="{ThemeResource DefaultButtonStyle}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
@@ -52,12 +51,11 @@
|
|||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Text="{Binding DisplayName}"/>
|
Text="{Binding DisplayName}"/>
|
||||||
<Viewbox Grid.Row="1" StretchDirection="DownOnly">
|
<TextBlock
|
||||||
<TextBlock
|
Grid.Row="1"
|
||||||
Margin="0,4,0,0"
|
Margin="0,4,0,0"
|
||||||
Style="{StaticResource TitleTextBlockStyle}"
|
Style="{StaticResource TitleTextBlockStyle}"
|
||||||
Text="{Binding FinishDescription}"/>
|
Text="{Binding FinishDescription}"/>
|
||||||
</Viewbox>
|
|
||||||
<ItemsControl
|
<ItemsControl
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
ItemTemplate="{StaticResource AchievementTempate}"
|
ItemTemplate="{StaticResource AchievementTempate}"
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
d:DataContext="{d:DesignInstance shvd:DailyNoteViewModelSlim}"
|
d:DataContext="{d:DesignInstance shvd:DailyNoteViewModelSlim}"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
BorderBrush="{x:Null}"
|
|
||||||
Command="{Binding NavigateCommand}"
|
Command="{Binding NavigateCommand}"
|
||||||
Style="{ThemeResource DefaultButtonStyle}"
|
Style="{ThemeResource DefaultButtonStyle}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
d:DataContext="{d:DesignInstance shvg:GachaLogViewModelSlim}"
|
d:DataContext="{d:DesignInstance shvg:GachaLogViewModelSlim}"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
BorderBrush="{x:Null}"
|
|
||||||
Command="{Binding NavigateCommand}"
|
Command="{Binding NavigateCommand}"
|
||||||
Style="{ThemeResource DefaultButtonStyle}"
|
Style="{ThemeResource DefaultButtonStyle}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
VerticalContentAlignment="Stretch"
|
VerticalContentAlignment="Stretch"
|
||||||
d:DataContext="{d:DesignInstance shvg:LaunchGameViewModelSlim}"
|
d:DataContext="{d:DesignInstance shvg:LaunchGameViewModelSlim}"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
BorderBrush="{x:Null}"
|
|
||||||
Command="{Binding LaunchCommand}"
|
Command="{Binding LaunchCommand}"
|
||||||
Style="{ThemeResource DefaultButtonStyle}"
|
Style="{ThemeResource DefaultButtonStyle}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|||||||
@@ -22,37 +22,35 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled">
|
<cwc:SettingsExpander
|
||||||
<cwc:SettingsExpander
|
Header="{shcm:ResourceString Name=ViewControlBaseValueSliderLevel}"
|
||||||
Header="{shcm:ResourceString Name=ViewControlBaseValueSliderLevel}"
|
IsExpanded="True"
|
||||||
IsExpanded="True"
|
ItemTemplate="{StaticResource BaseValueTemplate}"
|
||||||
ItemTemplate="{StaticResource BaseValueTemplate}"
|
ItemsSource="{x:Bind BaseValueInfo.Values, Mode=OneWay}">
|
||||||
ItemsSource="{x:Bind BaseValueInfo.Values, Mode=OneWay}">
|
<StackPanel
|
||||||
<StackPanel
|
Height="16"
|
||||||
Height="16"
|
Margin="8,0,0,0"
|
||||||
Margin="8,0,0,0"
|
Orientation="Horizontal"
|
||||||
Orientation="Horizontal"
|
Spacing="16">
|
||||||
Spacing="16">
|
<TextBlock VerticalAlignment="Center" Text="{x:Bind BaseValueInfo.CurrentLevelFormatted, Mode=OneWay}"/>
|
||||||
<TextBlock VerticalAlignment="Center" Text="{x:Bind BaseValueInfo.CurrentLevelFormatted, Mode=OneWay}"/>
|
<CheckBox
|
||||||
<CheckBox
|
MinWidth="0"
|
||||||
MinWidth="0"
|
Margin="0,-8,0,-8"
|
||||||
Margin="0,-8,0,-8"
|
Padding="8,0,0,0"
|
||||||
Padding="8,0,0,0"
|
VerticalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalContentAlignment="Center"
|
||||||
VerticalContentAlignment="Center"
|
Content="{shcm:ResourceString Name=ViewControlBaseValueSliderPromoted}"
|
||||||
Content="{shcm:ResourceString Name=ViewControlBaseValueSliderPromoted}"
|
IsChecked="{x:Bind BaseValueInfo.Promoted, Mode=TwoWay}"
|
||||||
IsChecked="{x:Bind BaseValueInfo.Promoted, Mode=TwoWay}"
|
Visibility="{x:Bind IsPromoteVisible, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||||
Visibility="{x:Bind IsPromoteVisible, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
<Slider
|
||||||
<Slider
|
MinWidth="240"
|
||||||
MinWidth="240"
|
Margin="0,-16,0,-16"
|
||||||
Margin="0,-16,0,-16"
|
VerticalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
Maximum="{x:Bind BaseValueInfo.MaxLevel, Mode=OneWay}"
|
||||||
Maximum="{x:Bind BaseValueInfo.MaxLevel, Mode=OneWay}"
|
Minimum="1"
|
||||||
Minimum="1"
|
StepFrequency="1"
|
||||||
StepFrequency="1"
|
Value="{x:Bind BaseValueInfo.CurrentLevel, Mode=TwoWay}"/>
|
||||||
Value="{x:Bind BaseValueInfo.CurrentLevel, Mode=TwoWay}"/>
|
</StackPanel>
|
||||||
</StackPanel>
|
</cwc:SettingsExpander>
|
||||||
</cwc:SettingsExpander>
|
|
||||||
</ScrollViewer>
|
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -26,19 +26,17 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled">
|
<cwc:SettingsExpander
|
||||||
<cwc:SettingsExpander
|
Header="{shcm:ResourceString Name=ViewControlBaseValueSliderLevel}"
|
||||||
Header="{shcm:ResourceString Name=ViewControlBaseValueSliderLevel}"
|
IsExpanded="True"
|
||||||
IsExpanded="True"
|
ItemTemplate="{StaticResource ParameterDescriptionTemplate}"
|
||||||
ItemTemplate="{StaticResource ParameterDescriptionTemplate}"
|
ItemsSource="{x:Bind SelectedItem.Parameters, Mode=OneWay}">
|
||||||
ItemsSource="{x:Bind SelectedItem.Parameters, Mode=OneWay}">
|
<shc:SizeRestrictedContentControl Margin="0,-8">
|
||||||
<shc:SizeRestrictedContentControl Margin="0,-8">
|
<ComboBox
|
||||||
<ComboBox
|
x:Name="LevelSelectorComboBox"
|
||||||
x:Name="LevelSelectorComboBox"
|
DisplayMemberPath="Level"
|
||||||
DisplayMemberPath="Level"
|
SelectionChanged="OnLevelSelectorComboBoxSelectionChanged"
|
||||||
SelectionChanged="OnLevelSelectorComboBoxSelectionChanged"
|
Style="{StaticResource SettingsContentComboBoxStyle}"/>
|
||||||
Style="{StaticResource SettingsContentComboBoxStyle}"/>
|
</shc:SizeRestrictedContentControl>
|
||||||
</shc:SizeRestrictedContentControl>
|
</cwc:SettingsExpander>
|
||||||
</cwc:SettingsExpander>
|
|
||||||
</ScrollViewer>
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:shch="using:Snap.Hutao.Control.Helper"
|
xmlns:shch="using:Snap.Hutao.Control.Helper"
|
||||||
xmlns:shci="using:Snap.Hutao.Control.Image"
|
xmlns:shci="using:Snap.Hutao.Control.Image"
|
||||||
|
xmlns:shcs="using:Snap.Hutao.Control.Segmented"
|
||||||
xmlns:shmmc="using:Snap.Hutao.Model.Metadata.Converter"
|
xmlns:shmmc="using:Snap.Hutao.Model.Metadata.Converter"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
@@ -25,11 +26,11 @@
|
|||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<cwc:Segmented
|
<shcs:Segmented
|
||||||
x:Name="SkillSelectorSegmented"
|
x:Name="SkillSelectorSegmented"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
SelectionChanged="OnSkillSelectorSegmentedSelectionChanged"
|
ItemTemplate="{StaticResource SkillHeaderTemplate}"
|
||||||
ItemTemplate="{StaticResource SkillHeaderTemplate}"/>
|
SelectionChanged="OnSkillSelectorSegmentedSelectionChanged"/>
|
||||||
<ContentPresenter Content="{x:Bind Selected, Mode=OneWay}" ContentTemplate="{x:Bind ItemTemplate}"/>
|
<ContentPresenter Content="{x:Bind Selected, Mode=OneWay}" ContentTemplate="{x:Bind ItemTemplate}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using CommunityToolkit.WinUI.Controls;
|
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Snap.Hutao.Control.Segmented;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
namespace Snap.Hutao.View.Control;
|
namespace Snap.Hutao.View.Control;
|
||||||
|
|||||||
@@ -21,12 +21,6 @@
|
|||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<shvconv:BoolToGridLengthConverter x:Key="BoolToGridLengthConverter"/>
|
|
||||||
<shvconv:BoolToGridLengthConverter
|
|
||||||
x:Key="BoolToGridLengthSpacingConverter"
|
|
||||||
FalseValue="0"
|
|
||||||
TrueValue="4"/>
|
|
||||||
|
|
||||||
<shvconv:Int32ToGradientColorConverter x:Key="Int32ToGradientColorConverter" MaximumValue="{Binding GuaranteeOrangeThreshold}"/>
|
<shvconv:Int32ToGradientColorConverter x:Key="Int32ToGradientColorConverter" MaximumValue="{Binding GuaranteeOrangeThreshold}"/>
|
||||||
|
|
||||||
<DataTemplate x:Key="OrangeListTemplate" d:DataType="shvg:SummaryItem">
|
<DataTemplate x:Key="OrangeListTemplate" d:DataType="shvg:SummaryItem">
|
||||||
@@ -232,12 +226,10 @@
|
|||||||
Padding="0,12"
|
Padding="0,12"
|
||||||
Value="{x:Bind StatisticsSegmented.SelectedIndex, Mode=OneWay}">
|
Value="{x:Bind StatisticsSegmented.SelectedIndex, Mode=OneWay}">
|
||||||
<cwcont:Case Value="{shcm:Int32 Value=0}">
|
<cwcont:Case Value="{shcm:Int32 Value=0}">
|
||||||
<Grid>
|
<Grid ColumnSpacing="2">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition Width="{x:Bind ShowUpPull, Converter={StaticResource BoolToGridLengthSpacingConverter}}"/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition Width="{x:Bind ShowUpPull, Converter={StaticResource BoolToGridLengthConverter}}"/>
|
|
||||||
<ColumnDefinition Width="4"/>
|
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Border Grid.Column="0" Style="{ThemeResource BorderCardStyle}">
|
<Border Grid.Column="0" Style="{ThemeResource BorderCardStyle}">
|
||||||
@@ -251,7 +243,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Viewbox>
|
</Viewbox>
|
||||||
</Border>
|
</Border>
|
||||||
<Border Grid.Column="2" Style="{ThemeResource BorderCardStyle}">
|
<Border Grid.Column="1" Style="{ThemeResource BorderCardStyle}">
|
||||||
<Viewbox Margin="8,0" StretchDirection="DownOnly">
|
<Viewbox Margin="8,0" StretchDirection="DownOnly">
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
@@ -274,7 +266,7 @@
|
|||||||
</Viewbox>
|
</Viewbox>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Grid Grid.Column="4" RowSpacing="2">
|
<Grid Grid.Column="2" RowSpacing="2">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<cwc:Segmented
|
<shcs:Segmented
|
||||||
x:Class="Snap.Hutao.View.Control.StatisticsSegmented"
|
x:Class="Snap.Hutao.View.Control.StatisticsSegmented"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||||
|
xmlns:shcs="using:Snap.Hutao.Control.Segmented"
|
||||||
Style="{StaticResource DefaultSegmentedStyle}"
|
Style="{StaticResource DefaultSegmentedStyle}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<cwc:SegmentedItem Content="{shcm:ResourceString Name=ViewControlStatisticsSegmentedItemContentStatistics}" Icon="{shcm:FontIcon Glyph=}"/>
|
<shcs:SegmentedItem Content="{shcm:ResourceString Name=ViewControlStatisticsSegmentedItemContentStatistics}" Icon="{shcm:FontIcon Glyph=}"/>
|
||||||
<cwc:SegmentedItem Content="{shcm:ResourceString Name=ViewControlStatisticsSegmentedItemContentProportion}" Icon="{shcm:FontIcon Glyph=}"/>
|
<shcs:SegmentedItem Content="{shcm:ResourceString Name=ViewControlStatisticsSegmentedItemContentProportion}" Icon="{shcm:FontIcon Glyph=}"/>
|
||||||
</cwc:Segmented>
|
</shcs:Segmented>
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using CommunityToolkit.WinUI.Controls;
|
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Snap.Hutao.Control.Segmented;
|
||||||
|
|
||||||
namespace Snap.Hutao.View.Control;
|
namespace Snap.Hutao.View.Control;
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using CommunityToolkit.WinUI.Converters;
|
|
||||||
using Microsoft.UI.Xaml;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.View.Converter;
|
|
||||||
|
|
||||||
internal sealed class BoolToGridLengthConverter : BoolToObjectConverter
|
|
||||||
{
|
|
||||||
public BoolToGridLengthConverter()
|
|
||||||
{
|
|
||||||
TrueValue = new GridLength(1D, GridUnitType.Star);
|
|
||||||
FalseValue = new GridLength(0D);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
|
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
|
||||||
xmlns:shcb="using:Snap.Hutao.Control.Behavior"
|
xmlns:shcb="using:Snap.Hutao.Control.Behavior"
|
||||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||||
|
xmlns:shcs="using:Snap.Hutao.Control.Segmented"
|
||||||
xmlns:shvg="using:Snap.Hutao.ViewModel.Guide"
|
xmlns:shvg="using:Snap.Hutao.ViewModel.Guide"
|
||||||
d:DataContext="{d:DesignInstance shvg:GuideViewModel}"
|
d:DataContext="{d:DesignInstance shvg:GuideViewModel}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
@@ -188,15 +189,15 @@
|
|||||||
</cwc:SwitchPresenter>
|
</cwc:SwitchPresenter>
|
||||||
<Grid Grid.Row="1">
|
<Grid Grid.Row="1">
|
||||||
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
|
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
|
||||||
<cwc:Segmented
|
<shcs:Segmented
|
||||||
Margin="16"
|
Margin="16"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
SelectedIndex="{Binding State, Mode=TwoWay}">
|
SelectedIndex="{Binding State, Mode=TwoWay}">
|
||||||
<cwc:SegmentedItem Content="{shcm:ResourceString Name=ViewGuideStepLanguage}" Icon="{shcm:FontIcon Glyph=}"/>
|
<shcs:SegmentedItem Content="{shcm:ResourceString Name=ViewGuideStepLanguage}" Icon="{shcm:FontIcon Glyph=}"/>
|
||||||
<cwc:SegmentedItem Content="{shcm:ResourceString Name=ViewGuideStepDocument}" Icon="{shcm:FontIcon Glyph=}"/>
|
<shcs:SegmentedItem Content="{shcm:ResourceString Name=ViewGuideStepDocument}" Icon="{shcm:FontIcon Glyph=}"/>
|
||||||
<cwc:SegmentedItem Content="{shcm:ResourceString Name=ViewGuideStepEnvironment}" Icon="{shcm:FontIcon Glyph=}"/>
|
<shcs:SegmentedItem Content="{shcm:ResourceString Name=ViewGuideStepEnvironment}" Icon="{shcm:FontIcon Glyph=}"/>
|
||||||
<cwc:SegmentedItem Content="{shcm:ResourceString Name=ViewGuideStepStaticResource}" Icon="{shcm:FontIcon Glyph=}"/>
|
<shcs:SegmentedItem Content="{shcm:ResourceString Name=ViewGuideStepStaticResource}" Icon="{shcm:FontIcon Glyph=}"/>
|
||||||
</cwc:Segmented>
|
</shcs:Segmented>
|
||||||
<Button
|
<Button
|
||||||
Command="{Binding NextOrCompleteCommand}"
|
Command="{Binding NextOrCompleteCommand}"
|
||||||
Content="{Binding NextOrCompleteButtonText}"
|
Content="{Binding NextOrCompleteButtonText}"
|
||||||
|
|||||||
@@ -212,7 +212,7 @@
|
|||||||
LocalSettingKeySuffixForCurrent="AchievementPage.AchievementGoals"/>
|
LocalSettingKeySuffixForCurrent="AchievementPage.AchievementGoals"/>
|
||||||
<Viewbox
|
<Viewbox
|
||||||
Height="32"
|
Height="32"
|
||||||
MaxWidth="190"
|
MaxWidth="192"
|
||||||
Margin="8,0,0,0"
|
Margin="8,0,0,0"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Stretch="Uniform"
|
Stretch="Uniform"
|
||||||
|
|||||||
@@ -43,7 +43,6 @@
|
|||||||
cw:VisualExtensions.NormalizedCenterPoint="0.5">
|
cw:VisualExtensions.NormalizedCenterPoint="0.5">
|
||||||
<cww:ConstrainedBox AspectRatio="1080:390" CornerRadius="{ThemeResource ControlCornerRadiusTop}">
|
<cww:ConstrainedBox AspectRatio="1080:390" CornerRadius="{ThemeResource ControlCornerRadiusTop}">
|
||||||
<shci:CachedImage
|
<shci:CachedImage
|
||||||
Margin="-1"
|
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
PlaceholderMargin="16"
|
PlaceholderMargin="16"
|
||||||
PlaceholderSource="{StaticResource UI_EmotionIcon271}"
|
PlaceholderSource="{StaticResource UI_EmotionIcon271}"
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
xmlns:shcb="using:Snap.Hutao.Control.Behavior"
|
xmlns:shcb="using:Snap.Hutao.Control.Behavior"
|
||||||
xmlns:shci="using:Snap.Hutao.Control.Image"
|
xmlns:shci="using:Snap.Hutao.Control.Image"
|
||||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||||
xmlns:shcp="using:Snap.Hutao.Control.Panel"
|
|
||||||
xmlns:shvc="using:Snap.Hutao.View.Control"
|
xmlns:shvc="using:Snap.Hutao.View.Control"
|
||||||
xmlns:shvg="using:Snap.Hutao.ViewModel.GachaLog"
|
xmlns:shvg="using:Snap.Hutao.ViewModel.GachaLog"
|
||||||
d:DataContext="{d:DesignInstance shvg:GachaLogViewModel}"
|
d:DataContext="{d:DesignInstance shvg:GachaLogViewModel}"
|
||||||
@@ -286,34 +285,26 @@
|
|||||||
</CommandBar>
|
</CommandBar>
|
||||||
</Pivot.RightHeader>
|
</Pivot.RightHeader>
|
||||||
<PivotItem Header="{shcm:ResourceString Name=ViewPageGahcaLogPivotOverview}">
|
<PivotItem Header="{shcm:ResourceString Name=ViewPageGahcaLogPivotOverview}">
|
||||||
<ScrollViewer
|
<Grid Margin="0,0,16,0">
|
||||||
Margin="0,0,16,0"
|
<Grid.ColumnDefinitions>
|
||||||
HorizontalScrollBarVisibility="Auto"
|
<ColumnDefinition/>
|
||||||
HorizontalScrollMode="Enabled"
|
<ColumnDefinition/>
|
||||||
VerticalScrollMode="Disabled">
|
<ColumnDefinition/>
|
||||||
<shcp:HorizontalEqualPanel MinItemWidth="320">
|
</Grid.ColumnDefinitions>
|
||||||
<shvc:StatisticsCard Margin="16,16,0,16" DataContext="{Binding Statistics.AvatarWish}"/>
|
<shvc:StatisticsCard
|
||||||
<shvc:StatisticsCard Margin="16,16,0,16" DataContext="{Binding Statistics.WeaponWish}"/>
|
Grid.Column="0"
|
||||||
<shvc:StatisticsCard
|
Margin="16,16,0,16"
|
||||||
Margin="16,16,0,16"
|
DataContext="{Binding Statistics.AvatarWish}"/>
|
||||||
DataContext="{Binding Statistics.StandardWish}"
|
<shvc:StatisticsCard
|
||||||
ShowUpPull="False"/>
|
Grid.Column="1"
|
||||||
<shvc:StatisticsCard
|
Margin="16,16,0,16"
|
||||||
Margin="16,16,0,16"
|
DataContext="{Binding Statistics.WeaponWish}"/>
|
||||||
DataContext="{Binding Statistics.ChronicledWish}"
|
<shvc:StatisticsCard
|
||||||
ShowUpPull="False"/>
|
Grid.Column="2"
|
||||||
</shcp:HorizontalEqualPanel>
|
Margin="16,16,0,16"
|
||||||
<!--<Grid>
|
DataContext="{Binding Statistics.StandardWish}"
|
||||||
<Grid.ColumnDefinitions>
|
ShowUpPull="False"/>
|
||||||
<ColumnDefinition Width="*" MinWidth="240"/>
|
</Grid>
|
||||||
<ColumnDefinition Width="*" MinWidth="240"/>
|
|
||||||
<ColumnDefinition Width="*" MinWidth="240"/>
|
|
||||||
<ColumnDefinition Width="*" MinWidth="240"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
</Grid>-->
|
|
||||||
</ScrollViewer>
|
|
||||||
|
|
||||||
</PivotItem>
|
</PivotItem>
|
||||||
<PivotItem Header="{shcm:ResourceString Name=ViewPageGahcaLogPivotHistory}">
|
<PivotItem Header="{shcm:ResourceString Name=ViewPageGahcaLogPivotHistory}">
|
||||||
<Border Margin="16" cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
<Border Margin="16" cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
||||||
@@ -388,6 +379,7 @@
|
|||||||
</SplitView>
|
</SplitView>
|
||||||
</Border>
|
</Border>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
</PivotItem>
|
</PivotItem>
|
||||||
<PivotItem Header="{shcm:ResourceString Name=ViewPageGahcaLogPivotAvatar}">
|
<PivotItem Header="{shcm:ResourceString Name=ViewPageGahcaLogPivotAvatar}">
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
@@ -495,6 +487,7 @@
|
|||||||
<shvc:HutaoStatisticsCard Grid.Column="2" DataContext="{Binding HutaoCloudStatisticsViewModel.Statistics.WeaponEvent}"/>
|
<shvc:HutaoStatisticsCard Grid.Column="2" DataContext="{Binding HutaoCloudStatisticsViewModel.Statistics.WeaponEvent}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</PivotItem>
|
</PivotItem>
|
||||||
</Pivot>
|
</Pivot>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -314,17 +314,6 @@
|
|||||||
SelectedItem="{Binding SelectedBackdropType, Mode=TwoWay}"/>
|
SelectedItem="{Binding SelectedBackdropType, Mode=TwoWay}"/>
|
||||||
</shc:SizeRestrictedContentControl>
|
</shc:SizeRestrictedContentControl>
|
||||||
</cwc:SettingsCard>
|
</cwc:SettingsCard>
|
||||||
<cwc:SettingsCard
|
|
||||||
Description="{shcm:ResourceString Name=ViewPageSettingThemeDescription}"
|
|
||||||
Header="{shcm:ResourceString Name=ViewPageSettingThemeHeader}"
|
|
||||||
HeaderIcon="{shcm:FontIcon Glyph=}">
|
|
||||||
<shc:SizeRestrictedContentControl>
|
|
||||||
<ComboBox
|
|
||||||
DisplayMemberPath="Name"
|
|
||||||
ItemsSource="{Binding AppOptions.LazyElementThemes.Value}"
|
|
||||||
SelectedItem="{Binding SelectedElementTheme, Mode=TwoWay}"/>
|
|
||||||
</shc:SizeRestrictedContentControl>
|
|
||||||
</cwc:SettingsCard>
|
|
||||||
<cwc:SettingsExpander
|
<cwc:SettingsExpander
|
||||||
Description="{shcm:ResourceString Name=ViewPageSettingBackgroundImageDescription}"
|
Description="{shcm:ResourceString Name=ViewPageSettingBackgroundImageDescription}"
|
||||||
Header="{shcm:ResourceString Name=ViewPageSettingBackgroundImageHeader}"
|
Header="{shcm:ResourceString Name=ViewPageSettingBackgroundImageHeader}"
|
||||||
@@ -348,7 +337,6 @@
|
|||||||
</mxic:EventTriggerBehavior>
|
</mxic:EventTriggerBehavior>
|
||||||
</mxi:Interaction.Behaviors>
|
</mxi:Interaction.Behaviors>
|
||||||
</cwc:SettingsCard>
|
</cwc:SettingsCard>
|
||||||
<cwc:SettingsCard Header="{shcm:ResourceString Name=ViewPageSettingBackgroundImageLocalFolderCopyrightHeader}" Visibility="{Binding BackgroundImageOptions.Wallpaper, Converter={StaticResource EmptyObjectToBoolRevertConverter}}"/>
|
|
||||||
</cwc:SettingsExpander.Items>
|
</cwc:SettingsExpander.Items>
|
||||||
</cwc:SettingsExpander>
|
</cwc:SettingsExpander>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
xmlns:shci="using:Snap.Hutao.Control.Image"
|
xmlns:shci="using:Snap.Hutao.Control.Image"
|
||||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||||
xmlns:shcp="using:Snap.Hutao.Control.Panel"
|
xmlns:shcp="using:Snap.Hutao.Control.Panel"
|
||||||
|
xmlns:shcs="using:Snap.Hutao.Control.Segmented"
|
||||||
xmlns:shct="using:Snap.Hutao.Control.Text"
|
xmlns:shct="using:Snap.Hutao.Control.Text"
|
||||||
xmlns:shvcom="using:Snap.Hutao.ViewModel.Complex"
|
xmlns:shvcom="using:Snap.Hutao.ViewModel.Complex"
|
||||||
xmlns:shvcon="using:Snap.Hutao.View.Control"
|
xmlns:shvcon="using:Snap.Hutao.View.Control"
|
||||||
@@ -628,7 +629,7 @@
|
|||||||
<ColumnDefinition Width="auto"/>
|
<ColumnDefinition Width="auto"/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<cwc:Segmented
|
<shcs:Segmented
|
||||||
DisplayMemberPath="Floor"
|
DisplayMemberPath="Floor"
|
||||||
ItemsSource="{Binding AvatarUsageRanks}"
|
ItemsSource="{Binding AvatarUsageRanks}"
|
||||||
SelectedItem="{Binding SelectedAvatarUsageRank, Mode=TwoWay}"/>
|
SelectedItem="{Binding SelectedAvatarUsageRank, Mode=TwoWay}"/>
|
||||||
@@ -662,7 +663,7 @@
|
|||||||
<ColumnDefinition Width="auto"/>
|
<ColumnDefinition Width="auto"/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<cwc:Segmented
|
<shcs:Segmented
|
||||||
DisplayMemberPath="Floor"
|
DisplayMemberPath="Floor"
|
||||||
ItemsSource="{Binding AvatarAppearanceRanks}"
|
ItemsSource="{Binding AvatarAppearanceRanks}"
|
||||||
SelectedItem="{Binding SelectedAvatarAppearanceRank, Mode=TwoWay}"/>
|
SelectedItem="{Binding SelectedAvatarAppearanceRank, Mode=TwoWay}"/>
|
||||||
@@ -691,7 +692,7 @@
|
|||||||
<RowDefinition Height="auto"/>
|
<RowDefinition Height="auto"/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<cwc:Segmented
|
<shcs:Segmented
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Margin="16,16,0,16"
|
Margin="16,16,0,16"
|
||||||
DisplayMemberPath="Floor"
|
DisplayMemberPath="Floor"
|
||||||
|
|||||||
@@ -203,23 +203,19 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</cwc:Case>
|
</cwc:Case>
|
||||||
<cwc:Case Value="Grid">
|
<cwc:Case Value="Grid">
|
||||||
<Border Margin="16,0,16,16" cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
<GridView
|
||||||
<Border Style="{ThemeResource AcrylicBorderCardStyle}">
|
Padding="16,16,4,4"
|
||||||
<GridView
|
HorizontalAlignment="Stretch"
|
||||||
Padding="16,16,4,4"
|
HorizontalContentAlignment="Left"
|
||||||
HorizontalAlignment="Stretch"
|
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
|
||||||
HorizontalContentAlignment="Left"
|
ItemTemplate="{StaticResource MonsterGridTemplate}"
|
||||||
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
|
ItemsSource="{Binding Monsters}"
|
||||||
ItemTemplate="{StaticResource MonsterGridTemplate}"
|
SelectedItem="{Binding Selected, Mode=TwoWay}"
|
||||||
ItemsSource="{Binding Monsters}"
|
SelectionMode="Single">
|
||||||
SelectedItem="{Binding Selected, Mode=TwoWay}"
|
<mxi:Interaction.Behaviors>
|
||||||
SelectionMode="Single">
|
<shcb:SelectedItemInViewBehavior/>
|
||||||
<mxi:Interaction.Behaviors>
|
</mxi:Interaction.Behaviors>
|
||||||
<shcb:SelectedItemInViewBehavior/>
|
</GridView>
|
||||||
</mxi:Interaction.Behaviors>
|
|
||||||
</GridView>
|
|
||||||
</Border>
|
|
||||||
</Border>
|
|
||||||
</cwc:Case>
|
</cwc:Case>
|
||||||
</cwc:SwitchPresenter>
|
</cwc:SwitchPresenter>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Microsoft.Extensions.Primitives;
|
|||||||
using Snap.Hutao.Model.Metadata.Avatar;
|
using Snap.Hutao.Model.Metadata.Avatar;
|
||||||
using Snap.Hutao.Model.Primitive;
|
using Snap.Hutao.Model.Primitive;
|
||||||
using Snap.Hutao.Web.Hutao.SpiralAbyss;
|
using Snap.Hutao.Web.Hutao.SpiralAbyss;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
namespace Snap.Hutao.ViewModel.Complex;
|
namespace Snap.Hutao.ViewModel.Complex;
|
||||||
|
|||||||
@@ -104,14 +104,10 @@ internal sealed partial class GachaLogViewModel : Abstraction.ViewModel
|
|||||||
ArgumentNullException.ThrowIfNull(gachaLogService.ArchiveCollection);
|
ArgumentNullException.ThrowIfNull(gachaLogService.ArchiveCollection);
|
||||||
ObservableCollection<GachaArchive> archives = gachaLogService.ArchiveCollection;
|
ObservableCollection<GachaArchive> archives = gachaLogService.ArchiveCollection;
|
||||||
|
|
||||||
using (await EnterCriticalExecutionAsync().ConfigureAwait(false))
|
await taskContext.SwitchToMainThreadAsync();
|
||||||
{
|
Archives = archives;
|
||||||
await taskContext.SwitchToMainThreadAsync();
|
HutaoCloudViewModel.RetrieveCommand = RetrieveFromCloudCommand;
|
||||||
Archives = archives;
|
await SetSelectedArchiveAndUpdateStatisticsAsync(Archives.SelectedOrDefault(), true).ConfigureAwait(false);
|
||||||
HutaoCloudViewModel.RetrieveCommand = RetrieveFromCloudCommand;
|
|
||||||
await SetSelectedArchiveAndUpdateStatisticsAsync(Archives.SelectedOrDefault(), true).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,15 +21,7 @@ internal abstract class Wish
|
|||||||
|
|
||||||
public string TimeSpanFormatted
|
public string TimeSpanFormatted
|
||||||
{
|
{
|
||||||
get
|
get => $"{From:yyyy.MM.dd} - {To:yyyy.MM.dd}";
|
||||||
{
|
|
||||||
if (From == DateTimeOffset.MaxValue && To == DateTimeOffset.MinValue)
|
|
||||||
{
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $"{From:yyyy.MM.dd} - {To:yyyy.MM.dd}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using Microsoft.UI.Xaml;
|
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.Windows.AppLifecycle;
|
using Microsoft.Windows.AppLifecycle;
|
||||||
using Snap.Hutao.Core;
|
using Snap.Hutao.Core;
|
||||||
@@ -59,7 +58,6 @@ internal sealed partial class SettingViewModel : Abstraction.ViewModel
|
|||||||
private readonly IMessenger messenger;
|
private readonly IMessenger messenger;
|
||||||
|
|
||||||
private NameValue<BackdropType>? selectedBackdropType;
|
private NameValue<BackdropType>? selectedBackdropType;
|
||||||
private NameValue<ElementTheme>? selectedElementTheme;
|
|
||||||
private NameValue<BackgroundImageType>? selectedBackgroundImageType;
|
private NameValue<BackgroundImageType>? selectedBackgroundImageType;
|
||||||
private NameValue<CultureInfo>? selectedCulture;
|
private NameValue<CultureInfo>? selectedCulture;
|
||||||
private NameValue<Region>? selectedRegion;
|
private NameValue<Region>? selectedRegion;
|
||||||
@@ -96,18 +94,6 @@ internal sealed partial class SettingViewModel : Abstraction.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public NameValue<ElementTheme>? SelectedElementTheme
|
|
||||||
{
|
|
||||||
get => selectedElementTheme ??= AppOptions.LazyElementThemes.Value.Single(t => t.Value == AppOptions.ElementTheme);
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (SetProperty(ref selectedElementTheme, value) && value is not null)
|
|
||||||
{
|
|
||||||
AppOptions.ElementTheme = value.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public NameValue<BackgroundImageType>? SelectedBackgroundImageType
|
public NameValue<BackgroundImageType>? SelectedBackgroundImageType
|
||||||
{
|
{
|
||||||
get => selectedBackgroundImageType ??= AppOptions.BackgroundImageTypes.Single(t => t.Value == AppOptions.BackgroundImageType);
|
get => selectedBackgroundImageType ??= AppOptions.BackgroundImageTypes.Single(t => t.Value == AppOptions.BackgroundImageType);
|
||||||
|
|||||||
@@ -92,49 +92,39 @@ internal sealed partial class WikiAvatarViewModel : Abstraction.ViewModel
|
|||||||
|
|
||||||
protected override async ValueTask<bool> InitializeUIAsync()
|
protected override async ValueTask<bool> InitializeUIAsync()
|
||||||
{
|
{
|
||||||
if (await metadataService.InitializeAsync().ConfigureAwait(false))
|
if (!await metadataService.InitializeAsync().ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
try
|
return false;
|
||||||
{
|
|
||||||
levelAvatarCurveMap = await metadataService.GetLevelToAvatarCurveMapAsync().ConfigureAwait(false);
|
|
||||||
promotes = await metadataService.GetAvatarPromoteListAsync().ConfigureAwait(false);
|
|
||||||
|
|
||||||
Dictionary<MaterialId, Material> idMaterialMap = await metadataService.GetIdToMaterialMapAsync().ConfigureAwait(false);
|
|
||||||
List<Avatar> avatars = await metadataService.GetAvatarListAsync().ConfigureAwait(false);
|
|
||||||
IOrderedEnumerable<Avatar> sorted = avatars
|
|
||||||
.OrderByDescending(avatar => avatar.BeginTime)
|
|
||||||
.ThenByDescending(avatar => avatar.Sort);
|
|
||||||
List<Avatar> list = [.. sorted];
|
|
||||||
|
|
||||||
await CombineComplexDataAsync(list, idMaterialMap).ConfigureAwait(false);
|
|
||||||
|
|
||||||
using (await EnterCriticalExecutionAsync().ConfigureAwait(false))
|
|
||||||
{
|
|
||||||
await taskContext.SwitchToMainThreadAsync();
|
|
||||||
Avatars = new(list, true);
|
|
||||||
Selected = Avatars.View.ElementAtOrDefault(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
FilterTokens = [];
|
|
||||||
|
|
||||||
availableTokens = FrozenDictionary.ToFrozenDictionary(
|
|
||||||
[
|
|
||||||
.. avatars.Select(avatar => KeyValuePair.Create(avatar.Name, new SearchToken(SearchTokenKind.Avatar, avatar.Name, sideIconUri: AvatarSideIconConverter.IconNameToUri(avatar.SideIcon)))),
|
|
||||||
.. IntrinsicFrozen.AssociationTypes.Select(assoc => KeyValuePair.Create(assoc, new SearchToken(SearchTokenKind.AssociationType, assoc, iconUri: AssociationTypeIconConverter.AssociationTypeNameToIconUri(assoc)))),
|
|
||||||
.. IntrinsicFrozen.BodyTypes.Select(b => KeyValuePair.Create(b, new SearchToken(SearchTokenKind.BodyType, b))),
|
|
||||||
.. IntrinsicFrozen.ElementNames.Select(e => KeyValuePair.Create(e, new SearchToken(SearchTokenKind.ElementName, e, iconUri: ElementNameIconConverter.ElementNameToIconUri(e)))),
|
|
||||||
.. IntrinsicFrozen.ItemQualities.Select(i => KeyValuePair.Create(i, new SearchToken(SearchTokenKind.ItemQuality, i, quality: QualityColorConverter.QualityNameToColor(i)))),
|
|
||||||
.. IntrinsicFrozen.WeaponTypes.Select(w => KeyValuePair.Create(w, new SearchToken(SearchTokenKind.WeaponType, w, iconUri: WeaponTypeIconConverter.WeaponTypeNameToIconUri(w)))),
|
|
||||||
]);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (OperationCanceledException)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
levelAvatarCurveMap = await metadataService.GetLevelToAvatarCurveMapAsync().ConfigureAwait(false);
|
||||||
|
promotes = await metadataService.GetAvatarPromoteListAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
|
Dictionary<MaterialId, Material> idMaterialMap = await metadataService.GetIdToMaterialMapAsync().ConfigureAwait(false);
|
||||||
|
List<Avatar> avatars = await metadataService.GetAvatarListAsync().ConfigureAwait(false);
|
||||||
|
IOrderedEnumerable<Avatar> sorted = avatars
|
||||||
|
.OrderByDescending(avatar => avatar.BeginTime)
|
||||||
|
.ThenByDescending(avatar => avatar.Sort);
|
||||||
|
List<Avatar> list = [.. sorted];
|
||||||
|
|
||||||
|
await CombineComplexDataAsync(list, idMaterialMap).ConfigureAwait(false);
|
||||||
|
|
||||||
|
await taskContext.SwitchToMainThreadAsync();
|
||||||
|
Avatars = new(list, true);
|
||||||
|
Selected = Avatars.View.ElementAtOrDefault(0);
|
||||||
|
FilterTokens = [];
|
||||||
|
|
||||||
|
availableTokens = FrozenDictionary.ToFrozenDictionary(
|
||||||
|
[
|
||||||
|
.. avatars.Select(avatar => KeyValuePair.Create(avatar.Name, new SearchToken(SearchTokenKind.Avatar, avatar.Name, sideIconUri: AvatarSideIconConverter.IconNameToUri(avatar.SideIcon)))),
|
||||||
|
.. IntrinsicFrozen.AssociationTypes.Select(assoc => KeyValuePair.Create(assoc, new SearchToken(SearchTokenKind.AssociationType, assoc, iconUri: AssociationTypeIconConverter.AssociationTypeNameToIconUri(assoc)))),
|
||||||
|
.. IntrinsicFrozen.BodyTypes.Select(b => KeyValuePair.Create(b, new SearchToken(SearchTokenKind.BodyType, b))),
|
||||||
|
.. IntrinsicFrozen.ElementNames.Select(e => KeyValuePair.Create(e, new SearchToken(SearchTokenKind.ElementName, e, iconUri: ElementNameIconConverter.ElementNameToIconUri(e)))),
|
||||||
|
.. IntrinsicFrozen.ItemQualities.Select(i => KeyValuePair.Create(i, new SearchToken(SearchTokenKind.ItemQuality, i, quality: QualityColorConverter.QualityNameToColor(i)))),
|
||||||
|
.. IntrinsicFrozen.WeaponTypes.Select(w => KeyValuePair.Create(w, new SearchToken(SearchTokenKind.WeaponType, w, iconUri: WeaponTypeIconConverter.WeaponTypeNameToIconUri(w)))),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async ValueTask CombineComplexDataAsync(List<Avatar> avatars, Dictionary<MaterialId, Material> idMaterialMap)
|
private async ValueTask CombineComplexDataAsync(List<Avatar> avatars, Dictionary<MaterialId, Material> idMaterialMap)
|
||||||
|
|||||||
@@ -53,31 +53,21 @@ internal sealed partial class WikiMonsterViewModel : Abstraction.ViewModel
|
|||||||
{
|
{
|
||||||
if (await metadataService.InitializeAsync().ConfigureAwait(false))
|
if (await metadataService.InitializeAsync().ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
try
|
levelMonsterCurveMap = await metadataService.GetLevelToMonsterCurveMapAsync().ConfigureAwait(false);
|
||||||
{
|
|
||||||
levelMonsterCurveMap = await metadataService.GetLevelToMonsterCurveMapAsync().ConfigureAwait(false);
|
List<Monster> monsters = await metadataService.GetMonsterListAsync().ConfigureAwait(false);
|
||||||
|
Dictionary<MaterialId, DisplayItem> idDisplayMap = await metadataService.GetIdToDisplayItemAndMaterialMapAsync().ConfigureAwait(false);
|
||||||
List<Monster> monsters = await metadataService.GetMonsterListAsync().ConfigureAwait(false);
|
foreach (Monster monster in monsters)
|
||||||
Dictionary<MaterialId, DisplayItem> idDisplayMap = await metadataService.GetIdToDisplayItemAndMaterialMapAsync().ConfigureAwait(false);
|
|
||||||
foreach (Monster monster in monsters)
|
|
||||||
{
|
|
||||||
monster.DropsView ??= monster.Drops?.SelectList(i => idDisplayMap.GetValueOrDefault(i, Material.Default));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Monster> ordered = monsters.SortBy(m => m.RelationshipId.Value);
|
|
||||||
|
|
||||||
using (await EnterCriticalExecutionAsync().ConfigureAwait(false))
|
|
||||||
{
|
|
||||||
await taskContext.SwitchToMainThreadAsync();
|
|
||||||
Monsters = new(ordered, true);
|
|
||||||
Selected = Monsters.View.ElementAtOrDefault(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (OperationCanceledException)
|
|
||||||
{
|
{
|
||||||
|
monster.DropsView ??= monster.Drops?.SelectList(i => idDisplayMap.GetValueOrDefault(i, Material.Default));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Monster> ordered = monsters.SortBy(m => m.RelationshipId.Value);
|
||||||
|
await taskContext.SwitchToMainThreadAsync();
|
||||||
|
|
||||||
|
Monsters = new(ordered, true);
|
||||||
|
Selected = Monsters.View.ElementAtOrDefault(0);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -92,42 +92,32 @@ internal sealed partial class WikiWeaponViewModel : Abstraction.ViewModel
|
|||||||
{
|
{
|
||||||
if (await metadataService.InitializeAsync().ConfigureAwait(false))
|
if (await metadataService.InitializeAsync().ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
try
|
levelWeaponCurveMap = await metadataService.GetLevelToWeaponCurveMapAsync().ConfigureAwait(false);
|
||||||
{
|
promotes = await metadataService.GetWeaponPromoteListAsync().ConfigureAwait(false);
|
||||||
levelWeaponCurveMap = await metadataService.GetLevelToWeaponCurveMapAsync().ConfigureAwait(false);
|
Dictionary<MaterialId, Material> idMaterialMap = await metadataService.GetIdToMaterialMapAsync().ConfigureAwait(false);
|
||||||
promotes = await metadataService.GetWeaponPromoteListAsync().ConfigureAwait(false);
|
|
||||||
Dictionary<MaterialId, Material> idMaterialMap = await metadataService.GetIdToMaterialMapAsync().ConfigureAwait(false);
|
|
||||||
|
|
||||||
List<Weapon> weapons = await metadataService.GetWeaponListAsync().ConfigureAwait(false);
|
List<Weapon> weapons = await metadataService.GetWeaponListAsync().ConfigureAwait(false);
|
||||||
IEnumerable<Weapon> sorted = weapons
|
IEnumerable<Weapon> sorted = weapons
|
||||||
.OrderByDescending(weapon => weapon.RankLevel)
|
.OrderByDescending(weapon => weapon.RankLevel)
|
||||||
.ThenBy(weapon => weapon.WeaponType)
|
.ThenBy(weapon => weapon.WeaponType)
|
||||||
.ThenByDescending(weapon => weapon.Id.Value);
|
.ThenByDescending(weapon => weapon.Id.Value);
|
||||||
List<Weapon> list = [.. sorted];
|
List<Weapon> list = [.. sorted];
|
||||||
|
|
||||||
await CombineComplexDataAsync(list, idMaterialMap).ConfigureAwait(false);
|
await CombineComplexDataAsync(list, idMaterialMap).ConfigureAwait(false);
|
||||||
|
|
||||||
using (await EnterCriticalExecutionAsync().ConfigureAwait(false))
|
await taskContext.SwitchToMainThreadAsync();
|
||||||
{
|
|
||||||
await taskContext.SwitchToMainThreadAsync();
|
|
||||||
|
|
||||||
Weapons = new(list, true);
|
Weapons = new(list, true);
|
||||||
Selected = Weapons.View.ElementAtOrDefault(0);
|
Selected = Weapons.View.ElementAtOrDefault(0);
|
||||||
}
|
FilterTokens = [];
|
||||||
|
|
||||||
FilterTokens = [];
|
availableTokens = FrozenDictionary.ToFrozenDictionary(
|
||||||
|
[
|
||||||
availableTokens = FrozenDictionary.ToFrozenDictionary(
|
.. weapons.Select(w => KeyValuePair.Create(w.Name, new SearchToken(SearchTokenKind.Weapon, w.Name, sideIconUri: EquipIconConverter.IconNameToUri(w.Icon)))),
|
||||||
[
|
.. IntrinsicFrozen.FightProperties.Select(f => KeyValuePair.Create(f, new SearchToken(SearchTokenKind.FightProperty, f))),
|
||||||
.. weapons.Select(w => KeyValuePair.Create(w.Name, new SearchToken(SearchTokenKind.Weapon, w.Name, sideIconUri: EquipIconConverter.IconNameToUri(w.Icon)))),
|
.. IntrinsicFrozen.ItemQualities.Select(i => KeyValuePair.Create(i, new SearchToken(SearchTokenKind.ItemQuality, i, quality: QualityColorConverter.QualityNameToColor(i)))),
|
||||||
.. IntrinsicFrozen.FightProperties.Select(f => KeyValuePair.Create(f, new SearchToken(SearchTokenKind.FightProperty, f))),
|
.. IntrinsicFrozen.WeaponTypes.Select(w => KeyValuePair.Create(w, new SearchToken(SearchTokenKind.WeaponType, w, iconUri: WeaponTypeIconConverter.WeaponTypeNameToIconUri(w)))),
|
||||||
.. IntrinsicFrozen.ItemQualities.Select(i => KeyValuePair.Create(i, new SearchToken(SearchTokenKind.ItemQuality, i, quality: QualityColorConverter.QualityNameToColor(i)))),
|
]);
|
||||||
.. IntrinsicFrozen.WeaponTypes.Select(w => KeyValuePair.Create(w, new SearchToken(SearchTokenKind.WeaponType, w, iconUri: WeaponTypeIconConverter.WeaponTypeNameToIconUri(w)))),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
catch (OperationCanceledException)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,16 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient;
|
||||||
|
using Snap.Hutao.Service.Game.Scheme;
|
||||||
|
using Snap.Hutao.Web.Hoyolab.SdkStatic.Hk4e.Launcher.Resource;
|
||||||
|
using Snap.Hutao.Web.Request.Builder;
|
||||||
|
using Snap.Hutao.Web.Request.Builder.Abstraction;
|
||||||
|
using Snap.Hutao.Web.Response;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace Snap.Hutao.Web.Hoyolab.SdkStatic.Hk4e.Launcher;
|
namespace Snap.Hutao.Web.Hoyolab.SdkStatic.Hk4e.Launcher;
|
||||||
|
|
||||||
internal sealed class IconLink
|
internal sealed class IconLink
|
||||||
|
|||||||
Reference in New Issue
Block a user