diff --git a/.all-contributorsrc b/.all-contributorsrc
index 6212305f9b..b8a34941ef 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -14,7 +14,7 @@
"login": "neon-nyan",
"name": "Kemal Setya Adhi",
"avatar_url": "https://avatars.githubusercontent.com/u/30566970?v=4",
- "profile": "https://prophost.ironmaid.xyz",
+ "profile": "https://github.com/neon-nyan",
"contributions": [
"code",
"design",
@@ -208,10 +208,10 @@
]
},
{
- "login": "kujou-kju",
- "name": "kujou",
+ "login": "puyomi2k",
+ "name": "puyomi",
"avatar_url": "https://avatars.githubusercontent.com/u/23724383?v=4",
- "profile": "https://github.com/kujou-kju",
+ "profile": "https://github.com/puyomi2k",
"contributions": [
"translation"
]
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 58d696013a..91742fc5e1 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -7,7 +7,6 @@ on:
push:
branches:
- 'main'
- - '1.83.x-staging'
paths-ignore:
- '**.md'
- 'Hi3Helper.Core/Lang/**.json'
@@ -29,12 +28,12 @@ env:
jobs:
build:
- runs-on: windows-latest
+ runs-on: windows-2025-vs2026
strategy:
matrix:
configuration: [Debug] # No need to distribute Debug builds
platform: [x64]
- framework: [net9.0-windows10.0.26100.0]
+ framework: [net10.0-windows10.0.26100.0]
env:
Configuration: ${{ matrix.configuration }}
@@ -85,12 +84,12 @@ jobs:
dotnet build CollapseLauncher -c Publish --verbosity quiet --no-restore
build-nativeaot:
- runs-on: windows-latest
+ runs-on: windows-2025-vs2026
strategy:
matrix:
configuration: [Debug]
platform: [x64]
- framework: [net9.0-windows10.0.26100.0]
+ framework: [net10.0-windows10.0.26100.0]
env:
Configuration: ${{ matrix.configuration }}
diff --git a/.github/workflows/release-winget.yml b/.github/workflows/release-winget.yml
index fc32f81f50..b2ef5138cc 100644
--- a/.github/workflows/release-winget.yml
+++ b/.github/workflows/release-winget.yml
@@ -1,36 +1,63 @@
name: Publish Stable & Preview builds to WinGet
on:
release:
- types: [released]
+ types: [released, prereleased]
+ workflow_dispatch:
+ inputs:
+ version:
+ description: 'Version to publish (e.g. 1.2.3)'
+ required: true
+ type: string
+ channel:
+ description: 'Release channel'
+ required: true
+ type: choice
+ options:
+ - Stable
+ - Preview
+ release-tag:
+ description: 'Release tag to fetch installers from (e.g. CL-1.2.3)'
+ required: true
+ type: string
jobs:
determine_channel:
runs-on: ubuntu-latest
outputs:
channel: ${{ steps.check.outputs.channel }}
version: ${{ steps.check.outputs.version }}
+ release-tag: ${{ steps.check.outputs.release-tag }}
steps:
- name: Check Release Name and Extract Version
id: check
# Find X.Y.Z version, then check for "Preview" after it for regex
run: |
- RELEASE_NAME="${{ github.event.release.name }}"
- if [[ "$RELEASE_NAME" =~ (\d+\.\d+\.\d+) ]]; then
- VERSION="${BASH_REMATCH[1]}"
+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
+ VERSION="${{ inputs.version }}"
+ CHANNEL="${{ inputs.channel }}"
+ RELEASE_TAG="${{ inputs.release-tag }}"
else
- echo "Error: Could not find X.Y.Z version in release name."
- exit 1
- fi
+ RELEASE_NAME="${{ github.event.release.name }}"
+ RELEASE_TAG="${{ github.event.release.tag_name }}"
+ if [[ "$RELEASE_NAME" =~ (\d+\.\d+\.\d+) ]]; then
+ VERSION="${BASH_REMATCH[1]}"
+ else
+ echo "Error: Could not find X.Y.Z version in release name."
+ exit 1
+ fi
- if [[ "$RELEASE_NAME" == *"Preview"* ]]; then
- CHANNEL="Preview"
- else
- CHANNEL="Stable"
+ if [[ "$RELEASE_NAME" == *"Preview"* ]]; then
+ CHANNEL="Preview"
+ else
+ CHANNEL="Stable"
+ fi
fi
echo "Detected Channel: $CHANNEL"
echo "Detected Version: $VERSION"
+ echo "Detected Release Tag: $RELEASE_TAG"
echo "channel=$CHANNEL" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
+ echo "release-tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
publish_stable:
needs: determine_channel
@@ -42,6 +69,7 @@ jobs:
with:
identifier: CollapseLauncher.Collapse
version: ${{ needs.determine_channel.outputs.version }}
+ release-tag: ${{ needs.determine_channel.outputs.release-tag }}
installers-regex: '\.exe$'
token: ${{ secrets.WINGET_TOKEN }}
@@ -55,5 +83,6 @@ jobs:
with:
identifier: CollapseLauncher.Collapse.Preview
version: ${{ needs.determine_channel.outputs.version }}
+ release-tag: ${{ needs.determine_channel.outputs.release-tag }}
installers-regex: '\.exe$'
token: ${{ secrets.WINGET_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 9801964fd6..ab26cb877f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,8 +4,15 @@
.vs/*
*.user
packages/*
+msbuild.binlog
CollapseLauncher/Deps/*
+CollapseLauncher/StaticLib/buildScript/waifu2x-ncnn-vulkan
+CollapseLauncher/StaticLib/buildScript/zlib
+CollapseLauncher/StaticLib/buildScript/zstd
+CollapseLauncher/StaticLib/buildScript/dav1d
+CollapseLauncher/StaticLib/buildScript/llvm-project
+CollapseLauncher/StaticLib/buildScript/lib*
CollapseLauncher/StaticLib/*.lib
CollapseLauncher/StaticLib/**/*.lib
CollapseLauncher/StaticLib/*.pdb
diff --git a/ClearCache.bat b/ClearCache.bat
index c427227604..8c75a50f9d 100644
--- a/ClearCache.bat
+++ b/ClearCache.bat
@@ -1,33 +1,31 @@
@echo off
-echo Clearing Collapse cache
+echo Clearing Collapse cache
rmdir /S /Q CollapseLauncher\bin && rmdir /S /Q CollapseLauncher\obj
-echo Clearing ColorThief cache
+echo Clearing ColorThief cache
rmdir /S /Q ColorThief\ColorThief\bin && rmdir /S /Q ColorThief\ColorThief\obj
-echo Clearing CommunityToolkit.ImageCropper cache
+echo Clearing CommunityToolkit.ImageCropper cache
rmdir /S /Q Hi3Helper.CommunityToolkit\ImageCropper\bin && rmdir /S /Q Hi3Helper.CommunityToolkit\ImageCropper\obj
-echo Clearing CommunityToolkit.SettingsControls cache
+echo Clearing CommunityToolkit.SettingsControls cache
rmdir /S /Q Hi3Helper.CommunityToolkit\SettingsControls\bin && rmdir /S /Q Hi3Helper.CommunityToolkit\SettingsControls\obj
-echo Clearing Core cache
+echo Clearing Core cache
rmdir /S /Q Hi3Helper.Core\bin && rmdir /S /Q Hi3Helper.Core\obj
-echo Clearing EncTool cache
+echo Clearing EncTool cache
rmdir /S /Q Hi3Helper.EncTool\bin && rmdir /S /Q Hi3Helper.EncTool\obj
-echo Clearing EncTool tester cache
-rmdir /S /Q Hi3Helper.EncTool.Test\bin && rmdir /S /Q Hi3Helper.EncTool.Test\obj
-echo Clearing Http cache
+echo Clearing Http cache
rmdir /S /Q Hi3Helper.Http\bin && rmdir /S /Q Hi3Helper.Http\obj
-echo Clearing Http tester cache
-rmdir /S /Q Hi3Helper.Http\Test\bin && rmdir /S /Q Hi3Helper.Http\Test\obj
-echo Clearing TaskScheduler cache
+echo Clearing TaskScheduler cache
rmdir /S /Q Hi3Helper.TaskScheduler\bin && rmdir /S /Q Hi3Helper.TaskScheduler\obj
-echo Clearing HDiff cache
-rmdir /S /Q Hi3Helper.SharpHDiffPatch\Hi3Helper.SharpHDiffPatch\bin && rmdir /S /Q Hi3Helper.SharpHDiffPatch\Hi3Helper.SharpHDiffPatch\obj
-echo Clearing 2nd HDiff cache
-rmdir /S /Q Hi3Helper.SharpHDiffPatch\SharpHDiffPatch\bin && rmdir /S /Q Hi3Helper.SharpHDiffPatch\SharpHDiffPatch\obj
-echo Clearing InnoSetupHelper cache
+echo Clearing InnoSetupHelper cache
rmdir /S /Q InnoSetupHelper\bin && rmdir /S /Q InnoSetupHelper\obj
-echo Clearing ImageEx cache
+echo Clearing ImageEx cache
rmdir /S /Q ImageEx\ImageEx\bin && rmdir /S /Q ImageEx\ImageEx\obj
-echo Clearing 7z cache
-rmdir /S /Q Hi3Helper.Core\Classes\Data\Tools\SevenZipTool\SevenZipExtractor\SevenZipExtractor\bin && rmdir /S /Q Hi3Helper.Core\Classes\Data\Tools\SevenZipTool\SevenZipExtractor\SevenZipExtractor\obj
-echo Clearing SharpDiscordRPC cache
-rmdir /S /Q Hi3Helper.SharpDiscordRPC\DiscordRPC\bin && rmdir /S /Q Hi3Helper.SharpDiscordRPC\DiscordRPC\obj
\ No newline at end of file
+echo Clearing 7z cache
+rmdir /S /Q SevenZipExtractor\SevenZipExtractor\bin && rmdir /S /Q SevenZipExtractor\SevenZipExtractor\obj
+echo Clearing SharpDiscordRPC cache
+rmdir /S /Q Hi3Helper.SharpDiscordRPC\DiscordRPC\bin && rmdir /S /Q Hi3Helper.SharpDiscordRPC\DiscordRPC\obj
+echo Clearing Hi3Helper.SourceGen cache
+rmdir /S /Q Hi3Helper.SourceGen\bin && rmdir /S /Q Hi3Helper.SourceGen\obj
+echo Clearing Hi3Helper.LocaleSourceGen cache
+rmdir /S /Q Hi3Helper.LocaleSourceGen\bin && rmdir /S /Q Hi3Helper.LocaleSourceGen\obj
+echo Clearing Hi3Helper.Plugin.Core cache
+rmdir /S /Q Hi3Helper.Plugin.Core\bin && rmdir /S /Q Hi3Helper.Plugin.Core\obj
\ No newline at end of file
diff --git a/CollapseLauncher.slnx b/CollapseLauncher.slnx
index 0d3547d0fe..b9c1c02b68 100644
--- a/CollapseLauncher.slnx
+++ b/CollapseLauncher.slnx
@@ -50,6 +50,9 @@
+
+
+
@@ -66,6 +69,9 @@
+
+
+
@@ -90,4 +96,10 @@
+
+
+
+
+
+
diff --git a/CollapseLauncher/App.xaml b/CollapseLauncher/App.xaml
index 066e3cad22..71c8a5ea4d 100644
--- a/CollapseLauncher/App.xaml
+++ b/CollapseLauncher/App.xaml
@@ -1,5154 +1,27 @@
-
+
-
-
-
-
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ms-appx:///Assets/CollapseLauncherLogo.png
- ms-appx:///Assets/CollapseLauncherLogoOutlineLight.png
-
- #ffd52a
- #ffd52a
- #ffd52a
- #ffd52a
- #ffd52a
- #ffd52a
- #00ffd52a
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #ffd52a
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ms-appx:///Assets/CollapseLauncherLogo.png
- ms-appx:///Assets/CollapseLauncherLogoOutlineDark.png
-
- #693758
- #693758
- #693758
- #693758
- #693758
- #693758
- #00693758
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #693758
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0,47,0,0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0,-6,0,0
-
+
+
+
+
+
ms-appx:///Assets/Fonts/FontAwesomeBrand6.otf#Font Awesome 6 Brands
ms-appx:///Assets/Fonts/FontAwesomeRegular6.otf#Font Awesome 6 Free
diff --git a/CollapseLauncher/Assets/CollapseLauncherLogoWithTextDark.png b/CollapseLauncher/Assets/CollapseLauncherLogoWithTextDark.png
new file mode 100644
index 0000000000..9e22e5e6a2
Binary files /dev/null and b/CollapseLauncher/Assets/CollapseLauncherLogoWithTextDark.png differ
diff --git a/CollapseLauncher/Assets/FFmpegLogo.svg b/CollapseLauncher/Assets/FFmpegLogo.svg
new file mode 100644
index 0000000000..5b0573b713
--- /dev/null
+++ b/CollapseLauncher/Assets/FFmpegLogo.svg
@@ -0,0 +1,34 @@
+
+
diff --git a/CollapseLauncher/Assets/Images/ImageCropperOverlay/normal.png b/CollapseLauncher/Assets/Images/ImageCropperOverlay/normal.png
index 83b4184462..7ccf9d9f12 100644
Binary files a/CollapseLauncher/Assets/Images/ImageCropperOverlay/normal.png and b/CollapseLauncher/Assets/Images/ImageCropperOverlay/normal.png differ
diff --git a/CollapseLauncher/Assets/Images/ImageCropperOverlay/small.png b/CollapseLauncher/Assets/Images/ImageCropperOverlay/small.png
index 75af22741e..bf68435467 100644
Binary files a/CollapseLauncher/Assets/Images/ImageCropperOverlay/small.png and b/CollapseLauncher/Assets/Images/ImageCropperOverlay/small.png differ
diff --git a/CollapseLauncher/Assets/Licenses/FFmpeg/Homepage b/CollapseLauncher/Assets/Licenses/FFmpeg/Homepage
new file mode 100644
index 0000000000..ab48b7da22
--- /dev/null
+++ b/CollapseLauncher/Assets/Licenses/FFmpeg/Homepage
@@ -0,0 +1,2 @@
+https://www.ffmpeg.org/
+LicenseHref;https://raw.githubusercontent.com/FFmpeg/FFmpeg/refs/heads/master/COPYING.LGPLv2.1;GNU Lesser General Public License (LGPLv2.1)
\ No newline at end of file
diff --git a/CollapseLauncher/Assets/Licenses/FFmpegInteropX/Homepage b/CollapseLauncher/Assets/Licenses/FFmpegInteropX/Homepage
new file mode 100644
index 0000000000..49d199bb1b
--- /dev/null
+++ b/CollapseLauncher/Assets/Licenses/FFmpegInteropX/Homepage
@@ -0,0 +1,3 @@
+https://github.com/ffmpeginteropx/FFmpegInteropX/
+https://github.com/microsoft/FFmpegInterop/
+LicenseHref;https://raw.githubusercontent.com/ffmpeginteropx/FFmpegInteropX/refs/heads/master/LICENSE;Apache License 2.0
\ No newline at end of file
diff --git a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/BindableThemeChangeAnimation.cs b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/BindableThemeChangeAnimation.cs
new file mode 100644
index 0000000000..f225737a66
--- /dev/null
+++ b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/BindableThemeChangeAnimation.cs
@@ -0,0 +1,28 @@
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Media;
+
+#pragma warning disable IDE0130
+
+#nullable enable
+namespace CollapseLauncher.AnimatedVisuals.Lottie;
+
+public abstract class BindableThemeChangeAnimation : DependencyObject
+{
+ public Brush Foreground
+ {
+ get => (Brush)GetValue(ForegroundProperty);
+ set => SetValue(ForegroundProperty, value);
+ }
+
+ ///
+ /// Dependency property for Foreground.
+ ///
+ public static readonly DependencyProperty ForegroundProperty =
+ DependencyProperty.Register(nameof(Foreground), typeof(Brush), typeof(BindableThemeChangeAnimation),
+ new PropertyMetadata(null!, OnForegroundChanged));
+
+ protected static void OnForegroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs args)
+ => ((BindableThemeChangeAnimation)d).OnForegroundChanged(args.NewValue as Brush);
+
+ protected abstract void OnForegroundChanged(Brush? brush);
+}
diff --git a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/DownloadIcon.cs b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/DownloadIcon.cs
index 59d0c86ba7..67b789ebb3 100644
--- a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/DownloadIcon.cs
+++ b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/DownloadIcon.cs
@@ -3,13 +3,13 @@
// This code was generated by a tool.
//
// LottieGen version:
-// 8.0.280225.1+7cd366a738
+// 8.2.250604.1+b02a3ee244
//
// Command:
-// LottieGen -Language CSharp -Namespace CollapseLauncher.AnimatedVisuals.Lottie -Public -WinUIVersion 3.0 -InputFile DownloadIcon.lottie
+// LottieGen -GenerateColorBindings -GenerateDependencyObject -Language CSharp -Namespace CollapseLauncher.AnimatedVisuals.Lottie -Public -WinUIVersion 3.0 -InputFile DownloadIcon.json
//
// Input file:
-// DownloadIcon.lottie (1623 bytes created 23:20+07:00 Jun 1 2024)
+// DownloadIcon.json (7800 bytes created 16:59+07:00 Jan 4 2026)
//
// LottieGen source:
// http://aka.ms/Lottie
@@ -21,16 +21,16 @@
// ____________________________________
// | Object stats | Count |
// |__________________________|_______|
-// | All CompositionObjects | 118 |
+// | All CompositionObjects | 121 |
// |--------------------------+-------|
-// | Expression animators | 8 |
+// | Expression animators | 9 |
// | KeyFrame animators | 15 |
-// | Reference parameters | 8 |
-// | Expression operations | 6 |
+// | Reference parameters | 9 |
+// | Expression operations | 10 |
// |--------------------------+-------|
-// | Animated brushes | - |
+// | Animated brushes | 1 |
// | Animated gradient stops | - |
-// | ExpressionAnimations | 8 |
+// | ExpressionAnimations | 9 |
// | PathKeyFrameAnimations | 1 |
// |--------------------------+-------|
// | ContainerVisuals | 5 |
@@ -48,6 +48,8 @@
using Microsoft.Graphics.Canvas.Effects;
using Microsoft.Graphics.Canvas.Geometry;
using Microsoft.UI.Composition;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Media;
using System;
using System.Collections.Generic;
using System.Numerics;
@@ -59,13 +61,67 @@ namespace CollapseLauncher.AnimatedVisuals.Lottie
// Frame rate: 60 fps
// Frame count: 300
// Duration: 5000.0 mS
- sealed partial class DownloadIcon
- : Microsoft.UI.Xaml.Controls.IAnimatedVisualSource
+ public sealed partial class DownloadIcon
+ : BindableThemeChangeAnimation
+ , Microsoft.UI.Xaml.Controls.IAnimatedVisualSource
, Microsoft.UI.Xaml.Controls.IAnimatedVisualSource2
{
+ protected override void OnForegroundChanged(Brush brush)
+ {
+ if (brush is SolidColorBrush colorBrush)
+ {
+ Color_FFFFFF = colorBrush.Color;
+ return;
+ }
+
+ if (brush is AcrylicBrush acrylicBrush)
+ {
+ Color_FFFFFF = acrylicBrush.TintColor;
+ return;
+ }
+ }
+
+ private static Color GetForegroundColor(bool isLightTheme) =>
+ isLightTheme
+ ? Color.FromArgb(0xFF, 0x00, 0x00, 0x00)
+ : Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
+
// Animation duration: 5.000 seconds.
internal const long c_durationTicks = 50000000;
+ CompositionPropertySet _themeProperties;
+
+ ///
+ /// Dependency property for Color_FFFFFF.
+ ///
+ public static readonly DependencyProperty Color_FFFFFFProperty =
+ DependencyProperty.Register("Color_FFFFFF", typeof(Color), typeof(DownloadIcon),
+ new PropertyMetadata(GetForegroundColor(InnerLauncherConfig.IsAppThemeLight), OnColor_FFFFFFChanged));
+
+ // Theme properties.
+ public Color Color_FFFFFF
+ {
+ get => (Color)GetValue(Color_FFFFFFProperty);
+ set => SetValue(Color_FFFFFFProperty, value);
+ }
+
+ static Vector4 ColorAsVector4(Color color) => new Vector4(color.R, color.G, color.B, color.A);
+
+ static void OnColor_FFFFFFChanged(DependencyObject d, DependencyPropertyChangedEventArgs args)
+ {
+ ((DownloadIcon)d)._themeProperties?.InsertVector4("Color_FFFFFF", ColorAsVector4((Color)(Color)args.NewValue));
+ }
+
+ CompositionPropertySet EnsureThemeProperties(Compositor compositor)
+ {
+ if (_themeProperties == null)
+ {
+ _themeProperties = compositor.CreatePropertySet();
+ _themeProperties.InsertVector4("Color_FFFFFF", ColorAsVector4((Color)Color_FFFFFF));
+ }
+ return _themeProperties;
+ }
+
public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compositor compositor)
{
object ignored = null;
@@ -75,10 +131,12 @@ public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compos
public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compositor compositor, out object diagnostics)
{
diagnostics = null;
+ EnsureThemeProperties(compositor);
var res =
new DownloadIcon_AnimatedVisual(
- compositor
+ compositor,
+ _themeProperties
);
res.CreateAnimations();
return res;
@@ -122,6 +180,19 @@ public double FrameToProgress(double frameNumber)
///
public void SetColorProperty(string propertyName, Color value)
{
+ if (propertyName == "Color_FFFFFF")
+ {
+ Color_FFFFFF = value;
+ }
+ else
+ {
+ return;
+ }
+
+ if (_themeProperties != null)
+ {
+ _themeProperties.InsertVector4(propertyName, ColorAsVector4(value));
+ }
}
///
@@ -139,8 +210,9 @@ sealed partial class DownloadIcon_AnimatedVisual
const long c_durationTicks = 50000000;
readonly Compositor _c;
readonly ExpressionAnimation _reusableExpressionAnimation;
+ readonly CompositionPropertySet _themeProperties;
AnimationController _animationController_0;
- CompositionColorBrush _colorBrush_White;
+ CompositionColorBrush _themeColor_Color_FFFFFF;
CompositionContainerShape _containerShape_0;
CompositionContainerShape _containerShape_1;
CompositionContainerShape _containerShape_2;
@@ -155,7 +227,7 @@ sealed partial class DownloadIcon_AnimatedVisual
CubicBezierEasingFunction _cubicBezierEasingFunction_0;
CubicBezierEasingFunction _cubicBezierEasingFunction_1;
ScalarKeyFrameAnimation _opacityScalarAnimation_1_to_0;
- ScalarKeyFrameAnimation _positionYScalarAnimation_1025_to_2350;
+ ScalarKeyFrameAnimation _positionYScalarAnimation_128p125_to_293p75;
ScalarKeyFrameAnimation _rotationAngleInDegreesScalarAnimation_0_to_0_0;
ShapeVisual _shapeVisual_2;
StepEasingFunction _holdThenStepEasingFunction;
@@ -245,11 +317,11 @@ CanvasGeometry Geometry_2()
CanvasGeometry result;
using (var builder = new CanvasPathBuilder(null))
{
- builder.BeginFigure(new Vector2(2316F, -196F));
- builder.AddCubicBezier(new Vector2(2316F, -196F), new Vector2(-336F, -196F), new Vector2(-336F, -196F));
- builder.AddCubicBezier(new Vector2(-336F, -196F), new Vector2(-336F, 2132F), new Vector2(-336F, 2132F));
- builder.AddCubicBezier(new Vector2(-336F, 2132F), new Vector2(2316F, 2132F), new Vector2(2316F, 2132F));
- builder.AddCubicBezier(new Vector2(2316F, 2132F), new Vector2(2316F, -196F), new Vector2(2316F, -196F));
+ builder.BeginFigure(new Vector2(289.5F, -24.5F));
+ builder.AddCubicBezier(new Vector2(289.5F, -24.5F), new Vector2(-42F, -24.5F), new Vector2(-42F, -24.5F));
+ builder.AddCubicBezier(new Vector2(-42F, -24.5F), new Vector2(-42F, 266.5F), new Vector2(-42F, 266.5F));
+ builder.AddCubicBezier(new Vector2(-42F, 266.5F), new Vector2(289.5F, 266.5F), new Vector2(289.5F, 266.5F));
+ builder.AddCubicBezier(new Vector2(289.5F, 266.5F), new Vector2(289.5F, -24.5F), new Vector2(289.5F, -24.5F));
builder.EndFigure(CanvasFigureLoop.Closed);
result = CanvasGeometry.CreatePath(builder);
}
@@ -264,11 +336,11 @@ CanvasGeometry Geometry_3()
CanvasGeometry result;
using (var builder = new CanvasPathBuilder(null))
{
- builder.BeginFigure(new Vector2(2316F, -196F));
- builder.AddCubicBezier(new Vector2(2316F, -196F), new Vector2(-336F, -196F), new Vector2(-336F, -196F));
- builder.AddCubicBezier(new Vector2(-336F, -196F), new Vector2(-336F, 1532F), new Vector2(-336F, 1532F));
- builder.AddCubicBezier(new Vector2(-336F, 1532F), new Vector2(2316F, 1532F), new Vector2(2316F, 1532F));
- builder.AddCubicBezier(new Vector2(2316F, 1532F), new Vector2(2316F, -196F), new Vector2(2316F, -196F));
+ builder.BeginFigure(new Vector2(289.5F, -24.5F));
+ builder.AddCubicBezier(new Vector2(289.5F, -24.5F), new Vector2(-42F, -24.5F), new Vector2(-42F, -24.5F));
+ builder.AddCubicBezier(new Vector2(-42F, -24.5F), new Vector2(-42F, 191.5F), new Vector2(-42F, 191.5F));
+ builder.AddCubicBezier(new Vector2(-42F, 191.5F), new Vector2(289.5F, 191.5F), new Vector2(289.5F, 191.5F));
+ builder.AddCubicBezier(new Vector2(289.5F, 191.5F), new Vector2(289.5F, -24.5F), new Vector2(289.5F, -24.5F));
builder.EndFigure(CanvasFigureLoop.Closed);
result = CanvasGeometry.CreatePath(builder);
}
@@ -283,11 +355,11 @@ CanvasGeometry Geometry_4()
CanvasGeometry result;
using (var builder = new CanvasPathBuilder(null))
{
- builder.BeginFigure(new Vector2(2316F, -196F));
- builder.AddCubicBezier(new Vector2(2316F, -196F), new Vector2(-336F, -196F), new Vector2(-336F, -196F));
- builder.AddCubicBezier(new Vector2(-336F, -196F), new Vector2(-336F, 1432F), new Vector2(-336F, 1432F));
- builder.AddCubicBezier(new Vector2(-336F, 1432F), new Vector2(2316F, 1432F), new Vector2(2316F, 1432F));
- builder.AddCubicBezier(new Vector2(2316F, 1432F), new Vector2(2316F, -196F), new Vector2(2316F, -196F));
+ builder.BeginFigure(new Vector2(289.5F, -24.5F));
+ builder.AddCubicBezier(new Vector2(289.5F, -24.5F), new Vector2(-42F, -24.5F), new Vector2(-42F, -24.5F));
+ builder.AddCubicBezier(new Vector2(-42F, -24.5F), new Vector2(-42F, 179F), new Vector2(-42F, 179F));
+ builder.AddCubicBezier(new Vector2(-42F, 179F), new Vector2(289.5F, 179F), new Vector2(289.5F, 179F));
+ builder.AddCubicBezier(new Vector2(289.5F, 179F), new Vector2(289.5F, -24.5F), new Vector2(289.5F, -24.5F));
builder.EndFigure(CanvasFigureLoop.Closed);
result = CanvasGeometry.CreatePath(builder);
}
@@ -314,11 +386,13 @@ CompositionColorBrush ColorBrush_Black()
return _c.CreateColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00));
}
- CompositionColorBrush ColorBrush_White()
+ // Color bound to theme property value: Color_FFFFFF
+ CompositionColorBrush ThemeColor_Color_FFFFFF()
{
- return (_colorBrush_White == null)
- ? _colorBrush_White = _c.CreateColorBrush(InnerLauncherConfig.IsAppThemeLight ? Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF) : Color.FromArgb(0xFF, 0x00, 0x00, 0x00))
- : _colorBrush_White;
+ if (_themeColor_Color_FFFFFF != null) { return _themeColor_Color_FFFFFF; }
+ var result = _themeColor_Color_FFFFFF = _c.CreateColorBrush();
+ BindProperty(_themeColor_Color_FFFFFF, "Color", "ColorRGB(_theme.Color_FFFFFF.W,_theme.Color_FFFFFF.X,_theme.Color_FFFFFF.Y,_theme.Color_FFFFFF.Z)", "_theme", _themeProperties);
+ return result;
}
CompositionContainerShape ContainerShape_0()
@@ -326,7 +400,9 @@ CompositionContainerShape ContainerShape_0()
if (_containerShape_0 != null) { return _containerShape_0; }
var result = _containerShape_0 = _c.CreateContainerShape();
var propertySet = result.Properties;
- propertySet.InsertVector2("Position", new Vector2(1024F, 1025F));
+ propertySet.InsertVector2("Position", new Vector2(128F, 128.125F));
+ result.CenterPoint = new Vector2(50F, 50F);
+ result.Scale = new Vector2(0.125F, 0.125F);
// Transforms: Shape Layer 1 Offset:<50, 50>
result.Shapes.Add(SpriteShape_0());
BindProperty(_containerShape_0, "Offset", "Vector2(my.Position.X-50,my.Position.Y-50)", "my", _containerShape_0);
@@ -338,7 +414,9 @@ CompositionContainerShape ContainerShape_1()
if (_containerShape_1 != null) { return _containerShape_1; }
var result = _containerShape_1 = _c.CreateContainerShape();
var propertySet = result.Properties;
- propertySet.InsertVector2("Position", new Vector2(1024F, 1025F));
+ propertySet.InsertVector2("Position", new Vector2(128F, 128.125F));
+ result.CenterPoint = new Vector2(50F, 50F);
+ result.Scale = new Vector2(0.125F, 0.125F);
// Transforms: Shape Layer 2 Offset:<50, 50>
result.Shapes.Add(SpriteShape_1());
BindProperty(_containerShape_1, "Offset", "Vector2(my.Position.X-50,my.Position.Y-50)", "my", _containerShape_1);
@@ -350,8 +428,9 @@ CompositionContainerShape ContainerShape_2()
if (_containerShape_2 != null) { return _containerShape_2; }
var result = _containerShape_2 = _c.CreateContainerShape();
var propertySet = result.Properties;
- propertySet.InsertVector2("Position", new Vector2(1024F, 1264F));
+ propertySet.InsertVector2("Position", new Vector2(128F, 179.125F));
result.CenterPoint = new Vector2(4F, 344F);
+ result.Scale = new Vector2(0.125F, 0.125F);
// ShapeGroup: Shape 1
result.Shapes.Add(SpriteShape_3());
BindProperty(_containerShape_2, "Offset", "Vector2(my.Position.X-4,my.Position.Y-344)", "my", _containerShape_2);
@@ -433,7 +512,7 @@ CompositionSpriteShape SpriteShape_0()
{
// Offset:<50, 50>
var result = CreateSpriteShape(PathGeometry_0(), new Matrix3x2(1F, 0F, 0F, 1F, 50F, 50F));;
- result.StrokeBrush = ColorBrush_White();
+ result.StrokeBrush = ThemeColor_Color_FFFFFF();
result.StrokeDashCap = CompositionStrokeCap.Round;
result.StrokeStartCap = CompositionStrokeCap.Round;
result.StrokeEndCap = CompositionStrokeCap.Round;
@@ -448,7 +527,7 @@ CompositionSpriteShape SpriteShape_1()
{
// Offset:<50, 50>
var result = CreateSpriteShape(PathGeometry_1(), new Matrix3x2(1F, 0F, 0F, 1F, 50F, 50F));;
- result.StrokeBrush = ColorBrush_White();
+ result.StrokeBrush = ThemeColor_Color_FFFFFF();
result.StrokeDashCap = CompositionStrokeCap.Round;
result.StrokeStartCap = CompositionStrokeCap.Round;
result.StrokeEndCap = CompositionStrokeCap.Round;
@@ -464,7 +543,7 @@ CompositionSpriteShape SpriteShape_2()
{
if (_spriteShape_2 != null) { return _spriteShape_2; }
var result = _spriteShape_2 = _c.CreateSpriteShape(PathGeometry_2());
- result.CenterPoint = new Vector2(1024F, 1024F);
+ result.CenterPoint = new Vector2(128F, 128F);
result.FillBrush = ColorBrush_Black();
return result;
}
@@ -473,7 +552,7 @@ CompositionSpriteShape SpriteShape_2()
CompositionSpriteShape SpriteShape_3()
{
var result = _c.CreateSpriteShape(PathGeometry_3());
- result.StrokeBrush = ColorBrush_White();
+ result.StrokeBrush = ThemeColor_Color_FFFFFF();
result.StrokeDashCap = CompositionStrokeCap.Round;
result.StrokeStartCap = CompositionStrokeCap.Round;
result.StrokeEndCap = CompositionStrokeCap.Round;
@@ -500,7 +579,7 @@ CompositionVisualSurface VisualSurface_0()
{
var result = _c.CreateVisualSurface();
result.SourceVisual = ContainerVisual_0();
- result.SourceSize = new Vector2(2048F, 2048F);
+ result.SourceSize = new Vector2(256F, 256F);
return result;
}
@@ -509,7 +588,7 @@ CompositionVisualSurface VisualSurface_1()
{
var result = _c.CreateVisualSurface();
result.SourceVisual = ContainerVisual_3();
- result.SourceSize = new Vector2(2048F, 2048F);
+ result.SourceSize = new Vector2(256F, 256F);
return result;
}
@@ -529,7 +608,7 @@ ContainerVisual ContainerVisual_1()
{
if (_containerVisual_1 != null) { return _containerVisual_1; }
var result = _containerVisual_1 = _c.CreateContainerVisual();
- result.CenterPoint = new Vector3(1024F, 1024F, 0F);
+ result.CenterPoint = new Vector3(128F, 128F, 0F);
result.Scale = new Vector3(1F, 1F, 0F);
// Transforms for DownloadIcon
result.Children.InsertAtTop(ContainerVisual_2());
@@ -543,7 +622,7 @@ ContainerVisual ContainerVisual_2()
{
var result = _c.CreateContainerVisual();
result.Clip = InsetClip_0();
- result.Size = new Vector2(2048F, 2048F);
+ result.Size = new Vector2(256F, 256F);
// Layer aggregator
result.Children.InsertAtTop(ShapeVisual_0());
return result;
@@ -627,43 +706,43 @@ ScalarKeyFrameAnimation OpacityScalarAnimation_1_to_0()
}
// Position.Y
- ScalarKeyFrameAnimation PositionYScalarAnimation_1025_to_2350()
+ ScalarKeyFrameAnimation PositionYScalarAnimation_128p125_to_293p75()
{
// Frame 0.
- if (_positionYScalarAnimation_1025_to_2350 != null) { return _positionYScalarAnimation_1025_to_2350; }
- var result = _positionYScalarAnimation_1025_to_2350 = CreateScalarKeyFrameAnimation(0F, 1025F, StepThenHoldEasingFunction());
+ if (_positionYScalarAnimation_128p125_to_293p75 != null) { return _positionYScalarAnimation_128p125_to_293p75; }
+ var result = _positionYScalarAnimation_128p125_to_293p75 = CreateScalarKeyFrameAnimation(0F, 128.125F, StepThenHoldEasingFunction());
// Frame 50.
- result.InsertKeyFrame(0.166666672F, 1025F, HoldThenStepEasingFunction());
+ result.InsertKeyFrame(0.166666672F, 128.125F, HoldThenStepEasingFunction());
// Frame 90.
- result.InsertKeyFrame(0.300000012F, 1009F, CubicBezierEasingFunction_0());
+ result.InsertKeyFrame(0.300000012F, 126.125F, CubicBezierEasingFunction_0());
// Frame 165.
- result.InsertKeyFrame(0.550000012F, 1009F, CubicBezierEasingFunction_0());
+ result.InsertKeyFrame(0.550000012F, 126.125F, CubicBezierEasingFunction_0());
// Frame 200.
- result.InsertKeyFrame(0.666666687F, 876F, CubicBezierEasingFunction_0());
+ result.InsertKeyFrame(0.666666687F, 109.5F, CubicBezierEasingFunction_0());
// Frame 210.
- result.InsertKeyFrame(0.699999988F, 876F, _c.CreateCubicBezierEasingFunction(new Vector2(0.333000004F, 0F), new Vector2(0.167999998F, 1F)));
+ result.InsertKeyFrame(0.699999988F, 109.5F, _c.CreateCubicBezierEasingFunction(new Vector2(0.333000004F, 0F), new Vector2(0.167999998F, 1F)));
// Frame 255.
- result.InsertKeyFrame(0.850000024F, 2350F, CubicBezierEasingFunction_0());
+ result.InsertKeyFrame(0.850000024F, 293.75F, CubicBezierEasingFunction_0());
return result;
}
// Position.Y
- ScalarKeyFrameAnimation PositionYScalarAnimation_1264_to_1433()
+ ScalarKeyFrameAnimation PositionYScalarAnimation_179p125_to_179p125()
{
// Frame 0.
- var result = CreateScalarKeyFrameAnimation(0F, 1264F, StepThenHoldEasingFunction());
+ var result = CreateScalarKeyFrameAnimation(0F, 179.125F, StepThenHoldEasingFunction());
// Frame 30.
- result.InsertKeyFrame(0.100000001F, 1264F, HoldThenStepEasingFunction());
+ result.InsertKeyFrame(0.100000001F, 179.125F, HoldThenStepEasingFunction());
// Frame 70.
- result.InsertKeyFrame(0.233333334F, 1433F, CubicBezierEasingFunction_0());
+ result.InsertKeyFrame(0.233333334F, 179.125F, CubicBezierEasingFunction_0());
// Frame 167.
- result.InsertKeyFrame(0.556666672F, 1433F, _c.CreateCubicBezierEasingFunction(new Vector2(0.157000005F, 0F), new Vector2(0.0299999993F, 1F)));
+ result.InsertKeyFrame(0.556666672F, 179.125F, _c.CreateCubicBezierEasingFunction(new Vector2(0.157000005F, 0F), new Vector2(0.0299999993F, 1F)));
// Frame 188.
- result.InsertKeyFrame(0.626666665F, 1577F, CubicBezierEasingFunction_0());
+ result.InsertKeyFrame(0.626666665F, 197.125F, CubicBezierEasingFunction_0());
// Frame 210.
- result.InsertKeyFrame(0.699999988F, 1577F, CubicBezierEasingFunction_0());
+ result.InsertKeyFrame(0.699999988F, 197.125F, CubicBezierEasingFunction_0());
// Frame 240.
- result.InsertKeyFrame(0.800000012F, 1433F, CubicBezierEasingFunction_0());
+ result.InsertKeyFrame(0.800000012F, 179.125F, CubicBezierEasingFunction_0());
return result;
}
@@ -785,7 +864,7 @@ ScalarKeyFrameAnimation TStartScalarAnimation_0p855_to_0()
ShapeVisual ShapeVisual_0()
{
var result = _c.CreateShapeVisual();
- result.Size = new Vector2(2048F, 2048F);
+ result.Size = new Vector2(256F, 256F);
var shapes = result.Shapes;
shapes.Add(ContainerShape_0());
shapes.Add(ContainerShape_1());
@@ -797,7 +876,7 @@ ShapeVisual ShapeVisual_0()
ShapeVisual ShapeVisual_1()
{
var result = _c.CreateShapeVisual();
- result.Size = new Vector2(2048F, 2048F);
+ result.Size = new Vector2(256F, 256F);
result.Shapes.Add(SpriteShape_2());
return result;
}
@@ -807,7 +886,7 @@ ShapeVisual ShapeVisual_2()
{
if (_shapeVisual_2 != null) { return _shapeVisual_2; }
var result = _shapeVisual_2 = _c.CreateShapeVisual();
- result.Size = new Vector2(2048F, 2048F);
+ result.Size = new Vector2(256F, 256F);
result.Shapes.Add(ContainerShape_2());
return result;
}
@@ -816,7 +895,7 @@ ShapeVisual ShapeVisual_2()
SpriteVisual SpriteVisual_0()
{
var result = _c.CreateSpriteVisual();
- result.Size = new Vector2(2048F, 2048F);
+ result.Size = new Vector2(256F, 256F);
result.Brush = EffectBrush();
return result;
}
@@ -838,25 +917,27 @@ StepEasingFunction StepThenHoldEasingFunction()
}
internal DownloadIcon_AnimatedVisual(
- Compositor compositor
+ Compositor compositor,
+ CompositionPropertySet themeProperties
)
{
_c = compositor;
+ _themeProperties = themeProperties;
_reusableExpressionAnimation = compositor.CreateExpressionAnimation();
Root();
}
public Visual RootVisual => _root;
public TimeSpan Duration => TimeSpan.FromTicks(c_durationTicks);
- public Vector2 Size => new Vector2(2048F, 2048F);
+ public Vector2 Size => new Vector2(256F, 256F);
void IDisposable.Dispose() => _root?.Dispose();
public void CreateAnimations()
{
- _containerShape_0.Properties.StartAnimation("Position.Y", PositionYScalarAnimation_1025_to_2350(), AnimationController_0());
- _containerShape_1.Properties.StartAnimation("Position.Y", PositionYScalarAnimation_1025_to_2350(), AnimationController_0());
+ _containerShape_0.Properties.StartAnimation("Position.Y", PositionYScalarAnimation_128p125_to_293p75(), AnimationController_0());
+ _containerShape_1.Properties.StartAnimation("Position.Y", PositionYScalarAnimation_128p125_to_293p75(), AnimationController_0());
_containerShape_2.StartAnimation("RotationAngleInDegrees", RotationAngleInDegreesScalarAnimation_0_to_0_1(), AnimationController_0());
- _containerShape_2.Properties.StartAnimation("Position.Y", PositionYScalarAnimation_1264_to_1433(), AnimationController_0());
+ _containerShape_2.Properties.StartAnimation("Position.Y", PositionYScalarAnimation_179p125_to_179p125(), AnimationController_0());
_pathGeometry_0.StartAnimation("TStart", TStartScalarAnimation_0p855_to_0(), AnimationController_0());
_pathGeometry_0.StartAnimation("TEnd", TEndScalarAnimation_0p855_to_0p1(), AnimationController_0());
_pathGeometry_1.StartAnimation("TrimStart", TrimStartScalarAnimation_0p585_to_0(), AnimationController_0());
diff --git a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/DownloadIcon.json b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/DownloadIcon.json
new file mode 100644
index 0000000000..2810c9899b
--- /dev/null
+++ b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/DownloadIcon.json
@@ -0,0 +1 @@
+{"v":"5.12.2","fr":60,"ip":0,"op":300,"w":256,"h":256,"nm":"DownloadIconMasterComp","ddd":0,"assets":[{"id":"comp_0","nm":"DownloadIcon","fr":60,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 2","parent":3,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[360.517,-180.5],[0,180.017],[-360.517,-180.5]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":128,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":53,"s":[58.5]},{"t":83,"s":[0]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":53,"s":[58.5]},{"t":83,"s":[58.5]}],"ix":2},"o":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":53,"s":[-101.6]},{"t":83,"s":[0]}],"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":300,"st":-7,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 1","parent":3,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,-459.501],[-459.501,0],[0,459.501],[0,0]],"o":[[0,0],[-459.501,0],[0,459.501],[459.501,0],[0,-459.501],[0,0]],"v":[[0,116],[0,-832],[-832,0],[0,832],[832,0],[515,-688]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":128,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[85.5]},{"t":60,"s":[0]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[85.5]},{"t":80,"s":[10]}],"ix":2},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":30,"s":[0]},{"t":60,"s":[0]}],"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":300,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":3,"nm":"Null 1","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"s":true,"x":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":50,"s":[128]},{"t":90,"s":[128]}],"ix":3},"y":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":50,"s":[128.125]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":90,"s":[126.125]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":165,"s":[126.125]},{"i":{"x":[0.168],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":200,"s":[109.5]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":210,"s":[109.5]},{"t":255,"s":[293.75]}],"ix":4}},"a":{"a":0,"k":[50,50,0],"ix":1,"l":2},"s":{"a":0,"k":[12.5,12.5,100],"ix":6,"l":2}},"ao":0,"ip":0,"op":300,"st":-10,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 3","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":260,"s":[100]},{"t":280,"s":[0]}],"ix":11},"r":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":140,"s":[0]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":150,"s":[8]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":167,"s":[-8]},{"t":184,"s":[0]}],"ix":10},"p":{"s":true,"x":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":30,"s":[128]},{"t":70,"s":[128]}],"ix":3},"y":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":30,"s":[179.125]},{"i":{"x":[0.03],"y":[1]},"o":{"x":[0.157],"y":[0]},"t":70,"s":[179.125]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":167,"s":[179.125]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":188,"s":[197.125]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":210,"s":[197.125]},{"t":240,"s":[179.125]}],"ix":4}},"a":{"a":0,"k":[4,344,0],"ix":1,"l":2},"s":{"a":0,"k":[12.5,12.5,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-460,344],[468,344]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":128,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":30,"s":[0]},{"i":{"x":[0.586],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":70,"s":[0]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":260,"s":[0]},{"t":280,"s":[100]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":30,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":70,"s":[100]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":260,"s":[100]},{"t":280,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":2,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":300,"st":-15,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":0,"nm":"DownloadIcon","refId":"comp_0","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":260,"s":[100]},{"t":280,"s":[0]}],"ix":11},"r":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":140,"s":[0]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":150,"s":[-9]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":160,"s":[11]},{"t":179,"s":[0]}],"ix":10},"p":{"s":true,"x":{"a":0,"k":128,"ix":3},"y":{"a":0,"k":128,"ix":4}},"a":{"a":0,"k":[128,128,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"hasMask":true,"masksProperties":[{"inv":false,"mode":"a","pt":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":150,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[289.5,-24.5],[-42,-24.5],[-42,266.5],[289.5,266.5]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":189,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[289.5,-24.5],[-42,-24.5],[-42,191.5],[289.5,191.5]],"c":true}]},{"t":230,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[289.5,-24.5],[-42,-24.5],[-42,179],[289.5,179]],"c":true}]}],"ix":1},"o":{"a":0,"k":100,"ix":3},"x":{"a":0,"k":0,"ix":4},"nm":"Mask 1"}],"w":256,"h":256,"ip":0,"op":300,"st":0,"bm":0}],"markers":[],"props":{}}
\ No newline at end of file
diff --git a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/DownloadIcon.lottie b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/DownloadIcon.lottie
deleted file mode 100644
index d40ef8c199..0000000000
Binary files a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/DownloadIcon.lottie and /dev/null differ
diff --git a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/LoadingSprite.cs b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/LoadingSprite.cs
index 3d1e741786..45c1ba6142 100644
--- a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/LoadingSprite.cs
+++ b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/LoadingSprite.cs
@@ -3,13 +3,13 @@
// This code was generated by a tool.
//
// LottieGen version:
-// 8.0.280225.1+7cd366a738
+// 8.2.250604.1+b02a3ee244
//
// Command:
-// LottieGen -Language CSharp -Namespace CollapseLauncher.AnimatedVisuals.Lottie -Public -WinUIVersion 3.0 -InputFile LoadingSprite.lottie
+// LottieGen -GenerateColorBindings -GenerateDependencyObject -Language CSharp -Namespace CollapseLauncher.AnimatedVisuals.Lottie -Public -WinUIVersion 3.0 -InputFile LoadingSprite.json
//
// Input file:
-// LoadingSprite.lottie (1342 bytes created 20:17+07:00 May 23 2024)
+// LoadingSprite.json (5570 bytes created 16:59+07:00 Jan 4 2026)
//
// LottieGen source:
// http://aka.ms/Lottie
@@ -21,16 +21,16 @@
// ____________________________________
// | Object stats | Count |
// |__________________________|_______|
-// | All CompositionObjects | 92 |
+// | All CompositionObjects | 97 |
// |--------------------------+-------|
-// | Expression animators | 6 |
+// | Expression animators | 8 |
// | KeyFrame animators | 17 |
-// | Reference parameters | 6 |
-// | Expression operations | 0 |
+// | Reference parameters | 8 |
+// | Expression operations | 8 |
// |--------------------------+-------|
-// | Animated brushes | - |
+// | Animated brushes | 2 |
// | Animated gradient stops | - |
-// | ExpressionAnimations | 6 |
+// | ExpressionAnimations | 8 |
// | PathKeyFrameAnimations | - |
// |--------------------------+-------|
// | ContainerVisuals | 1 |
@@ -44,6 +44,7 @@
// | CompositionVisualSurface | - |
// ------------------------------------
using Microsoft.UI.Composition;
+using Microsoft.UI.Xaml;
using System;
using System.Collections.Generic;
using System.Numerics;
@@ -55,13 +56,72 @@ namespace CollapseLauncher.AnimatedVisuals.Lottie
// Frame rate: 60 fps
// Frame count: 180
// Duration: 3000.0 mS
- sealed partial class LoadingSprite
- : Microsoft.UI.Xaml.Controls.IAnimatedVisualSource
+ public sealed partial class LoadingSprite :
+ DependencyObject
+ , Microsoft.UI.Xaml.Controls.IAnimatedVisualSource
, Microsoft.UI.Xaml.Controls.IAnimatedVisualSource2
{
// Animation duration: 3.000 seconds.
internal const long c_durationTicks = 30000000;
+ // Theme property: Color_000000.
+ internal static readonly Color c_themeColor_000000 = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
+
+ // Theme property: Color_FFFFFF.
+ internal static readonly Color c_themeColor_FFFFFF = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
+
+ CompositionPropertySet _themeProperties;
+
+ ///
+ /// Dependency property for Color_000000.
+ ///
+ public static readonly DependencyProperty Color_000000Property =
+ DependencyProperty.Register("Color_000000", typeof(Color), typeof(LoadingSprite),
+ new PropertyMetadata(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), OnColor_000000Changed));
+
+ ///
+ /// Dependency property for Color_FFFFFF.
+ ///
+ public static readonly DependencyProperty Color_FFFFFFProperty =
+ DependencyProperty.Register("Color_FFFFFF", typeof(Color), typeof(LoadingSprite),
+ new PropertyMetadata(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF), OnColor_FFFFFFChanged));
+
+ // Theme properties.
+ public Color Color_000000
+ {
+ get => (Color)GetValue(Color_000000Property);
+ set => SetValue(Color_000000Property, value);
+ }
+
+ public Color Color_FFFFFF
+ {
+ get => (Color)GetValue(Color_FFFFFFProperty);
+ set => SetValue(Color_FFFFFFProperty, value);
+ }
+
+ static Vector4 ColorAsVector4(Color color) => new Vector4(color.R, color.G, color.B, color.A);
+
+ static void OnColor_000000Changed(DependencyObject d, DependencyPropertyChangedEventArgs args)
+ {
+ ((LoadingSprite)d)._themeProperties?.InsertVector4("Color_000000", ColorAsVector4((Color)(Color)args.NewValue));
+ }
+
+ static void OnColor_FFFFFFChanged(DependencyObject d, DependencyPropertyChangedEventArgs args)
+ {
+ ((LoadingSprite)d)._themeProperties?.InsertVector4("Color_FFFFFF", ColorAsVector4((Color)(Color)args.NewValue));
+ }
+
+ CompositionPropertySet EnsureThemeProperties(Compositor compositor)
+ {
+ if (_themeProperties == null)
+ {
+ _themeProperties = compositor.CreatePropertySet();
+ _themeProperties.InsertVector4("Color_000000", ColorAsVector4((Color)Color_000000));
+ _themeProperties.InsertVector4("Color_FFFFFF", ColorAsVector4((Color)Color_FFFFFF));
+ }
+ return _themeProperties;
+ }
+
public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compositor compositor)
{
object ignored = null;
@@ -71,10 +131,12 @@ public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compos
public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compositor compositor, out object diagnostics)
{
diagnostics = null;
+ EnsureThemeProperties(compositor);
var res =
new LoadingSprite_AnimatedVisual(
- compositor
+ compositor,
+ _themeProperties
);
res.CreateAnimations();
return res;
@@ -118,6 +180,23 @@ public double FrameToProgress(double frameNumber)
///
public void SetColorProperty(string propertyName, Color value)
{
+ if (propertyName == "Color_000000")
+ {
+ Color_000000 = value;
+ }
+ else if (propertyName == "Color_FFFFFF")
+ {
+ Color_FFFFFF = value;
+ }
+ else
+ {
+ return;
+ }
+
+ if (_themeProperties != null)
+ {
+ _themeProperties.InsertVector4(propertyName, ColorAsVector4(value));
+ }
}
///
@@ -135,8 +214,10 @@ sealed partial class LoadingSprite_AnimatedVisual
const long c_durationTicks = 30000000;
readonly Compositor _c;
readonly ExpressionAnimation _reusableExpressionAnimation;
+ readonly CompositionPropertySet _themeProperties;
AnimationController _animationController_0;
- CompositionColorBrush _colorBrush_White;
+ CompositionColorBrush _themeColor_Color_000000;
+ CompositionColorBrush _themeColor_Color_FFFFFF;
CompositionContainerShape _containerShape_0;
CompositionContainerShape _containerShape_1;
CompositionContainerShape _containerShape_2;
@@ -150,9 +231,9 @@ sealed partial class LoadingSprite_AnimatedVisual
CubicBezierEasingFunction _cubicBezierEasingFunction_2;
CubicBezierEasingFunction _cubicBezierEasingFunction_3;
CubicBezierEasingFunction _cubicBezierEasingFunction_4;
- ScalarKeyFrameAnimation _scalarAnimation_0p85_to_1;
- ScalarKeyFrameAnimation _scalarAnimation_1_to_1_0;
- ScalarKeyFrameAnimation _scalarAnimation_1_to_1_1;
+ ScalarKeyFrameAnimation _scalarAnimation_0p2_to_0p2_0;
+ ScalarKeyFrameAnimation _scalarAnimation_0p2_to_0p2_1;
+ ScalarKeyFrameAnimation _scalarAnimation_0p17_to_0p2;
StepEasingFunction _holdThenStepEasingFunction;
StepEasingFunction _stepThenHoldEasingFunction;
@@ -211,16 +292,22 @@ AnimationController AnimationController_0()
// - - Layer aggregator
// ShapeGroup: Rectangle 1 Offset:<-2.5, -4>
- CompositionColorBrush ColorBrush_SemiTransparentBlack()
+ // Color bound to theme property value: Color_000000
+ CompositionColorBrush ThemeColor_Color_000000()
{
- return _c.CreateColorBrush(Color.FromArgb(0x4C, 0x00, 0x00, 0x00));
+ if (_themeColor_Color_000000 != null) { return _themeColor_Color_000000; }
+ var result = _themeColor_Color_000000 = _c.CreateColorBrush();
+ BindProperty(_themeColor_Color_000000, "Color", "ColorRGB(_theme.Color_000000.W*0.3,_theme.Color_000000.X,_theme.Color_000000.Y,_theme.Color_000000.Z)", "_theme", _themeProperties);
+ return result;
}
- CompositionColorBrush ColorBrush_White()
+ // Color bound to theme property value: Color_FFFFFF
+ CompositionColorBrush ThemeColor_Color_FFFFFF()
{
- return (_colorBrush_White == null)
- ? _colorBrush_White = _c.CreateColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF))
- : _colorBrush_White;
+ if (_themeColor_Color_FFFFFF != null) { return _themeColor_Color_FFFFFF; }
+ var result = _themeColor_Color_FFFFFF = _c.CreateColorBrush();
+ BindProperty(_themeColor_Color_FFFFFF, "Color", "ColorRGB(_theme.Color_FFFFFF.W,_theme.Color_FFFFFF.X,_theme.Color_FFFFFF.Y,_theme.Color_FFFFFF.Z)", "_theme", _themeProperties);
+ return result;
}
// Layer aggregator
@@ -229,7 +316,7 @@ CompositionContainerShape ContainerShape_0()
if (_containerShape_0 != null) { return _containerShape_0; }
var result = _containerShape_0 = _c.CreateContainerShape();
result.CenterPoint = new Vector2(-2.5F, -4F);
- result.Offset = new Vector2(322.5F, 324F);
+ result.Offset = new Vector2(66.5F, 68F);
// ShapeGroup: Rectangle 1 Offset:<-2.5, -4>
result.Shapes.Add(SpriteShape_0());
return result;
@@ -241,7 +328,7 @@ CompositionContainerShape ContainerShape_1()
if (_containerShape_1 != null) { return _containerShape_1; }
var result = _containerShape_1 = _c.CreateContainerShape();
result.CenterPoint = new Vector2(15.75F, 4.75F);
- result.Offset = new Vector2(304.25F, 315.25F);
+ result.Offset = new Vector2(48.25F, 59.25F);
// ShapeGroup: Ellipse 1 Offset:<15.75, 4.75>
result.Shapes.Add(SpriteShape_1());
return result;
@@ -265,7 +352,7 @@ CompositionContainerShape ContainerShape_3()
if (_containerShape_3 != null) { return _containerShape_3; }
var result = _containerShape_3 = _c.CreateContainerShape();
result.CenterPoint = new Vector2(15.75F, 4.75F);
- result.Offset = new Vector2(304.25F, 315.25F);
+ result.Offset = new Vector2(48.25F, 59.25F);
// ShapeGroup: Ellipse 1 Offset:<15.75, 4.75>
result.Shapes.Add(SpriteShape_2());
return result;
@@ -319,7 +406,7 @@ CompositionSpriteShape SpriteShape_0()
{
// Offset:<-2.5, -4>
var geometry = RoundedRectangle_291();
- var result = CreateSpriteShape(geometry, new Matrix3x2(1F, 0F, 0F, 1F, -2.5F, -4F), ColorBrush_SemiTransparentBlack());;
+ var result = CreateSpriteShape(geometry, new Matrix3x2(1F, 0F, 0F, 1F, -2.5F, -4F), ThemeColor_Color_000000());;
return result;
}
@@ -329,7 +416,7 @@ CompositionSpriteShape SpriteShape_1()
{
// Offset:<15.75, 4.75>
var result = CreateSpriteShape(Ellipse_84p25_0(), new Matrix3x2(1F, 0F, 0F, 1F, 15.75F, 4.75F));;
- result.StrokeBrush = ColorBrush_White();
+ result.StrokeBrush = ThemeColor_Color_FFFFFF();
result.StrokeDashCap = CompositionStrokeCap.Round;
result.StrokeStartCap = CompositionStrokeCap.Round;
result.StrokeEndCap = CompositionStrokeCap.Round;
@@ -344,7 +431,7 @@ CompositionSpriteShape SpriteShape_2()
{
// Offset:<15.75, 4.75>
var result = CreateSpriteShape(Ellipse_84p25_1(), new Matrix3x2(1F, 0F, 0F, 1F, 15.75F, 4.75F));;
- result.StrokeBrush = ColorBrush_White();
+ result.StrokeBrush = ThemeColor_Color_FFFFFF();
result.StrokeDashCap = CompositionStrokeCap.Round;
result.StrokeStartCap = CompositionStrokeCap.Round;
result.StrokeEndCap = CompositionStrokeCap.Round;
@@ -455,47 +542,47 @@ ScalarKeyFrameAnimation RoundnessScalarAnimation_25_to_25()
}
// Scale
- ScalarKeyFrameAnimation ScalarAnimation_0p85_to_1()
+ ScalarKeyFrameAnimation ScalarAnimation_0p2_to_0p2_0()
{
// Frame 0.
- if (_scalarAnimation_0p85_to_1 != null) { return _scalarAnimation_0p85_to_1; }
- var result = _scalarAnimation_0p85_to_1 = CreateScalarKeyFrameAnimation(0F, 0.850000024F, StepThenHoldEasingFunction());
- // Frame 100.
- result.InsertKeyFrame(0.555555582F, 0.850000024F, HoldThenStepEasingFunction());
- // Frame 120.
- result.InsertKeyFrame(0.666666687F, 1F, CubicBezierEasingFunction_0());
+ if (_scalarAnimation_0p2_to_0p2_0 != null) { return _scalarAnimation_0p2_to_0p2_0; }
+ var result = _scalarAnimation_0p2_to_0p2_0 = CreateScalarKeyFrameAnimation(0F, 0.200000003F, StepThenHoldEasingFunction());
+ // Frame 10.
+ result.InsertKeyFrame(0.055555556F, 0.200000003F, HoldThenStepEasingFunction());
+ // Frame 30.
+ result.InsertKeyFrame(0.166666672F, 0.150000006F, CubicBezierEasingFunction_0());
+ // Frame 90.
+ result.InsertKeyFrame(0.5F, 0.150000006F, _c.CreateCubicBezierEasingFunction(new Vector2(0.166999996F, 0F), new Vector2(0.666999996F, 1F)));
+ // Frame 110.
+ result.InsertKeyFrame(0.611111104F, 0.200000003F, _c.CreateCubicBezierEasingFunction(new Vector2(0.333000004F, 0F), new Vector2(0.666999996F, 1F)));
return result;
}
// Scale
- ScalarKeyFrameAnimation ScalarAnimation_1_to_1_0()
+ ScalarKeyFrameAnimation ScalarAnimation_0p2_to_0p2_1()
{
// Frame 0.
- if (_scalarAnimation_1_to_1_0 != null) { return _scalarAnimation_1_to_1_0; }
- var result = _scalarAnimation_1_to_1_0 = CreateScalarKeyFrameAnimation(0F, 1F, StepThenHoldEasingFunction());
- // Frame 10.
- result.InsertKeyFrame(0.055555556F, 1F, HoldThenStepEasingFunction());
- // Frame 30.
- result.InsertKeyFrame(0.166666672F, 0.75F, CubicBezierEasingFunction_0());
+ if (_scalarAnimation_0p2_to_0p2_1 != null) { return _scalarAnimation_0p2_to_0p2_1; }
+ var result = _scalarAnimation_0p2_to_0p2_1 = CreateScalarKeyFrameAnimation(0F, 0.200000003F, HoldThenStepEasingFunction());
+ // Frame 20.
+ result.InsertKeyFrame(0.111111112F, 0.170000002F, _c.CreateCubicBezierEasingFunction(new Vector2(0.333000004F, 0F), new Vector2(0.833000004F, 0.833000004F)));
// Frame 90.
- result.InsertKeyFrame(0.5F, 0.75F, _c.CreateCubicBezierEasingFunction(new Vector2(0.166999996F, 0F), new Vector2(0.666999996F, 1F)));
+ result.InsertKeyFrame(0.5F, 0.170000002F, _c.CreateCubicBezierEasingFunction(new Vector2(0.166999996F, 0F), new Vector2(0.460000008F, 1F)));
// Frame 110.
- result.InsertKeyFrame(0.611111104F, 1F, _c.CreateCubicBezierEasingFunction(new Vector2(0.333000004F, 0F), new Vector2(0.666999996F, 1F)));
+ result.InsertKeyFrame(0.611111104F, 0.200000003F, CubicBezierEasingFunction_0());
return result;
}
// Scale
- ScalarKeyFrameAnimation ScalarAnimation_1_to_1_1()
+ ScalarKeyFrameAnimation ScalarAnimation_0p17_to_0p2()
{
// Frame 0.
- if (_scalarAnimation_1_to_1_1 != null) { return _scalarAnimation_1_to_1_1; }
- var result = _scalarAnimation_1_to_1_1 = CreateScalarKeyFrameAnimation(0F, 1F, HoldThenStepEasingFunction());
- // Frame 20.
- result.InsertKeyFrame(0.111111112F, 0.850000024F, _c.CreateCubicBezierEasingFunction(new Vector2(0.333000004F, 0F), new Vector2(0.833000004F, 0.833000004F)));
- // Frame 90.
- result.InsertKeyFrame(0.5F, 0.850000024F, _c.CreateCubicBezierEasingFunction(new Vector2(0.166999996F, 0F), new Vector2(0.460000008F, 1F)));
- // Frame 110.
- result.InsertKeyFrame(0.611111104F, 1F, CubicBezierEasingFunction_0());
+ if (_scalarAnimation_0p17_to_0p2 != null) { return _scalarAnimation_0p17_to_0p2; }
+ var result = _scalarAnimation_0p17_to_0p2 = CreateScalarKeyFrameAnimation(0F, 0.170000002F, StepThenHoldEasingFunction());
+ // Frame 100.
+ result.InsertKeyFrame(0.555555582F, 0.170000002F, HoldThenStepEasingFunction());
+ // Frame 120.
+ result.InsertKeyFrame(0.666666687F, 0.200000003F, CubicBezierEasingFunction_0());
return result;
}
@@ -587,7 +674,7 @@ ScalarKeyFrameAnimation TStartScalarAnimation_0_to_0p5_1()
ShapeVisual ShapeVisual_0()
{
var result = _c.CreateShapeVisual();
- result.Size = new Vector2(640F, 640F);
+ result.Size = new Vector2(128F, 128F);
var shapes = result.Shapes;
shapes.Add(ContainerShape_0());
shapes.Add(ContainerShape_1());
@@ -624,31 +711,33 @@ Vector2KeyFrameAnimation ShapeVisibilityAnimation()
}
internal LoadingSprite_AnimatedVisual(
- Compositor compositor
+ Compositor compositor,
+ CompositionPropertySet themeProperties
)
{
_c = compositor;
+ _themeProperties = themeProperties;
_reusableExpressionAnimation = compositor.CreateExpressionAnimation();
Root();
}
public Visual RootVisual => _root;
public TimeSpan Duration => TimeSpan.FromTicks(c_durationTicks);
- public Vector2 Size => new Vector2(640F, 640F);
+ public Vector2 Size => new Vector2(128F, 128F);
void IDisposable.Dispose() => _root?.Dispose();
public void CreateAnimations()
{
_containerShape_0.StartAnimation("RotationAngleInDegrees", RotationAngleInDegreesScalarAnimation_45_to_135(), AnimationController_0());
- _containerShape_0.StartAnimation("Scale.X", ScalarAnimation_1_to_1_0(), AnimationController_0());
- _containerShape_0.StartAnimation("Scale.Y", ScalarAnimation_1_to_1_0(), AnimationController_0());
+ _containerShape_0.StartAnimation("Scale.X", ScalarAnimation_0p2_to_0p2_0(), AnimationController_0());
+ _containerShape_0.StartAnimation("Scale.Y", ScalarAnimation_0p2_to_0p2_0(), AnimationController_0());
_containerShape_1.StartAnimation("RotationAngleInDegrees", RotationAngleInDegreesScalarAnimation_180_to_900_0(), AnimationController_0());
- _containerShape_1.StartAnimation("Scale.X", ScalarAnimation_1_to_1_1(), AnimationController_0());
- _containerShape_1.StartAnimation("Scale.Y", ScalarAnimation_1_to_1_1(), AnimationController_0());
+ _containerShape_1.StartAnimation("Scale.X", ScalarAnimation_0p2_to_0p2_1(), AnimationController_0());
+ _containerShape_1.StartAnimation("Scale.Y", ScalarAnimation_0p2_to_0p2_1(), AnimationController_0());
_containerShape_2.StartAnimation("Scale", ShapeVisibilityAnimation(), AnimationController_0());
_containerShape_3.StartAnimation("RotationAngleInDegrees", RotationAngleInDegreesScalarAnimation_180_to_900_1(), AnimationController_0());
- _containerShape_3.StartAnimation("Scale.X", ScalarAnimation_0p85_to_1(), AnimationController_0());
- _containerShape_3.StartAnimation("Scale.Y", ScalarAnimation_0p85_to_1(), AnimationController_0());
+ _containerShape_3.StartAnimation("Scale.X", ScalarAnimation_0p17_to_0p2(), AnimationController_0());
+ _containerShape_3.StartAnimation("Scale.Y", ScalarAnimation_0p17_to_0p2(), AnimationController_0());
_ellipse_84p25_0.StartAnimation("TStart", TStartScalarAnimation_0_to_0p5_0(), AnimationController_0());
_ellipse_84p25_0.StartAnimation("TEnd", TEndScalarAnimation_0_to_0p5_0(), AnimationController_0());
_ellipse_84p25_0.StartAnimation("TrimOffset", TrimOffsetScalarAnimation_0_to_0p5_0(), AnimationController_0());
diff --git a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/LoadingSprite.json b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/LoadingSprite.json
new file mode 100644
index 0000000000..066b5ce055
--- /dev/null
+++ b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/LoadingSprite.json
@@ -0,0 +1 @@
+{"v":"5.12.2","fr":60,"ip":0,"op":180,"w":128,"h":128,"nm":"LoadingSprite","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 4","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":90,"s":[180]},{"t":180,"s":[900]}],"ix":10},"p":{"a":0,"k":[64,64,0],"ix":2,"l":2},"a":{"a":0,"k":[15.75,4.75,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0,0,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":100,"s":[17,17,100]},{"t":120,"s":[20,20,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[168.5,168.5],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":26,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[15.75,4.75],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":90,"s":[0]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":120,"s":[50]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":150,"s":[50]},{"t":180,"s":[50]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":150,"s":[0]},{"t":180,"s":[50]}],"ix":2},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":120,"s":[0]},{"t":150,"s":[180]}],"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":90,"op":271,"st":90,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[180]},{"t":90,"s":[900]}],"ix":10},"p":{"a":0,"k":[64,64,0],"ix":2,"l":2},"a":{"a":0,"k":[15.75,4.75,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":0,"s":[20,20,100]},{"i":{"x":[0.46,0.46,0.667],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0,0,0]},"t":20,"s":[17,17,100]},{"i":{"x":[0,0,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":90,"s":[17,17,100]},{"t":110,"s":[20,20,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[168.5,168.5],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":26,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[15.75,4.75],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":30,"s":[50]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":60,"s":[50]},{"t":90,"s":[50]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":60,"s":[0]},{"t":90,"s":[50]}],"ix":2},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":30,"s":[0]},{"t":60,"s":[180]}],"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":181,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Shape Layer 3","sr":1,"ks":{"o":{"a":0,"k":30,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[45]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":60,"s":[90]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":90,"s":[90]},{"t":150,"s":[135]}],"ix":10},"p":{"a":0,"k":[64,64,0],"ix":2,"l":2},"a":{"a":0,"k":[-2.5,-4,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0,0,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":10,"s":[20,20,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0,0,0]},"t":30,"s":[15,15,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":90,"s":[15,15,100]},{"t":110,"s":[20,20,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[291,291],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[25]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":60,"s":[125]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":90,"s":[125]},{"t":150,"s":[25]}],"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-2.5,-4],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":182,"st":0,"ct":1,"bm":0}],"markers":[],"props":{}}
\ No newline at end of file
diff --git a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/LoadingSprite.lottie b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/LoadingSprite.lottie
deleted file mode 100644
index 357515fa60..0000000000
Binary files a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/LoadingSprite.lottie and /dev/null differ
diff --git a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/StartGameIcon.cs b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/StartGameIcon.cs
index 8478138ac8..fdbcf99b25 100644
--- a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/StartGameIcon.cs
+++ b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/StartGameIcon.cs
@@ -3,13 +3,13 @@
// This code was generated by a tool.
//
// LottieGen version:
-// 8.0.280225.1+7cd366a738
+// 8.2.250604.1+b02a3ee244
//
// Command:
-// LottieGen -Language CSharp -Namespace CollapseLauncher.AnimatedVisuals.Lottie -Public -WinUIVersion 3.0 -InputFile StartGameIcon.lottie
+// LottieGen -GenerateColorBindings -GenerateDependencyObject -Language CSharp -Namespace CollapseLauncher.AnimatedVisuals.Lottie -Public -WinUIVersion 3.0 -InputFile StartGameIcon.json
//
// Input file:
-// StartGameIcon.lottie (1259 bytes created 0:25+07:00 Jun 2 2024)
+// StartGameIcon.json (8234 bytes created 16:59+07:00 Jan 4 2026)
//
// LottieGen source:
// http://aka.ms/Lottie
@@ -21,16 +21,16 @@
// ____________________________________
// | Object stats | Count |
// |__________________________|_______|
-// | All CompositionObjects | 70 |
+// | All CompositionObjects | 77 |
// |--------------------------+-------|
-// | Expression animators | 9 |
+// | Expression animators | 12 |
// | KeyFrame animators | 6 |
-// | Reference parameters | 9 |
-// | Expression operations | 6 |
+// | Reference parameters | 15 |
+// | Expression operations | 18 |
// |--------------------------+-------|
// | Animated brushes | 3 |
// | Animated gradient stops | - |
-// | ExpressionAnimations | 9 |
+// | ExpressionAnimations | 12 |
// | PathKeyFrameAnimations | - |
// |--------------------------+-------|
// | ContainerVisuals | 1 |
@@ -44,6 +44,8 @@
// | CompositionVisualSurface | - |
// ------------------------------------
using Microsoft.UI.Composition;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Media;
using System;
using System.Collections.Generic;
using System.Numerics;
@@ -55,13 +57,67 @@ namespace CollapseLauncher.AnimatedVisuals.Lottie
// Frame rate: 60 fps
// Frame count: 40
// Duration: 666.7 mS
- sealed partial class StartGameIcon
- : Microsoft.UI.Xaml.Controls.IAnimatedVisualSource
+ public sealed partial class StartGameIcon
+ : BindableThemeChangeAnimation
+ , Microsoft.UI.Xaml.Controls.IAnimatedVisualSource
, Microsoft.UI.Xaml.Controls.IAnimatedVisualSource2
{
+ protected override void OnForegroundChanged(Brush brush)
+ {
+ if (brush is SolidColorBrush colorBrush)
+ {
+ Color_FFFFFF = colorBrush.Color;
+ return;
+ }
+
+ if (brush is AcrylicBrush acrylicBrush)
+ {
+ Color_FFFFFF = acrylicBrush.TintColor;
+ return;
+ }
+ }
+
+ private static Color GetForegroundColor(bool isLightTheme) =>
+ isLightTheme
+ ? Color.FromArgb(0xFF, 0x00, 0x00, 0x00)
+ : Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
+
// Animation duration: 0.667 seconds.
internal const long c_durationTicks = 6666666;
+ CompositionPropertySet _themeProperties;
+
+ ///
+ /// Dependency property for Color_FFFFFF.
+ ///
+ public static readonly DependencyProperty Color_FFFFFFProperty =
+ DependencyProperty.Register("Color_FFFFFF", typeof(Color), typeof(StartGameIcon),
+ new PropertyMetadata(GetForegroundColor(InnerLauncherConfig.IsAppThemeLight), OnColor_FFFFFFChanged));
+
+ // Theme properties.
+ public Color Color_FFFFFF
+ {
+ get => (Color)GetValue(Color_FFFFFFProperty);
+ set => SetValue(Color_FFFFFFProperty, value);
+ }
+
+ static Vector4 ColorAsVector4(Color color) => new Vector4(color.R, color.G, color.B, color.A);
+
+ static void OnColor_FFFFFFChanged(DependencyObject d, DependencyPropertyChangedEventArgs args)
+ {
+ ((StartGameIcon)d)._themeProperties?.InsertVector4("Color_FFFFFF", ColorAsVector4((Color)(Color)args.NewValue));
+ }
+
+ CompositionPropertySet EnsureThemeProperties(Compositor compositor)
+ {
+ if (_themeProperties == null)
+ {
+ _themeProperties = compositor.CreatePropertySet();
+ _themeProperties.InsertVector4("Color_FFFFFF", ColorAsVector4((Color)Color_FFFFFF));
+ }
+ return _themeProperties;
+ }
+
public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compositor compositor)
{
object ignored = null;
@@ -71,10 +127,12 @@ public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compos
public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compositor compositor, out object diagnostics)
{
diagnostics = null;
+ EnsureThemeProperties(compositor);
var res =
new StartGameIcon_AnimatedVisual(
- compositor
+ compositor,
+ _themeProperties
);
res.CreateAnimations();
return res;
@@ -118,6 +176,19 @@ public double FrameToProgress(double frameNumber)
///
public void SetColorProperty(string propertyName, Color value)
{
+ if (propertyName == "Color_FFFFFF")
+ {
+ Color_FFFFFF = value;
+ }
+ else
+ {
+ return;
+ }
+
+ if (_themeProperties != null)
+ {
+ _themeProperties.InsertVector4(propertyName, ColorAsVector4(value));
+ }
}
///
@@ -133,19 +204,18 @@ sealed partial class StartGameIcon_AnimatedVisual
, Microsoft.UI.Xaml.Controls.IAnimatedVisual2
{
const long c_durationTicks = 6666666;
- readonly Color _color = InnerLauncherConfig.IsAppThemeLight ? Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF) : Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
- readonly Color _colorTransparent = InnerLauncherConfig.IsAppThemeLight ? Color.FromArgb(0x00, 0xFF, 0xFF, 0xFF) : Color.FromArgb(0x00, 0x00, 0x00, 0x00);
readonly Compositor _c;
readonly ExpressionAnimation _reusableExpressionAnimation;
+ readonly CompositionPropertySet _themeProperties;
AnimationController _animationController_0;
AnimationController _animationController_1;
AnimationController _animationController_2;
AnimationController _animationController_3;
AnimationController _animationController_4;
AnimationController _animationController_5;
- CompositionColorBrush _animatedColorBrush_TransparentWhite_to_White;
- CompositionColorBrush _animatedColorBrush_White_to_TransparentWhite;
- CompositionColorBrush _animatedColorBrush_White_to_White;
+ CompositionColorBrush _themeColor_Color_FFFFFF_0;
+ CompositionColorBrush _themeColor_Color_FFFFFF_1;
+ CompositionColorBrush _themeColor_Color_FFFFFF_2;
CompositionContainerShape _containerShape_0;
CompositionContainerShape _containerShape_1;
CompositionContainerShape _containerShape_2;
@@ -153,7 +223,7 @@ sealed partial class StartGameIcon_AnimatedVisual
ContainerVisual _root;
CubicBezierEasingFunction _cubicBezierEasingFunction_0;
CubicBezierEasingFunction _cubicBezierEasingFunction_1;
- ScalarKeyFrameAnimation _positionXScalarAnimation_m92_to_993;
+ ScalarKeyFrameAnimation _positionXScalarAnimation_m11p5_to_124p125;
StepEasingFunction _holdThenStepEasingFunction;
void BindProperty(
@@ -169,13 +239,20 @@ void BindProperty(
target.StartAnimation(animatedPropertyName, _reusableExpressionAnimation);
}
- ColorKeyFrameAnimation CreateColorKeyFrameAnimation(float initialProgress, Color initialValue, CompositionEasingFunction initialEasingFunction)
+ void BindProperty2(
+ CompositionObject target,
+ string animatedPropertyName,
+ string expression,
+ string referenceParameterName0,
+ CompositionObject referencedObject0,
+ string referenceParameterName1,
+ CompositionObject referencedObject1)
{
- var result = _c.CreateColorKeyFrameAnimation();
- result.Duration = TimeSpan.FromTicks(c_durationTicks);
- result.InterpolationColorSpace = CompositionColorSpace.Rgb;
- result.InsertKeyFrame(initialProgress, initialValue, initialEasingFunction);
- return result;
+ _reusableExpressionAnimation.ClearAllParameters();
+ _reusableExpressionAnimation.Expression = expression;
+ _reusableExpressionAnimation.SetReferenceParameter(referenceParameterName0, referencedObject0);
+ _reusableExpressionAnimation.SetReferenceParameter(referenceParameterName1, referencedObject1);
+ target.StartAnimation(animatedPropertyName, _reusableExpressionAnimation);
}
ScalarKeyFrameAnimation CreateScalarKeyFrameAnimation(float initialProgress, float initialValue, CompositionEasingFunction initialEasingFunction)
@@ -193,7 +270,6 @@ CompositionSpriteShape CreateSpriteShape(CompositionGeometry geometry, Matrix3x2
return result;
}
- // - ShapeGroup: Rectangle 1 Offset:<30, 198>
AnimationController AnimationController_0()
{
if (_animationController_0 != null) { return _animationController_0; }
@@ -212,7 +288,6 @@ AnimationController AnimationController_1()
return result;
}
- // - ShapeGroup: Rectangle 1 Offset:<30, 198>
AnimationController AnimationController_2()
{
if (_animationController_2 != null) { return _animationController_2; }
@@ -231,7 +306,6 @@ AnimationController AnimationController_3()
return result;
}
- // - ShapeGroup: Rectangle 1 Offset:<30, 198>
AnimationController AnimationController_4()
{
if (_animationController_4 != null) { return _animationController_4; }
@@ -250,69 +324,39 @@ AnimationController AnimationController_5()
return result;
}
- // - ShapeGroup: Rectangle 1 Offset:<30, 198>
- // Color
- ColorKeyFrameAnimation ColorAnimation_TransparentWhite_to_White()
- {
- // Frame 0.
- var result = CreateColorKeyFrameAnimation(0F, _colorTransparent, HoldThenStepEasingFunction());
- // Frame 8.91.
- // White
- result.InsertKeyFrame(0.222662598F, _color, CubicBezierEasingFunction_0());
- // Frame 40.
- // White
- result.InsertKeyFrame(1F, _color, CubicBezierEasingFunction_1());
- return result;
- }
-
- // - ShapeGroup: Rectangle 1 Offset:<30, 198>
- // Color
- ColorKeyFrameAnimation ColorAnimation_White_to_TransparentWhite()
- {
- // Frame 0.
- var result = CreateColorKeyFrameAnimation(0F, _color, CubicBezierEasingFunction_0());
- // Frame 27.93.
- // White
- result.InsertKeyFrame(0.698220015F, _color, CubicBezierEasingFunction_1());
- // Frame 40.
- // TransparentWhite
- result.InsertKeyFrame(0.99998045F, _colorTransparent, CubicBezierEasingFunction_0());
- return result;
- }
-
- // - ShapeGroup: Rectangle 1 Offset:<30, 198>
- // Color
- ColorKeyFrameAnimation ColorAnimation_White_to_White()
- {
- // Frame 0.
- var result = CreateColorKeyFrameAnimation(0F, _color, CubicBezierEasingFunction_0());
- // Frame 40.
- // White
- result.InsertKeyFrame(1F, _color, CubicBezierEasingFunction_1());
- return result;
- }
-
// ShapeGroup: Rectangle 1 Offset:<30, 198>
- CompositionColorBrush AnimatedColorBrush_TransparentWhite_to_White()
+ // Color bound to theme property value: Color_FFFFFF
+ CompositionColorBrush ThemeColor_Color_FFFFFF_0()
{
- if (_animatedColorBrush_TransparentWhite_to_White != null) { return _animatedColorBrush_TransparentWhite_to_White; }
- var result = _animatedColorBrush_TransparentWhite_to_White = _c.CreateColorBrush();
+ if (_themeColor_Color_FFFFFF_0 != null) { return _themeColor_Color_FFFFFF_0; }
+ var result = _themeColor_Color_FFFFFF_0 = _c.CreateColorBrush();
+ var propertySet = result.Properties;
+ propertySet.InsertScalar("Opacity0", 1F);
+ BindProperty2(_themeColor_Color_FFFFFF_0, "Color", "ColorRGB(_theme.Color_FFFFFF.W*my.Opacity0,_theme.Color_FFFFFF.X,_theme.Color_FFFFFF.Y,_theme.Color_FFFFFF.Z)", "_theme", _themeProperties, "my", propertySet);
return result;
}
// ShapeGroup: Rectangle 1 Offset:<30, 198>
- CompositionColorBrush AnimatedColorBrush_White_to_TransparentWhite()
+ // Color bound to theme property value: Color_FFFFFF
+ CompositionColorBrush ThemeColor_Color_FFFFFF_1()
{
- if (_animatedColorBrush_White_to_TransparentWhite != null) { return _animatedColorBrush_White_to_TransparentWhite; }
- var result = _animatedColorBrush_White_to_TransparentWhite = _c.CreateColorBrush();
+ if (_themeColor_Color_FFFFFF_1 != null) { return _themeColor_Color_FFFFFF_1; }
+ var result = _themeColor_Color_FFFFFF_1 = _c.CreateColorBrush();
+ var propertySet = result.Properties;
+ propertySet.InsertScalar("Opacity0", 1F);
+ BindProperty2(_themeColor_Color_FFFFFF_1, "Color", "ColorRGB(_theme.Color_FFFFFF.W*my.Opacity0,_theme.Color_FFFFFF.X,_theme.Color_FFFFFF.Y,_theme.Color_FFFFFF.Z)", "_theme", _themeProperties, "my", propertySet);
return result;
}
// ShapeGroup: Rectangle 1 Offset:<30, 198>
- CompositionColorBrush AnimatedColorBrush_White_to_White()
+ // Color bound to theme property value: Color_FFFFFF
+ CompositionColorBrush ThemeColor_Color_FFFFFF_2()
{
- if (_animatedColorBrush_White_to_White != null) { return _animatedColorBrush_White_to_White; }
- var result = _animatedColorBrush_White_to_White = _c.CreateColorBrush();
+ if (_themeColor_Color_FFFFFF_2 != null) { return _themeColor_Color_FFFFFF_2; }
+ var result = _themeColor_Color_FFFFFF_2 = _c.CreateColorBrush();
+ var propertySet = result.Properties;
+ propertySet.InsertScalar("Opacity0", 0F);
+ BindProperty2(_themeColor_Color_FFFFFF_2, "Color", "ColorRGB(_theme.Color_FFFFFF.W*my.Opacity0,_theme.Color_FFFFFF.X,_theme.Color_FFFFFF.Y,_theme.Color_FFFFFF.Z)", "_theme", _themeProperties, "my", propertySet);
return result;
}
@@ -321,9 +365,10 @@ CompositionContainerShape ContainerShape_0()
if (_containerShape_0 != null) { return _containerShape_0; }
var result = _containerShape_0 = _c.CreateContainerShape();
var propertySet = result.Properties;
- propertySet.InsertVector2("Position", new Vector2(-92F, 1024F));
+ propertySet.InsertVector2("Position", new Vector2(-11.5F, 128F));
result.CenterPoint = new Vector2(30F, 198F);
result.RotationAngleInDegrees = 45F;
+ result.Scale = new Vector2(0.125F, 0.125F);
// ShapeGroup: Rectangle 1 Offset:<30, 198>
result.Shapes.Add(SpriteShape_0());
BindProperty(_containerShape_0, "Offset", "Vector2(my.Position.X-30,my.Position.Y-198)", "my", _containerShape_0);
@@ -335,9 +380,10 @@ CompositionContainerShape ContainerShape_1()
if (_containerShape_1 != null) { return _containerShape_1; }
var result = _containerShape_1 = _c.CreateContainerShape();
var propertySet = result.Properties;
- propertySet.InsertVector2("Position", new Vector2(-92F, 1024F));
+ propertySet.InsertVector2("Position", new Vector2(-11.5F, 128F));
result.CenterPoint = new Vector2(30F, 198F);
result.RotationAngleInDegrees = 45F;
+ result.Scale = new Vector2(0.125F, 0.125F);
// ShapeGroup: Rectangle 1 Offset:<30, 198>
result.Shapes.Add(SpriteShape_1());
BindProperty(_containerShape_1, "Offset", "Vector2(my.Position.X-30,my.Position.Y-198)", "my", _containerShape_1);
@@ -349,9 +395,10 @@ CompositionContainerShape ContainerShape_2()
if (_containerShape_2 != null) { return _containerShape_2; }
var result = _containerShape_2 = _c.CreateContainerShape();
var propertySet = result.Properties;
- propertySet.InsertVector2("Position", new Vector2(-92F, 1024F));
+ propertySet.InsertVector2("Position", new Vector2(-11.5F, 128F));
result.CenterPoint = new Vector2(30F, 198F);
result.RotationAngleInDegrees = 45F;
+ result.Scale = new Vector2(0.125F, 0.125F);
// ShapeGroup: Rectangle 1 Offset:<30, 198>
result.Shapes.Add(SpriteShape_2());
BindProperty(_containerShape_2, "Offset", "Vector2(my.Position.X-30,my.Position.Y-198)", "my", _containerShape_2);
@@ -376,7 +423,7 @@ CompositionSpriteShape SpriteShape_0()
{
// Offset:<30, 198>
var result = CreateSpriteShape(Rectangle_1036(), new Matrix3x2(1F, 0F, 0F, 1F, 30F, 198F));;
- result.StrokeBrush = AnimatedColorBrush_White_to_TransparentWhite();
+ result.StrokeBrush = ThemeColor_Color_FFFFFF_0();
result.StrokeDashCap = CompositionStrokeCap.Round;
result.StrokeStartCap = CompositionStrokeCap.Round;
result.StrokeEndCap = CompositionStrokeCap.Round;
@@ -390,7 +437,7 @@ CompositionSpriteShape SpriteShape_1()
{
// Offset:<30, 198>
var result = CreateSpriteShape(Rectangle_1036(), new Matrix3x2(1F, 0F, 0F, 1F, 30F, 198F));;
- result.StrokeBrush = AnimatedColorBrush_White_to_White();
+ result.StrokeBrush = ThemeColor_Color_FFFFFF_1();
result.StrokeDashCap = CompositionStrokeCap.Round;
result.StrokeStartCap = CompositionStrokeCap.Round;
result.StrokeEndCap = CompositionStrokeCap.Round;
@@ -404,7 +451,7 @@ CompositionSpriteShape SpriteShape_2()
{
// Offset:<30, 198>
var result = CreateSpriteShape(Rectangle_1036(), new Matrix3x2(1F, 0F, 0F, 1F, 30F, 198F));;
- result.StrokeBrush = AnimatedColorBrush_TransparentWhite_to_White();
+ result.StrokeBrush = ThemeColor_Color_FFFFFF_2();
result.StrokeDashCap = CompositionStrokeCap.Round;
result.StrokeStartCap = CompositionStrokeCap.Round;
result.StrokeEndCap = CompositionStrokeCap.Round;
@@ -439,14 +486,48 @@ CubicBezierEasingFunction CubicBezierEasingFunction_1()
: _cubicBezierEasingFunction_1;
}
+ // Opacity0
+ ScalarKeyFrameAnimation Opacity0ScalarAnimation_0_to_1()
+ {
+ // Frame 0.
+ var result = CreateScalarKeyFrameAnimation(0F, 0F, HoldThenStepEasingFunction());
+ // Frame 8.91.
+ result.InsertKeyFrame(0.222662598F, 1F, CubicBezierEasingFunction_0());
+ // Frame 40.
+ result.InsertKeyFrame(1F, 1F, CubicBezierEasingFunction_1());
+ return result;
+ }
+
+ // Opacity0
+ ScalarKeyFrameAnimation Opacity0ScalarAnimation_1_to_0()
+ {
+ // Frame 0.
+ var result = CreateScalarKeyFrameAnimation(0F, 1F, CubicBezierEasingFunction_0());
+ // Frame 27.93.
+ result.InsertKeyFrame(0.698220015F, 1F, CubicBezierEasingFunction_1());
+ // Frame 40.
+ result.InsertKeyFrame(0.99998045F, 0F, CubicBezierEasingFunction_0());
+ return result;
+ }
+
+ // Opacity0
+ ScalarKeyFrameAnimation Opacity0ScalarAnimation_1_to_1()
+ {
+ // Frame 0.
+ var result = CreateScalarKeyFrameAnimation(0F, 1F, CubicBezierEasingFunction_0());
+ // Frame 40.
+ result.InsertKeyFrame(1F, 1F, CubicBezierEasingFunction_1());
+ return result;
+ }
+
// Position.X
- ScalarKeyFrameAnimation PositionXScalarAnimation_m92_to_993()
+ ScalarKeyFrameAnimation PositionXScalarAnimation_m11p5_to_124p125()
{
// Frame 0.
- if (_positionXScalarAnimation_m92_to_993 != null) { return _positionXScalarAnimation_m92_to_993; }
- var result = _positionXScalarAnimation_m92_to_993 = CreateScalarKeyFrameAnimation(0F, -92F, HoldThenStepEasingFunction());
+ if (_positionXScalarAnimation_m11p5_to_124p125 != null) { return _positionXScalarAnimation_m11p5_to_124p125; }
+ var result = _positionXScalarAnimation_m11p5_to_124p125 = CreateScalarKeyFrameAnimation(0F, -11.5F, HoldThenStepEasingFunction());
// Frame 40.
- result.InsertKeyFrame(1F, 993F, _c.CreateCubicBezierEasingFunction(new Vector2(0.47299999F, 0.0659999996F), new Vector2(0.521000028F, 1F)));
+ result.InsertKeyFrame(1F, 124.125F, _c.CreateCubicBezierEasingFunction(new Vector2(0.47299999F, 0.523999989F), new Vector2(0.521000028F, 1F)));
return result;
}
@@ -454,7 +535,7 @@ ScalarKeyFrameAnimation PositionXScalarAnimation_m92_to_993()
ShapeVisual ShapeVisual_0()
{
var result = _c.CreateShapeVisual();
- result.Size = new Vector2(2048F, 2048F);
+ result.Size = new Vector2(256F, 256F);
var shapes = result.Shapes;
shapes.Add(ContainerShape_0());
shapes.Add(ContainerShape_1());
@@ -471,34 +552,36 @@ StepEasingFunction HoldThenStepEasingFunction()
}
internal StartGameIcon_AnimatedVisual(
- Compositor compositor
+ Compositor compositor,
+ CompositionPropertySet themeProperties
)
{
_c = compositor;
+ _themeProperties = themeProperties;
_reusableExpressionAnimation = compositor.CreateExpressionAnimation();
Root();
}
public Visual RootVisual => _root;
public TimeSpan Duration => TimeSpan.FromTicks(c_durationTicks);
- public Vector2 Size => new Vector2(2048F, 2048F);
+ public Vector2 Size => new Vector2(256F, 256F);
void IDisposable.Dispose() => _root?.Dispose();
public void CreateAnimations()
{
- _animatedColorBrush_TransparentWhite_to_White.StartAnimation("Color", ColorAnimation_TransparentWhite_to_White(), AnimationController_4());
- _animatedColorBrush_White_to_TransparentWhite.StartAnimation("Color", ColorAnimation_White_to_TransparentWhite(), AnimationController_0());
- _animatedColorBrush_White_to_White.StartAnimation("Color", ColorAnimation_White_to_White(), AnimationController_2());
- _containerShape_0.Properties.StartAnimation("Position.X", PositionXScalarAnimation_m92_to_993(), AnimationController_1());
- _containerShape_1.Properties.StartAnimation("Position.X", PositionXScalarAnimation_m92_to_993(), AnimationController_3());
- _containerShape_2.Properties.StartAnimation("Position.X", PositionXScalarAnimation_m92_to_993(), AnimationController_5());
+ _themeColor_Color_FFFFFF_0.Properties.StartAnimation("Opacity0", Opacity0ScalarAnimation_1_to_0(), AnimationController_0());
+ _themeColor_Color_FFFFFF_1.Properties.StartAnimation("Opacity0", Opacity0ScalarAnimation_1_to_1(), AnimationController_2());
+ _themeColor_Color_FFFFFF_2.Properties.StartAnimation("Opacity0", Opacity0ScalarAnimation_0_to_1(), AnimationController_4());
+ _containerShape_0.Properties.StartAnimation("Position.X", PositionXScalarAnimation_m11p5_to_124p125(), AnimationController_1());
+ _containerShape_1.Properties.StartAnimation("Position.X", PositionXScalarAnimation_m11p5_to_124p125(), AnimationController_3());
+ _containerShape_2.Properties.StartAnimation("Position.X", PositionXScalarAnimation_m11p5_to_124p125(), AnimationController_5());
}
public void DestroyAnimations()
{
- _animatedColorBrush_TransparentWhite_to_White.StopAnimation("Color");
- _animatedColorBrush_White_to_TransparentWhite.StopAnimation("Color");
- _animatedColorBrush_White_to_White.StopAnimation("Color");
+ _themeColor_Color_FFFFFF_0.Properties.StopAnimation("Opacity0");
+ _themeColor_Color_FFFFFF_1.Properties.StopAnimation("Opacity0");
+ _themeColor_Color_FFFFFF_2.Properties.StopAnimation("Opacity0");
_containerShape_0.Properties.StopAnimation("Position.X");
_containerShape_1.Properties.StopAnimation("Position.X");
_containerShape_2.Properties.StopAnimation("Position.X");
diff --git a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/StartGameIcon.json b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/StartGameIcon.json
new file mode 100644
index 0000000000..90563bd900
--- /dev/null
+++ b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/StartGameIcon.json
@@ -0,0 +1 @@
+{"v":"5.12.2","fr":60,"ip":0,"op":40,"w":256,"h":256,"nm":"StartGameIcon","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 5","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":79,"s":[0]},{"i":{"x":[0.413],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":99,"s":[100]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":168.822,"s":[100]},{"t":198.998046875,"s":[0]}],"ix":11},"r":{"a":0,"k":45,"ix":10},"p":{"s":true,"x":{"a":1,"k":[{"i":{"x":[0.521],"y":[1]},"o":{"x":[0.473],"y":[0.524]},"t":79,"s":[-11.5]},{"t":199,"s":[124.125]}],"ix":3},"y":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":79,"s":[128]},{"t":99,"s":[128]}],"ix":4}},"a":{"a":0,"k":[30,198,0],"ix":1,"l":2},"s":{"a":0,"k":[12.5,12.5,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[1036,1036],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"tm","s":{"a":0,"k":37,"ix":1},"e":{"a":0,"k":63,"ix":2},"o":{"a":0,"k":180,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":128,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[30,198],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":79,"op":79.6060606060606,"st":79,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 4","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":40,"s":[0]},{"i":{"x":[0.413],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":60,"s":[100]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":129.822,"s":[100]},{"t":159.998046875,"s":[0]}],"ix":11},"r":{"a":0,"k":45,"ix":10},"p":{"s":true,"x":{"a":1,"k":[{"i":{"x":[0.521],"y":[1]},"o":{"x":[0.473],"y":[0.524]},"t":40,"s":[-11.5]},{"t":160,"s":[124.125]}],"ix":3},"y":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":40,"s":[128]},{"t":60,"s":[128]}],"ix":4}},"a":{"a":0,"k":[30,198,0],"ix":1,"l":2},"s":{"a":0,"k":[12.5,12.5,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[1036,1036],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"tm","s":{"a":0,"k":37,"ix":1},"e":{"a":0,"k":63,"ix":2},"o":{"a":0,"k":180,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":128,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[30,198],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":40,"op":40.6060606060606,"st":40,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Shape Layer 3","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.413],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":20,"s":[100]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":89.822,"s":[100]},{"t":119.998046875,"s":[0]}],"ix":11},"r":{"a":0,"k":45,"ix":10},"p":{"s":true,"x":{"a":1,"k":[{"i":{"x":[0.521],"y":[1]},"o":{"x":[0.473],"y":[0.524]},"t":0,"s":[-11.5]},{"t":120,"s":[124.125]}],"ix":3},"y":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[128]},{"t":20,"s":[128]}],"ix":4}},"a":{"a":0,"k":[30,198,0],"ix":1,"l":2},"s":{"a":0,"k":[12.5,12.5,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[1036,1036],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"tm","s":{"a":0,"k":37,"ix":1},"e":{"a":0,"k":63,"ix":2},"o":{"a":0,"k":180,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":128,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[30,198],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":40,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Shape Layer 2","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":-40,"s":[0]},{"i":{"x":[0.413],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":-20,"s":[100]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":49.822,"s":[100]},{"t":79.998046875,"s":[0]}],"ix":11},"r":{"a":0,"k":45,"ix":10},"p":{"s":true,"x":{"a":1,"k":[{"i":{"x":[0.521],"y":[1]},"o":{"x":[0.473],"y":[0.524]},"t":-40,"s":[-11.5]},{"t":80,"s":[124.125]}],"ix":3},"y":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":-40,"s":[128]},{"t":-20,"s":[128]}],"ix":4}},"a":{"a":0,"k":[30,198,0],"ix":1,"l":2},"s":{"a":0,"k":[12.5,12.5,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[1036,1036],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"tm","s":{"a":0,"k":37,"ix":1},"e":{"a":0,"k":63,"ix":2},"o":{"a":0,"k":180,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":128,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[30,198],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":40,"st":-40,"ct":1,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":-80,"s":[0]},{"i":{"x":[0.413],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":-60,"s":[100]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":9.822,"s":[100]},{"t":39.998046875,"s":[0]}],"ix":11},"r":{"a":0,"k":45,"ix":10},"p":{"s":true,"x":{"a":1,"k":[{"i":{"x":[0.521],"y":[1]},"o":{"x":[0.473],"y":[0.524]},"t":-80,"s":[-11.5]},{"t":40,"s":[124.125]}],"ix":3},"y":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":-80,"s":[128]},{"t":-60,"s":[128]}],"ix":4}},"a":{"a":0,"k":[30,198,0],"ix":1,"l":2},"s":{"a":0,"k":[12.5,12.5,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[1036,1036],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"tm","s":{"a":0,"k":37,"ix":1},"e":{"a":0,"k":63,"ix":2},"o":{"a":0,"k":180,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":128,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[30,198],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":40,"st":-80,"ct":1,"bm":0}],"markers":[],"props":{}}
\ No newline at end of file
diff --git a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/StartGameIcon.lottie b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/StartGameIcon.lottie
deleted file mode 100644
index 22323e1b1f..0000000000
Binary files a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/StartGameIcon.lottie and /dev/null differ
diff --git a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/UpdateIcon.cs b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/UpdateIcon.cs
index f410060522..13ecb8fde8 100644
--- a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/UpdateIcon.cs
+++ b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/UpdateIcon.cs
@@ -3,13 +3,13 @@
// This code was generated by a tool.
//
// LottieGen version:
-// 8.0.280225.1+7cd366a738
+// 8.2.250604.1+b02a3ee244
//
// Command:
-// LottieGen -Language CSharp -Namespace CollapseLauncher.AnimatedVisuals.Lottie -Public -WinUIVersion 3.0 -InputFile UpdateIcon.lottie
+// LottieGen -GenerateColorBindings -GenerateDependencyObject -Language CSharp -Namespace CollapseLauncher.AnimatedVisuals.Lottie -Public -WinUIVersion 3.0 -InputFile UpdateIcon.json
//
// Input file:
-// UpdateIcon.lottie (1532 bytes created 20:12+07:00 Jun 2 2024)
+// UpdateIcon.json (5270 bytes created 16:59+07:00 Jan 4 2026)
//
// LottieGen source:
// http://aka.ms/Lottie
@@ -21,16 +21,16 @@
// ____________________________________
// | Object stats | Count |
// |__________________________|_______|
-// | All CompositionObjects | 42 |
+// | All CompositionObjects | 45 |
// |--------------------------+-------|
-// | Expression animators | 1 |
+// | Expression animators | 2 |
// | KeyFrame animators | 3 |
-// | Reference parameters | 1 |
-// | Expression operations | 0 |
+// | Reference parameters | 2 |
+// | Expression operations | 4 |
// |--------------------------+-------|
-// | Animated brushes | - |
+// | Animated brushes | 1 |
// | Animated gradient stops | - |
-// | ExpressionAnimations | 1 |
+// | ExpressionAnimations | 2 |
// | PathKeyFrameAnimations | - |
// |--------------------------+-------|
// | ContainerVisuals | 3 |
@@ -43,8 +43,11 @@
// | Gradient stops | - |
// | CompositionVisualSurface | - |
// ------------------------------------
+using Microsoft.Graphics;
using Microsoft.Graphics.Canvas.Geometry;
using Microsoft.UI.Composition;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Media;
using System;
using System.Collections.Generic;
using System.Numerics;
@@ -56,13 +59,67 @@ namespace CollapseLauncher.AnimatedVisuals.Lottie
// Frame rate: 60 fps
// Frame count: 240
// Duration: 4000.0 mS
- sealed partial class UpdateIcon
- : Microsoft.UI.Xaml.Controls.IAnimatedVisualSource
+ public sealed partial class UpdateIcon
+ : BindableThemeChangeAnimation
+ , Microsoft.UI.Xaml.Controls.IAnimatedVisualSource
, Microsoft.UI.Xaml.Controls.IAnimatedVisualSource2
{
+ protected override void OnForegroundChanged(Brush brush)
+ {
+ if (brush is SolidColorBrush colorBrush)
+ {
+ Color_FFFFFF = colorBrush.Color;
+ return;
+ }
+
+ if (brush is AcrylicBrush acrylicBrush)
+ {
+ Color_FFFFFF = acrylicBrush.TintColor;
+ return;
+ }
+ }
+
+ private static Color GetForegroundColor(bool isLightTheme) =>
+ isLightTheme
+ ? Color.FromArgb(0xFF, 0x00, 0x00, 0x00)
+ : Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
+
// Animation duration: 4.000 seconds.
internal const long c_durationTicks = 40000000;
+ CompositionPropertySet _themeProperties;
+
+ ///
+ /// Dependency property for Color_FFFFFF.
+ ///
+ public static readonly DependencyProperty Color_FFFFFFProperty =
+ DependencyProperty.Register("Color_FFFFFF", typeof(Color), typeof(UpdateIcon),
+ new PropertyMetadata(GetForegroundColor(InnerLauncherConfig.IsAppThemeLight), OnColor_FFFFFFChanged));
+
+ // Theme properties.
+ public Color Color_FFFFFF
+ {
+ get => (Color)GetValue(Color_FFFFFFProperty);
+ set => SetValue(Color_FFFFFFProperty, value);
+ }
+
+ static Vector4 ColorAsVector4(Color color) => new Vector4(color.R, color.G, color.B, color.A);
+
+ static void OnColor_FFFFFFChanged(DependencyObject d, DependencyPropertyChangedEventArgs args)
+ {
+ ((UpdateIcon)d)._themeProperties?.InsertVector4("Color_FFFFFF", ColorAsVector4((Color)(Color)args.NewValue));
+ }
+
+ CompositionPropertySet EnsureThemeProperties(Compositor compositor)
+ {
+ if (_themeProperties == null)
+ {
+ _themeProperties = compositor.CreatePropertySet();
+ _themeProperties.InsertVector4("Color_FFFFFF", ColorAsVector4((Color)Color_FFFFFF));
+ }
+ return _themeProperties;
+ }
+
public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compositor compositor)
{
object ignored = null;
@@ -72,10 +129,12 @@ public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compos
public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compositor compositor, out object diagnostics)
{
diagnostics = null;
+ EnsureThemeProperties(compositor);
var res =
new UpdateIcon_AnimatedVisual(
- compositor
+ compositor,
+ _themeProperties
);
res.CreateAnimations();
return res;
@@ -119,6 +178,19 @@ public double FrameToProgress(double frameNumber)
///
public void SetColorProperty(string propertyName, Color value)
{
+ if (propertyName == "Color_FFFFFF")
+ {
+ Color_FFFFFF = value;
+ }
+ else
+ {
+ return;
+ }
+
+ if (_themeProperties != null)
+ {
+ _themeProperties.InsertVector4(propertyName, ColorAsVector4(value));
+ }
}
///
@@ -134,11 +206,11 @@ sealed partial class UpdateIcon_AnimatedVisual
, Microsoft.UI.Xaml.Controls.IAnimatedVisual2
{
const long c_durationTicks = 40000000;
- readonly Color _color = InnerLauncherConfig.IsAppThemeLight ? Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF) : Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
readonly Compositor _c;
readonly ExpressionAnimation _reusableExpressionAnimation;
+ readonly CompositionPropertySet _themeProperties;
AnimationController _animationController_0;
- CompositionColorBrush _colorBrush_White;
+ CompositionColorBrush _themeColor_Color_FFFFFF;
CompositionPathGeometry _pathGeometry_2;
CompositionPathGeometry _pathGeometry_3;
ContainerVisual _containerVisual_0;
@@ -186,7 +258,7 @@ AnimationController AnimationController_0()
// - - - - - PreComp layer: UpdateIcon
// - - - Layer aggregator
- // - - Offset:<1543, 561>
+ // - - Scale:0.125,0.125, Offset:<192.875, 70.125>
CanvasGeometry Geometry_0()
{
CanvasGeometry result;
@@ -203,7 +275,7 @@ CanvasGeometry Geometry_0()
// - - - - - PreComp layer: UpdateIcon
// - - - Layer aggregator
- // - - Offset:<505.5, 1488>
+ // - - Scale:0.125,0.125, Offset:<63.188, 186>
CanvasGeometry Geometry_1()
{
CanvasGeometry result;
@@ -220,7 +292,7 @@ CanvasGeometry Geometry_1()
// - - - - - PreComp layer: UpdateIcon
// - - - Layer aggregator
- // - - Offset:<1024, 1024>
+ // - - Scale:0.125,0.125, Offset:<128, 128>
CanvasGeometry Geometry_2()
{
CanvasGeometry result;
@@ -241,7 +313,7 @@ CanvasGeometry Geometry_2()
// - - - - - PreComp layer: UpdateIcon
// - - - Layer aggregator
- // - - Offset:<1024, 1024>
+ // - - Scale:0.125,0.125, Offset:<128, 128>
CanvasGeometry Geometry_3()
{
CanvasGeometry result;
@@ -259,16 +331,18 @@ CanvasGeometry Geometry_3()
return result;
}
- CompositionColorBrush ColorBrush_White()
+ // Color bound to theme property value: Color_FFFFFF
+ CompositionColorBrush ThemeColor_Color_FFFFFF()
{
- return (_colorBrush_White == null)
- ? _colorBrush_White = _c.CreateColorBrush(_color)
- : _colorBrush_White;
+ if (_themeColor_Color_FFFFFF != null) { return _themeColor_Color_FFFFFF; }
+ var result = _themeColor_Color_FFFFFF = _c.CreateColorBrush();
+ BindProperty(_themeColor_Color_FFFFFF, "Color", "ColorRGB(_theme.Color_FFFFFF.W,_theme.Color_FFFFFF.X,_theme.Color_FFFFFF.Y,_theme.Color_FFFFFF.Z)", "_theme", _themeProperties);
+ return result;
}
// - - - PreComp layer: UpdateIcon
// - Layer aggregator
- // Offset:<1543, 561>
+ // Scale:0.125,0.125, Offset:<192.875, 70.125>
CompositionPathGeometry PathGeometry_0()
{
return _c.CreatePathGeometry(new CompositionPath(Geometry_0()));
@@ -276,7 +350,7 @@ CompositionPathGeometry PathGeometry_0()
// - - - PreComp layer: UpdateIcon
// - Layer aggregator
- // Offset:<505.5, 1488>
+ // Scale:0.125,0.125, Offset:<63.188, 186>
CompositionPathGeometry PathGeometry_1()
{
return _c.CreatePathGeometry(new CompositionPath(Geometry_1()));
@@ -284,7 +358,7 @@ CompositionPathGeometry PathGeometry_1()
// - - - PreComp layer: UpdateIcon
// - Layer aggregator
- // Offset:<1024, 1024>
+ // Scale:0.125,0.125, Offset:<128, 128>
CompositionPathGeometry PathGeometry_2()
{
if (_pathGeometry_2 != null) { return _pathGeometry_2; }
@@ -294,7 +368,7 @@ CompositionPathGeometry PathGeometry_2()
// - - - PreComp layer: UpdateIcon
// - Layer aggregator
- // Offset:<1024, 1024>
+ // Scale:0.125,0.125, Offset:<128, 128>
CompositionPathGeometry PathGeometry_3()
{
if (_pathGeometry_3 != null) { return _pathGeometry_3; }
@@ -307,9 +381,9 @@ CompositionPathGeometry PathGeometry_3()
// Path 1
CompositionSpriteShape SpriteShape_0()
{
- // Offset:<1543, 561>
- var result = CreateSpriteShape(PathGeometry_0(), new Matrix3x2(1F, 0F, 0F, 1F, 1543F, 561F));;
- result.StrokeBrush = ColorBrush_White();
+ // Offset:<192.875, 70.125>, Scale:<0.125, 0.125>
+ var result = CreateSpriteShape(PathGeometry_0(), new Matrix3x2(0.125F, 0F, 0F, 0.125F, 192.875F, 70.125F));;
+ result.StrokeBrush = ThemeColor_Color_FFFFFF();
result.StrokeDashCap = CompositionStrokeCap.Round;
result.StrokeStartCap = CompositionStrokeCap.Round;
result.StrokeEndCap = CompositionStrokeCap.Round;
@@ -323,9 +397,9 @@ CompositionSpriteShape SpriteShape_0()
// Path 1
CompositionSpriteShape SpriteShape_1()
{
- // Offset:<505.5, 1488>
- var result = CreateSpriteShape(PathGeometry_1(), new Matrix3x2(1F, 0F, 0F, 1F, 505.5F, 1488F));;
- result.StrokeBrush = ColorBrush_White();
+ // Offset:<63.188, 186>, Scale:<0.125, 0.125>
+ var result = CreateSpriteShape(PathGeometry_1(), new Matrix3x2(0.125F, 0F, 0F, 0.125F, 63.1879997F, 186F));;
+ result.StrokeBrush = ThemeColor_Color_FFFFFF();
result.StrokeDashCap = CompositionStrokeCap.Round;
result.StrokeStartCap = CompositionStrokeCap.Round;
result.StrokeEndCap = CompositionStrokeCap.Round;
@@ -339,9 +413,9 @@ CompositionSpriteShape SpriteShape_1()
// Path 1
CompositionSpriteShape SpriteShape_2()
{
- // Offset:<1024, 1024>
- var result = CreateSpriteShape(PathGeometry_2(), new Matrix3x2(1F, 0F, 0F, 1F, 1024F, 1024F));;
- result.StrokeBrush = ColorBrush_White();
+ // Offset:<128, 128>, Scale:<0.125, 0.125>
+ var result = CreateSpriteShape(PathGeometry_2(), new Matrix3x2(0.125F, 0F, 0F, 0.125F, 128F, 128F));;
+ result.StrokeBrush = ThemeColor_Color_FFFFFF();
result.StrokeDashCap = CompositionStrokeCap.Round;
result.StrokeStartCap = CompositionStrokeCap.Round;
result.StrokeEndCap = CompositionStrokeCap.Round;
@@ -356,9 +430,9 @@ CompositionSpriteShape SpriteShape_2()
// Path 1
CompositionSpriteShape SpriteShape_3()
{
- // Offset:<1024, 1024>
- var result = CreateSpriteShape(PathGeometry_3(), new Matrix3x2(1F, 0F, 0F, 1F, 1024F, 1024F));;
- result.StrokeBrush = ColorBrush_White();
+ // Offset:<128, 128>, Scale:<0.125, 0.125>
+ var result = CreateSpriteShape(PathGeometry_3(), new Matrix3x2(0.125F, 0F, 0F, 0.125F, 128F, 128F));;
+ result.StrokeBrush = ThemeColor_Color_FFFFFF();
result.StrokeDashCap = CompositionStrokeCap.Round;
result.StrokeStartCap = CompositionStrokeCap.Round;
result.StrokeEndCap = CompositionStrokeCap.Round;
@@ -373,8 +447,7 @@ ContainerVisual ContainerVisual_0()
{
if (_containerVisual_0 != null) { return _containerVisual_0; }
var result = _containerVisual_0 = _c.CreateContainerVisual();
- result.CenterPoint = new Vector3(1024F, 1024F, 0F);
- result.Offset = new Vector3(176F, 176F, 0F);
+ result.CenterPoint = new Vector3(128F, 128F, 0F);
result.Scale = new Vector3(1F, 1F, 0F);
result.Children.InsertAtTop(ContainerVisual_1());
return result;
@@ -385,7 +458,7 @@ ContainerVisual ContainerVisual_1()
{
var result = _c.CreateContainerVisual();
result.Clip = InsetClip_0();
- result.Size = new Vector2(2048F, 2048F);
+ result.Size = new Vector2(256F, 256F);
// Layer aggregator
result.Children.InsertAtTop(ShapeVisual_0());
return result;
@@ -448,15 +521,15 @@ ScalarKeyFrameAnimation TrimStartScalarAnimation_0_to_0()
ShapeVisual ShapeVisual_0()
{
var result = _c.CreateShapeVisual();
- result.Size = new Vector2(2048F, 2048F);
+ result.Size = new Vector2(256F, 256F);
var shapes = result.Shapes;
- // Offset:<1543, 561>
+ // Scale:0.125,0.125, Offset:<192.875, 70.125>
shapes.Add(SpriteShape_0());
- // Offset:<505.5, 1488>
+ // Scale:0.125,0.125, Offset:<63.188, 186>
shapes.Add(SpriteShape_1());
- // Offset:<1024, 1024>
+ // Scale:0.125,0.125, Offset:<128, 128>
shapes.Add(SpriteShape_2());
- // Offset:<1024, 1024>
+ // Scale:0.125,0.125, Offset:<128, 128>
shapes.Add(SpriteShape_3());
return result;
}
@@ -470,17 +543,19 @@ StepEasingFunction HoldThenStepEasingFunction()
}
internal UpdateIcon_AnimatedVisual(
- Compositor compositor
+ Compositor compositor,
+ CompositionPropertySet themeProperties
)
{
_c = compositor;
+ _themeProperties = themeProperties;
_reusableExpressionAnimation = compositor.CreateExpressionAnimation();
Root();
}
public Visual RootVisual => _root;
public TimeSpan Duration => TimeSpan.FromTicks(c_durationTicks);
- public Vector2 Size => new Vector2(2400F, 2400F);
+ public Vector2 Size => new Vector2(256F, 256F);
void IDisposable.Dispose() => _root?.Dispose();
public void CreateAnimations()
diff --git a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/UpdateIcon.json b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/UpdateIcon.json
new file mode 100644
index 0000000000..e57b78cd8a
--- /dev/null
+++ b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/UpdateIcon.json
@@ -0,0 +1 @@
+{"v":"5.12.2","fr":60,"ip":0,"op":240,"w":256,"h":256,"nm":"UpdateIconMasterComp","ddd":0,"assets":[{"id":"comp_0","nm":"UpdateIcon","fr":60,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[128,128,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[12.5,12.5,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-14.666,56.266],[-31.132,53.758],[-105.895,61.521],[-128.947,-0.321],[-103.436,-60.448],[-61.24,-107.197]],"o":[[16.051,-61.58],[61.391,-106.008],[103.968,-60.401],[128.408,0.32],[106.564,62.276],[14.259,24.959]],"v":[[-679.411,-177.885],[-608.024,-351.501],[-352.405,-607.463],[1.406,-702.002],[353.538,-606.465],[610.018,-347.459]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":128,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":30,"s":[50]},{"t":80,"s":[0]}],"ix":1},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":242,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[128,128,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[12.5,12.5,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[11.129,-42.34],[31.671,-54.12],[104.889,-60.982],[129.029,0.321],[102.932,59.646],[61.568,105.903],[11.121,25.826]],"o":[[-16.328,62.123],[-61.282,104.72],[-104.012,60.472],[-127.485,-0.317],[-106.028,-61.44],[-14.021,-24.117],[-3.58,-8.314]],"v":[[679.076,179.264],[606.447,354.255],[352.629,607.348],[-1.38,702.002],[-351.277,607.765],[-607.341,352.059],[-645.109,277.089]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":128,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":30,"s":[50]},{"t":80,"s":[0]}],"ix":1},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":242,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Shape Layer 4","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[63.188,186,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[12.5,12.5,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[-244.242,122.011],[-123.464,-207.693],[206.416,-86.902]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":128,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false}],"ip":0,"op":242,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[192.875,70.125,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[12.5,12.5,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[244.229,-121.905],[123.49,207.693],[-206.2,86.799]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":128,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false}],"ip":0,"op":242,"st":0,"ct":1,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"UpdateIcon","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.024],"y":[1]},"o":{"x":[0.158],"y":[0]},"t":30,"s":[-65]},{"t":220,"s":[2160]}],"ix":10},"p":{"a":0,"k":[128,128,0],"ix":2,"l":2},"a":{"a":0,"k":[128,128,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":256,"h":256,"ip":0,"op":240,"st":0,"bm":0}],"markers":[],"props":{}}
\ No newline at end of file
diff --git a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/UpdateIcon.lottie b/CollapseLauncher/Classes/AnimatedVisuals/Lottie/UpdateIcon.lottie
deleted file mode 100644
index 23168ac300..0000000000
Binary files a/CollapseLauncher/Classes/AnimatedVisuals/Lottie/UpdateIcon.lottie and /dev/null differ
diff --git a/CollapseLauncher/Classes/CachesManagement/Honkai/Check.cs b/CollapseLauncher/Classes/CachesManagement/Honkai/Check.cs
index 92e9568542..6a883cd9cc 100644
--- a/CollapseLauncher/Classes/CachesManagement/Honkai/Check.cs
+++ b/CollapseLauncher/Classes/CachesManagement/Honkai/Check.cs
@@ -1,4 +1,5 @@
-using CollapseLauncher.Helper.StreamUtility;
+using CollapseLauncher.Helper;
+using CollapseLauncher.Helper.StreamUtility;
using CollapseLauncher.Interfaces;
using Hi3Helper;
using System;
@@ -9,7 +10,6 @@
using System.Security.Cryptography;
using System.Threading;
using System.Threading.Tasks;
-using static Hi3Helper.Locale;
using static Hi3Helper.Logger;
// ReSharper disable CommentTypo
@@ -123,8 +123,8 @@ private async ValueTask CheckAsset(CacheAsset asset, List returnAsse
{
// Increment the count and update the status
Interlocked.Add(ref ProgressAllCountCurrent, 1);
- Status.ActivityStatus = string.Format(Lang!._CachesPage!.CachesStatusChecking!, asset!.DataType, asset.N);
- Status.ActivityAll = string.Format(Lang._CachesPage.CachesTotalStatusChecking!, ProgressAllCountCurrent, ProgressAllCountTotal);
+ Status.ActivityStatus = string.Format(Locale.Current.Lang?._CachesPage?.CachesStatusChecking ?? "", asset!.DataType, asset.N);
+ Status.ActivityAll = string.Format(Locale.Current.Lang?._CachesPage?.CachesTotalStatusChecking ?? "", ProgressAllCountCurrent, ProgressAllCountTotal);
// Assign the file info.
FileInfo fileInfo = new FileInfo(asset.ConcatPath).EnsureNoReadOnly(out bool isExist);
diff --git a/CollapseLauncher/Classes/CachesManagement/Honkai/Fetch.cs b/CollapseLauncher/Classes/CachesManagement/Honkai/Fetch.cs
index b97b435d69..7669e49d8e 100644
--- a/CollapseLauncher/Classes/CachesManagement/Honkai/Fetch.cs
+++ b/CollapseLauncher/Classes/CachesManagement/Honkai/Fetch.cs
@@ -15,7 +15,6 @@
using System.Threading;
using System.Threading.Tasks;
using static Hi3Helper.Data.ConverterTool;
-using static Hi3Helper.Locale;
using static Hi3Helper.Logger;
// ReSharper disable SwitchStatementHandlesSomeKnownEnumValuesWithDefault
// ReSharper disable CommentTypo
@@ -127,7 +126,7 @@ private async Task BuildGameRepoURL(HttpClient client, CancellationToken token)
private async Task<(int, long)> FetchByType(CacheAssetType type, HttpClient client, List assetIndex, CancellationToken token)
{
// Set total activity string as "Fetching Caches Type: "
- Status.ActivityStatus = string.Format(Lang!._CachesPage!.CachesStatusFetchingType!, type);
+ Status.ActivityStatus = string.Format(Locale.Current.Lang?._CachesPage?.CachesStatusFetchingType ?? "", type);
Status.IsProgressAllIndetermined = true;
Status.IsIncludePerFileIndicator = false;
UpdateStatus();
@@ -143,7 +142,7 @@ private async Task BuildGameRepoURL(HttpClient client, CancellationToken token)
// Get a direct HTTP Stream
await using Stream remoteStream = (await client.TryGetCachedStreamFrom(assetIndexURL, token: token)).Stream;
- await using XORStream stream = new XORStream(remoteStream);
+ await using XORStream stream = new(remoteStream);
// Build the asset index and return the count and size of each type
(int, long) returnValue = await BuildAssetIndex(type, baseURL, stream, assetIndex, token);
@@ -252,12 +251,12 @@ private async ValueTask> BuildAssetIndex(CacheAssetType ty
// bool isNeedReadLuckyNumber = type == CacheAssetType.Data;
// Parse asset index file from UABT
- BundleFile bundleFile = new BundleFile(stream);
- SerializedFile serializeFile = new SerializedFile(bundleFile.fileList!.FirstOrDefault()!.Stream);
+ BundleFile bundleFile = new(stream);
+ SerializedFile serializeFile = new(bundleFile.fileList!.FirstOrDefault()!.Stream);
// Try to get the asset index file as byte[] and load it as TextAsset
byte[] dataRaw = serializeFile.GetDataFirstOrDefaultByName("packageversion.txt");
- TextAsset dataTextAsset = new TextAsset(dataRaw);
+ TextAsset dataTextAsset = new(dataRaw);
// Initialize local HTTP client
using HttpClient client = new HttpClientBuilder()
@@ -282,7 +281,7 @@ await Parallel.ForEachAsync(EnumerateCacheTextAsset(type, dataTextAsset.GetStrin
if (content.DLM == 2)
{
// Update the status
- Status.ActivityStatus = string.Format(Lang._CachesPage.Status2, type, content.N);
+ Status.ActivityStatus = string.Format(Locale.Current.Lang?._CachesPage?.Status2 ?? "", type, content.N);
Status.IsProgressAllIndetermined = true;
Status.IsProgressPerFileIndetermined = true;
UpdateStatus();
@@ -314,20 +313,20 @@ private byte[] GetAssetIndexSalt(string data)
{
// Get the salt from the string and return as byte[]
byte[] key;
- if (DataCooker.IsServeV3Data(LauncherMetadataHelper.CurrentMasterKey?.Key))
+ if (DataCooker.IsServeV3Data(MetadataHelper.CurrentMasterKey?.Key))
{
- DataCooker.GetServeV3DataSize(LauncherMetadataHelper.CurrentMasterKey?.Key, out long keyCompSize,
+ DataCooker.GetServeV3DataSize(MetadataHelper.CurrentMasterKey?.Key, out long keyCompSize,
out long keyDecompressedSize);
key = new byte[keyCompSize];
- DataCooker.ServeV3Data(LauncherMetadataHelper.CurrentMasterKey?.Key, key, (int)keyCompSize,
+ DataCooker.ServeV3Data(MetadataHelper.CurrentMasterKey?.Key, key, (int)keyCompSize,
(int)keyDecompressedSize, out _);
}
else
{
- key = LauncherMetadataHelper.CurrentMasterKey?.Key;
+ key = MetadataHelper.CurrentMasterKey?.Key;
}
- MhyEncTool saltTool = new MhyEncTool(data, key);
+ MhyEncTool saltTool = new(data, key);
return saltTool.GetSalt();
}
diff --git a/CollapseLauncher/Classes/CachesManagement/Honkai/HonkaiCache.cs b/CollapseLauncher/Classes/CachesManagement/Honkai/HonkaiCache.cs
index 6b459e6796..ee8a3eb711 100644
--- a/CollapseLauncher/Classes/CachesManagement/Honkai/HonkaiCache.cs
+++ b/CollapseLauncher/Classes/CachesManagement/Honkai/HonkaiCache.cs
@@ -1,4 +1,5 @@
using CollapseLauncher.Extension;
+using CollapseLauncher.Helper;
using CollapseLauncher.Interfaces;
using Hi3Helper.Data;
using Hi3Helper.EncTool.Parser.KianaDispatch;
@@ -6,7 +7,6 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
-using static Hi3Helper.Locale;
namespace CollapseLauncher
{
@@ -72,8 +72,8 @@ private async Task CheckRoutine()
// either way, returns false.
return SummarizeStatusAndProgress(
UpdateAssetIndex,
- string.Format(Lang!._CachesPage!.CachesStatusNeedUpdate!, ProgressAllCountFound, ConverterTool.SummarizeSizeSimple(ProgressAllSizeFound)),
- Lang._CachesPage.CachesStatusUpToDate);
+ string.Format(Locale.Current.Lang?._CachesPage?.CachesStatusNeedUpdate ?? "", ProgressAllCountFound, ConverterTool.SummarizeSizeSimple(ProgressAllSizeFound)),
+ Locale.Current.Lang?._CachesPage?.CachesStatusUpToDate ?? "");
}
public async Task StartUpdateRoutine(bool showInteractivePrompt = false)
@@ -95,9 +95,9 @@ private async Task UpdateRoutine()
ResetStatusAndProgress();
// Set as completed
- Status.IsCompleted = true;
- Status.IsCanceled = false;
- Status.ActivityStatus = Lang!._CachesPage!.CachesStatusUpToDate;
+ Status.IsCompleted = true;
+ Status.IsCanceled = false;
+ Status.ActivityStatus = Locale.Current.Lang?._CachesPage?.CachesStatusUpToDate;
// Update status and progress
UpdateAll();
diff --git a/CollapseLauncher/Classes/CachesManagement/Honkai/Update.cs b/CollapseLauncher/Classes/CachesManagement/Honkai/Update.cs
index 7c03ca2c26..12b59a9adb 100644
--- a/CollapseLauncher/Classes/CachesManagement/Honkai/Update.cs
+++ b/CollapseLauncher/Classes/CachesManagement/Honkai/Update.cs
@@ -12,7 +12,6 @@
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
-using static Hi3Helper.Locale;
using static Hi3Helper.Logger;
// ReSharper disable CommentTypo
// ReSharper disable GrammarMistakeInComment
@@ -39,7 +38,7 @@ private async Task Update(List updateAssetIndex, List assetProperty = [.. AssetEntry];
+ ObservableCollection assetProperty = [.. AssetEntry];
ConcurrentDictionary<(CacheAsset, IAssetProperty), byte> runningTask = new();
if (IsBurstDownloadEnabled)
@@ -123,7 +122,7 @@ private async Task UpdateCacheAsset((CacheAsset AssetIndex, IAssetProperty Asset
{
// Increment total count and update the status
ProgressAllCountCurrent++;
- Status.ActivityStatus = string.Format(Lang!._Misc!.Downloading + " {0}: {1}", asset!.AssetIndex.DataType, asset.AssetIndex.N);
+ Status.ActivityStatus = string.Format(Locale.Current.Lang?._Misc?.Downloading + " {0}: {1}", asset!.AssetIndex.DataType, asset.AssetIndex.N);
UpdateAll();
FileInfo fileInfo = new FileInfo(asset.AssetIndex.ConcatPath!)
diff --git a/CollapseLauncher/Classes/DiscordPresence/DiscordPresenceManager.cs b/CollapseLauncher/Classes/DiscordPresence/DiscordPresenceManager.cs
index 0f843e4e7d..f1fd494ca4 100644
--- a/CollapseLauncher/Classes/DiscordPresence/DiscordPresenceManager.cs
+++ b/CollapseLauncher/Classes/DiscordPresence/DiscordPresenceManager.cs
@@ -1,4 +1,5 @@
-using CollapseLauncher.Helper.Metadata;
+using CollapseLauncher.Helper;
+using CollapseLauncher.Helper.Metadata;
using CollapseLauncher.Helper.Update;
using CollapseLauncher.Plugins;
using DiscordRPC;
@@ -8,7 +9,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Threading.Tasks.Dataflow;
-using static Hi3Helper.Locale;
using static Hi3Helper.Shared.Region.LauncherConfig;
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable StringLiteralTypo
@@ -47,7 +47,7 @@ public bool IsRpcEnabled
field = value;
SetAndSaveConfigValue("EnableDiscordRPC", value);
- if (value) SetupPresence();
+ if (value) SetupPresence(null);
else DisablePresence();
}
}
@@ -146,7 +146,7 @@ private void OnReady(object? _, ReadyMessage msg)
{
// Restart Discord RPC client
_firstTimeConnect = true;
- SetupPresence();
+ SetupPresence(null);
}
else
{
@@ -182,58 +182,49 @@ public void DisablePresence()
_client = null;
}
- public void SetupPresence()
+ private static ulong GetDiscordPresenceId(PresetConfig presetConfig)
{
- if (!IsRpcEnabled) return;
-
- var gameCategory = GetAppConfigValue("GameCategory").ToString();
- var isGameStatusEnabled = GetAppConfigValue("EnableDiscordGameStatus").ToBool();
+ return presetConfig.GameName switch
+ {
+ "Honkai: Star Rail" => AppDiscordApplicationIDHsr,
+ "Honkai Impact 3rd" => AppDiscordApplicationIDHi3,
+ "Genshin Impact" => AppDiscordApplicationIDGi,
+ "Zenless Zone Zero" => AppDiscordApplicationIDZzz,
+ _ => TryGetPresenceFromPlugin(presetConfig)
+ };
- if (isGameStatusEnabled)
+ static ulong TryGetPresenceFromPlugin(PresetConfig presetConfig)
{
- switch (gameCategory)
+ if (presetConfig is not PluginPresetConfigWrapper { DiscordPresenceContext : { IsFeatureAvailable: true } discordContext } ||
+ discordContext.PresenceId == 0)
{
- case "Honkai: Star Rail":
- EnablePresence(AppDiscordApplicationID_HSR);
- return;
- case "Honkai Impact 3rd":
- EnablePresence(AppDiscordApplicationID_HI3);
- return;
- case "Genshin Impact":
- EnablePresence(AppDiscordApplicationID_GI);
- return;
- case "Zenless Zone Zero":
- EnablePresence(AppDiscordApplicationID_ZZZ);
- return;
- default:
- if (TryEnablePresenceIfPlugin())
- {
- return;
- }
- Logger.LogWriteLine("Discord Presence (Unknown Game)", LogType.Error, true);
- break;
+ return AppDiscordApplicationID; // Default
}
- }
- EnablePresence(AppDiscordApplicationID);
+ return discordContext.PresenceId;
+ }
}
- private bool TryEnablePresenceIfPlugin()
+ public void SetupPresence(PresetConfig? presetConfig)
{
- if (LauncherMetadataHelper.CurrentMetadataConfig
- is not PluginPresetConfigWrapper asPluginPresetConfig)
+ bool isGameStatusEnabled = GetAppConfigValue("EnableDiscordGameStatus");
+ if (!IsRpcEnabled || !isGameStatusEnabled) return;
+
+ string gameTitle = MetadataHelper.CurrentGameTitleName;
+ string gameRegion = MetadataHelper.CurrentGameRegionName;
+
+ if (presetConfig == null &&
+ !MetadataHelper.TryGetGameConfig(gameTitle, gameRegion, out presetConfig))
{
- return false;
+ return;
}
- if (!asPluginPresetConfig.DiscordPresenceContext.IsFeatureAvailable ||
- asPluginPresetConfig.DiscordPresenceContext.PresenceId == 0)
+ if (GetDiscordPresenceId(presetConfig) is var presenceId && presenceId == 0)
{
- return false;
+ Logger.LogWriteLine("Discord Presence (Unknown Game)", LogType.Error, true);
}
- EnablePresence(asPluginPresetConfig.DiscordPresenceContext.PresenceId);
- return true;
+ EnablePresence(presenceId);
}
public void SetActivity(ActivityType activity, DateTime? activityOffset = null)
@@ -248,33 +239,33 @@ public void SetActivity(ActivityType activity, DateTime? activityOffset = null)
case ActivityType.Play:
{
bool isGameStatusEnabled = GetAppConfigValue("EnableDiscordGameStatus").ToBool();
- BuildActivityGameStatus(isGameStatusEnabled ? Lang._Misc.DiscordRP_InGame : Lang._Misc.DiscordRP_Play,
+ BuildActivityGameStatus((isGameStatusEnabled ? Locale.Current.Lang?._Misc?.DiscordRP_InGame : Locale.Current.Lang?._Misc?.DiscordRP_Play) ?? "",
isGameStatusEnabled, activityOffset);
break;
}
case ActivityType.Update:
{
bool isGameStatusEnabled = GetAppConfigValue("EnableDiscordGameStatus").ToBool();
- BuildActivityGameStatus(Lang._Misc.DiscordRP_Update, isGameStatusEnabled);
+ BuildActivityGameStatus(Locale.Current.Lang?._Misc?.DiscordRP_Update ?? "", isGameStatusEnabled);
break;
}
case ActivityType.Repair:
- BuildActivityAppStatus(Lang._Misc.DiscordRP_Repair);
+ BuildActivityAppStatus(Locale.Current.Lang?._Misc?.DiscordRP_Repair ?? "");
break;
case ActivityType.Cache:
- BuildActivityAppStatus(Lang._Misc.DiscordRP_Cache);
+ BuildActivityAppStatus(Locale.Current.Lang?._Misc?.DiscordRP_Cache ?? "");
break;
case ActivityType.GameSettings:
- BuildActivityAppStatus(Lang._Misc.DiscordRP_GameSettings);
+ BuildActivityAppStatus(Locale.Current.Lang?._Misc?.DiscordRP_GameSettings ?? "");
break;
case ActivityType.AppSettings:
- BuildActivityAppStatus(Lang._Misc.DiscordRP_AppSettings);
+ BuildActivityAppStatus(Locale.Current.Lang?._Misc?.DiscordRP_AppSettings ?? "");
break;
case ActivityType.Idle:
_lastPlayTime = null;
if (_cachedIsIdleEnabled)
{
- BuildActivityAppStatus(Lang._Misc.DiscordRP_Idle);
+ BuildActivityAppStatus(Locale.Current.Lang?._Misc?.DiscordRP_Idle ?? "");
}
else
{
@@ -285,7 +276,7 @@ public void SetActivity(ActivityType activity, DateTime? activityOffset = null)
default:
_presence = new RichPresence
{
- Details = Lang._Misc.DiscordRP_Default,
+ Details = Locale.Current.Lang?._Misc?.DiscordRP_Default,
Assets = new Assets
{
LargeImageKey = "launcher-logo-new",
@@ -302,22 +293,22 @@ public void SetActivity(ActivityType activity, DateTime? activityOffset = null)
private void BuildActivityGameStatus(string activityName, bool isGameStatusEnabled, DateTime? activityOffset = null)
{
- var curGameName = LauncherMetadataHelper.CurrentMetadataConfigGameName;
- var curGameRegion = LauncherMetadataHelper.CurrentMetadataConfigGameRegion;
+ string curGameName = MetadataHelper.CurrentGameTitleName;
+ string curGameRegion = MetadataHelper.CurrentGameRegionName;
- if (string.IsNullOrEmpty(curGameName) || string.IsNullOrEmpty(curGameRegion))
+ if (string.IsNullOrEmpty(curGameName) || string.IsNullOrEmpty(curGameRegion) ||
+ !MetadataHelper.TryGetGameConfig(curGameName, curGameRegion, out PresetConfig? presetConfig))
return;
- var curGameNameTranslate =
- InnerLauncherConfig.GetGameTitleRegionTranslationString(curGameName, Lang._GameClientTitles);
- var curGameRegionTranslate =
- InnerLauncherConfig.GetGameTitleRegionTranslationString(curGameRegion, Lang._GameClientRegions);
+ string curGameNameTranslate = MetadataHelper.GetTranslatedTitle(curGameName);
+ string curGameRegionTranslate = MetadataHelper.GetTranslatedRegion(curGameRegion);
if (TryBuildActivityGameStatusFromPlugin(activityName,
curGameNameTranslate,
curGameRegionTranslate,
isGameStatusEnabled,
activityOffset,
+ presetConfig,
out _presence))
{
return;
@@ -326,10 +317,10 @@ private void BuildActivityGameStatus(string activityName, bool isGameStatusEnabl
_presence = new RichPresence
{
Details = $"{activityName} {(!isGameStatusEnabled ? curGameNameTranslate : null)}",
- State = $"{Lang._Misc.DiscordRP_Region} {curGameRegionTranslate}",
+ State = $"{Locale.Current.Lang?._Misc?.DiscordRP_Region} {curGameRegionTranslate}",
Assets = new Assets
{
- LargeImageKey = $"game-{LauncherMetadataHelper.CurrentMetadataConfig?.GameType.ToString().ToLower()}-logo",
+ LargeImageKey = $"game-{presetConfig.GameType.ToString().ToLower()}-logo",
LargeImageText = $"{curGameNameTranslate} - {curGameRegionTranslate}",
SmallImageKey = "launcher-logo-new",
SmallImageText = $"Collapse Launcher v{LauncherUpdateHelper.LauncherCurrentVersionString} "
@@ -348,12 +339,12 @@ private bool TryBuildActivityGameStatusFromPlugin(
string? translatedRegionName,
bool isGameStatusEnabled,
DateTime? activityOffset,
+ PresetConfig presetConfig,
[NotNullWhen(true)] out RichPresence? presence)
{
Unsafe.SkipInit(out presence);
- if (LauncherMetadataHelper.CurrentMetadataConfig
- is not PluginPresetConfigWrapper asPluginPresetConfig ||
+ if (presetConfig is not PluginPresetConfigWrapper asPluginPresetConfig ||
!asPluginPresetConfig.DiscordPresenceContext.IsFeatureAvailable)
{
return false;
@@ -367,7 +358,7 @@ is not PluginPresetConfigWrapper asPluginPresetConfig ||
presence = new RichPresence
{
Details = $"{activityName} {(!isGameStatusEnabled ? translatedGameName : null)}",
- State = $"{Lang._Misc.DiscordRP_Region} {translatedRegionName}",
+ State = $"{Locale.Current.Lang?._Misc?.DiscordRP_Region} {translatedRegionName}",
Assets = new Assets
{
LargeImageKey = largeIconUrl ?? CollapseLogoExt,
@@ -395,20 +386,20 @@ private DateTime GetCachedStartPlayTime(DateTime? activityOffset)
private void BuildActivityAppStatus(string activityName)
{
- var curGameName = LauncherMetadataHelper.CurrentMetadataConfigGameName;
- var curGameRegion = LauncherMetadataHelper.CurrentMetadataConfigGameRegion;
+ string curGameName = MetadataHelper.CurrentGameTitleName;
+ string curGameRegion = MetadataHelper.CurrentGameRegionName;
- if (string.IsNullOrEmpty(curGameName) || string.IsNullOrEmpty(curGameRegion))
+ if (string.IsNullOrEmpty(curGameName) || string.IsNullOrEmpty(curGameRegion) ||
+ !MetadataHelper.TryGetGameConfig(curGameName, curGameRegion, out PresetConfig? presetConfig))
return;
- var curGameNameTranslate =
- InnerLauncherConfig.GetGameTitleRegionTranslationString(curGameName, Lang._GameClientTitles);
- var curGameRegionTranslate =
- InnerLauncherConfig.GetGameTitleRegionTranslationString(curGameRegion, Lang._GameClientRegions);
+ string curGameNameTranslate = MetadataHelper.GetTranslatedTitle(curGameName);
+ string curGameRegionTranslate = MetadataHelper.GetTranslatedRegion(curGameRegion);
if (TryBuildActivityAppStatusFromPlugin(activityName,
curGameNameTranslate,
curGameRegionTranslate,
+ presetConfig,
out _presence))
{
return;
@@ -417,10 +408,10 @@ private void BuildActivityAppStatus(string activityName)
_presence = new RichPresence
{
Details = activityName,
- State = $"{Lang._Misc.DiscordRP_Region} {curGameRegionTranslate}",
+ State = $"{Locale.Current.Lang?._Misc?.DiscordRP_Region} {curGameRegionTranslate}",
Assets = new Assets
{
- LargeImageKey = $"game-{LauncherMetadataHelper.CurrentMetadataConfig?.GameType.ToString().ToLower()}-logo",
+ LargeImageKey = $"game-{presetConfig.GameType.ToString().ToLower()}-logo",
LargeImageText = curGameNameTranslate,
SmallImageKey = "launcher-logo-new",
SmallImageText = $"Collapse Launcher v{LauncherUpdateHelper.LauncherCurrentVersionString} "
@@ -434,12 +425,12 @@ private static bool TryBuildActivityAppStatusFromPlugin(
string activityName,
string? translatedGameName,
string? translatedRegionName,
+ PresetConfig presetConfig,
[NotNullWhen(true)] out RichPresence? presence)
{
Unsafe.SkipInit(out presence);
- if (LauncherMetadataHelper.CurrentMetadataConfig
- is not PluginPresetConfigWrapper asPluginPresetConfig ||
+ if (presetConfig is not PluginPresetConfigWrapper asPluginPresetConfig ||
!asPluginPresetConfig.DiscordPresenceContext.IsFeatureAvailable)
{
return false;
@@ -453,7 +444,7 @@ is not PluginPresetConfigWrapper asPluginPresetConfig ||
presence = new RichPresence
{
Details = activityName,
- State = $"{Lang._Misc.DiscordRP_Region} {translatedRegionName}",
+ State = $"{Locale.Current.Lang?._Misc?.DiscordRP_Region} {translatedRegionName}",
Assets = new Assets
{
LargeImageKey = largeIconUrl ?? CollapseLogoExt,
diff --git a/CollapseLauncher/Classes/EventsManagement/BackgroundActivityManager.cs b/CollapseLauncher/Classes/EventsManagement/BackgroundActivityManager.cs
index aed8f4ecc2..6274e3871a 100644
--- a/CollapseLauncher/Classes/EventsManagement/BackgroundActivityManager.cs
+++ b/CollapseLauncher/Classes/EventsManagement/BackgroundActivityManager.cs
@@ -3,17 +3,17 @@
using CollapseLauncher.Helper;
using CollapseLauncher.Helper.Metadata;
using CollapseLauncher.Interfaces;
-using CollapseLauncher.Statics;
+using CollapseLauncher.Pages;
+using CollapseLauncher.Plugins;
using Hi3Helper;
using Hi3Helper.Data;
-using Hi3Helper.Shared.Region;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
-using Microsoft.UI.Xaml.Media.Imaging;
using System;
using System.Collections.Generic;
-using static Hi3Helper.Locale;
+using System.Numerics;
+
// ReSharper disable StringLiteralTypo
// ReSharper disable ClassNeverInstantiated.Global
#pragma warning disable IDE0130
@@ -22,59 +22,90 @@ namespace CollapseLauncher
{
internal class BackgroundActivityManager
{
- private static readonly ThemeShadow InfoBarShadow = new();
- private static readonly Dictionary BackgroundActivities = new();
+ private static readonly ThemeShadow InfoBarShadow = new();
+ private static readonly Dictionary BackgroundActivities = new();
- public static void Attach(int hashID, IBackgroundActivity activity, string activityTitle, string activitySubtitle)
+ public static void Attach(PresetConfig presetConfig, IBackgroundActivity activity, string activityTitle, string activitySubtitle)
{
- if (BackgroundActivities.ContainsKey(hashID))
+ if (!BackgroundActivities.TryAdd(presetConfig, activity))
{
return;
}
- WindowUtility.CurrentDispatcherQueue?
- .TryEnqueue(() => AttachEventToNotification(hashID, activity, activityTitle, activitySubtitle));
- BackgroundActivities.Add(hashID, activity);
+ DispatcherQueueExtensions.TryEnqueue(() => AttachEventToNotification(presetConfig, activity, activityTitle, activitySubtitle));
#if DEBUG
- Logger.LogWriteLine($"Background activity with ID: {hashID} has been attached", LogType.Debug, true);
+ Logger.LogWriteLine($"Background activity for {presetConfig} has been attached", LogType.Debug, true);
#endif
}
- public static void Detach(int hashID)
+ public static void Detach(PresetConfig presetConfig)
{
- if (BackgroundActivities.Remove(hashID))
+ if (BackgroundActivities.Remove(presetConfig))
{
- DetachEventFromNotification(hashID);
+ NotificationSender.RemoveCustomNotification(presetConfig.GetHashCode());
#if DEBUG
- Logger.LogWriteLine($"Background activity with ID: {hashID} has been detached", LogType.Debug, true);
+ Logger.LogWriteLine($"Background activity for {presetConfig} has been detached", LogType.Debug, true);
return;
#endif
}
#if DEBUG
- Logger.LogWriteLine($"Cannot detach background activity with ID: {hashID} because it doesn't attached", LogType.Debug, true);
+ Logger.LogWriteLine($"Cannot detach background activity for {presetConfig} because it doesn't attached", LogType.Debug, true);
#endif
}
- private static void AttachEventToNotification(int hashID, IBackgroundActivity activity, string activityTitle, string activitySubtitle)
+ private static IconElement GetGamePresetIcon(PresetConfig presetConfig)
{
- Thickness containerNotClosableMargin = new Thickness(-28, -8, 24, 20);
- Thickness containerClosableMargin = new Thickness(-28, -8, -28, 20);
+ string uri = presetConfig.GameType switch
+ {
+ GameNameType.Honkai => "ms-appx:///Assets/Images/GameLogo/honkai-logo.png",
+ GameNameType.Genshin => "ms-appx:///Assets/Images/GameLogo/genshin-logo.png",
+ GameNameType.StarRail => "ms-appx:///Assets/Images/GameLogo/starrail-logo.png",
+ GameNameType.Zenless => "ms-appx:///Assets/Images/GameLogo/zenless-logo.png",
+ _ => "ms-appx:///Assets/Images/GameMascot/PaimonWhat.png"
+ };
- InfoBar parentNotificationUI = new InfoBar
- {
- Tag = hashID,
- Severity = InfoBarSeverity.Informational,
- Background = (Brush)Application.Current!.Resources!["InfoBarAnnouncementBrush"],
- IsOpen = true,
- IsClosable = false,
- Shadow = InfoBarShadow,
- Title = activityTitle,
- Message = activitySubtitle
+ if (presetConfig is not PluginPresetConfigWrapper pluginPresetConfig)
+ {
+ return new BitmapIcon
+ {
+ UriSource = new Uri(uri)
+ };
}
+
+ PluginInfo pluginInfo = pluginPresetConfig.PluginInfo;
+ GamePluginIconConverter converter = StaticConverter.Shared;
+ if (converter.Convert(pluginInfo, null!, null!, "") is not IconElement iconElement)
+ {
+ return new BitmapIcon
+ {
+ UriSource = new Uri(uri)
+ };
+ }
+
+ return iconElement;
+ }
+
+ private static void AttachEventToNotification(PresetConfig presetConfig, IBackgroundActivity activity, string activityTitle, string activitySubtitle)
+ {
+ Thickness containerNotClosableMargin = new(-28, -8, 24, 20);
+ Thickness containerClosableMargin = new(-28, -8, -28, 20);
+
+ Brush brush = UIElementExtensions.GetApplicationResource("InfoBarAnnouncementBrush");
+ InfoBar parentNotificationUI = new InfoBar
+ {
+ Tag = presetConfig.GetHashCode(),
+ Severity = InfoBarSeverity.Informational,
+ Background = brush,
+ IsOpen = true,
+ IsClosable = false,
+ Shadow = InfoBarShadow,
+ Title = activityTitle,
+ Message = activitySubtitle
+ }
.WithMargin(4d, 4d, 4d, 0)
.WithCornerRadius(8);
- parentNotificationUI.Translation = LauncherConfig.Shadow32;
+ parentNotificationUI.Translation = new Vector3(0,0,32);
StackPanel parentContainer = UIElementExtensions.CreateStackPanel()
.WithMargin(parentNotificationUI.IsClosable ? containerClosableMargin : containerNotClosableMargin);
@@ -93,19 +124,7 @@ private static void AttachEventToNotification(int hashID, IBackgroundActivity ac
0
);
- GamePresetProperty currentGameProperty = GamePropertyVault.GetCurrentGameProperty();
- _ = progressLogoContainer.AddElementToStackPanel(
- new Image
- {
- Source = new BitmapImage(new Uri(currentGameProperty!.GameVersion!.GameType switch
- {
- GameNameType.Honkai => "ms-appx:///Assets/Images/GameLogo/honkai-logo.png",
- GameNameType.Genshin => "ms-appx:///Assets/Images/GameLogo/genshin-logo.png",
- GameNameType.StarRail => "ms-appx:///Assets/Images/GameLogo/starrail-logo.png",
- GameNameType.Zenless => "ms-appx:///Assets/Images/GameLogo/zenless-logo.png",
- _ => "ms-appx:///Assets/Images/GameMascot/PaimonWhat.png"
- }))
- }.WithWidthAndHeight(64));
+ _ = progressLogoContainer.AddElementToStackPanel(GetGamePresetIcon(presetConfig).WithWidthAndHeight(64));
StackPanel progressStatusContainer = parentGrid.AddElementToGridColumn(
UIElementExtensions.CreateStackPanel()
@@ -124,34 +143,33 @@ private static void AttachEventToNotification(int hashID, IBackgroundActivity ac
TextBlock progressLeftTitle = progressStatusGrid.AddElementToGridRowColumn(new TextBlock
{
Style = UIElementExtensions.GetApplicationResource
+
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/Button/AcrylicButton.xaml b/CollapseLauncher/XAMLs/Theme/Button/AcrylicButton.xaml
new file mode 100644
index 0000000000..efed2b3302
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/Button/AcrylicButton.xaml
@@ -0,0 +1,123 @@
+
+
+
+
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/Button/AcrylicSemiButton.xaml b/CollapseLauncher/XAMLs/Theme/Button/AcrylicSemiButton.xaml
new file mode 100644
index 0000000000..b59851fe24
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/Button/AcrylicSemiButton.xaml
@@ -0,0 +1,123 @@
+
+
+
+
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/Button/DefaultButton.xaml b/CollapseLauncher/XAMLs/Theme/Button/DefaultButton.xaml
new file mode 100644
index 0000000000..0a9389ed83
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/Button/DefaultButton.xaml
@@ -0,0 +1,117 @@
+
+
+
+
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/Button/DraftButton.xaml b/CollapseLauncher/XAMLs/Theme/Button/DraftButton.xaml
new file mode 100644
index 0000000000..1314f48bb2
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/Button/DraftButton.xaml
@@ -0,0 +1,79 @@
+
+
+
+
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/Button/NewAccentButton.xaml b/CollapseLauncher/XAMLs/Theme/Button/NewAccentButton.xaml
new file mode 100644
index 0000000000..35bfa6b155
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/Button/NewAccentButton.xaml
@@ -0,0 +1,122 @@
+
+
+
+
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/SocMedIconButton/SocMedIconButton.xaml b/CollapseLauncher/XAMLs/Theme/Button/SocMedIconButton.xaml
similarity index 73%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/SocMedIconButton/SocMedIconButton.xaml
rename to CollapseLauncher/XAMLs/Theme/Button/SocMedIconButton.xaml
index b17efab881..0d0ba1aa02 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/SocMedIconButton/SocMedIconButton.xaml
+++ b/CollapseLauncher/XAMLs/Theme/Button/SocMedIconButton.xaml
@@ -1,12 +1,9 @@
-
+
+
+ xmlns:pages="using:CollapseLauncher.Pages">
-
+
+
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/Button/WindowsCaptionButton.xaml b/CollapseLauncher/XAMLs/Theme/Button/WindowsCaptionButton.xaml
new file mode 100644
index 0000000000..1f3d567038
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/Button/WindowsCaptionButton.xaml
@@ -0,0 +1,95 @@
+
+
+
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/ChangedStructItemArgs.cs b/CollapseLauncher/XAMLs/Theme/ChangedStructItemArgs.cs
new file mode 100644
index 0000000000..4291b89ba9
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/ChangedStructItemArgs.cs
@@ -0,0 +1,16 @@
+namespace CollapseLauncher.XAMLs.Theme;
+
+#nullable enable
+public readonly struct ChangedStructItemArgs(TItem oldItem, TItem newItem)
+ where TItem : struct
+{
+ public TItem OldItem { get; private init; } = oldItem;
+ public TItem NewItem { get; private init; } = newItem;
+}
+
+public class ChangedObjectItemArgs(TItem? oldItem, TItem? newItem)
+ where TItem : class
+{
+ public TItem? OldItem { get; private init; } = oldItem;
+ public TItem? NewItem { get; private init; } = newItem;
+}
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/ComboBox/AcrylicComboBox.xaml b/CollapseLauncher/XAMLs/Theme/ComboBox/AcrylicComboBox.xaml
new file mode 100644
index 0000000000..42fdbd3e4d
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/ComboBox/AcrylicComboBox.xaml
@@ -0,0 +1,446 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/ComboBox/DefaultComboBox.xaml b/CollapseLauncher/XAMLs/Theme/ComboBox/DefaultComboBox.xaml
new file mode 100644
index 0000000000..71d5fb4d7f
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/ComboBox/DefaultComboBox.xaml
@@ -0,0 +1,448 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/CODE_OF_CONDUCT.md b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/CODE_OF_CONDUCT.md
similarity index 100%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/CODE_OF_CONDUCT.md
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/CODE_OF_CONDUCT.md
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/CommitInfo b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/CommitInfo
similarity index 100%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/CommitInfo
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/CommitInfo
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/Contributing.md b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/Contributing.md
similarity index 100%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/Contributing.md
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/Contributing.md
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/DataTable/DataColumn.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/DataTable/DataColumn.cs
similarity index 99%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/DataTable/DataColumn.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/DataTable/DataColumn.cs
index 16cb5f4113..d4a264d823 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/DataTable/DataColumn.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/DataTable/DataColumn.cs
@@ -8,6 +8,7 @@
using Microsoft.UI.Xaml.Input;
using System;
// ReSharper disable All
+#pragma warning disable IDE0130
namespace CommunityToolkit.WinUI.Controls.Labs.DataTable;
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/DataTable/DataColumn.xaml b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/DataTable/DataColumn.xaml
similarity index 98%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/DataTable/DataColumn.xaml
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/DataTable/DataColumn.xaml
index 2ebfe2e795..07aefeef1d 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/DataTable/DataColumn.xaml
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/DataTable/DataColumn.xaml
@@ -1,4 +1,5 @@
+
Children.Any(static e => e is DataColumn { CurrentWidth.GridUnitType: GridUnitType.Auto });
// TODO: Check with Sergio if there's a better structure here, as I don't need a Dictionary like ConditionalWeakTable
- internal HashSet Rows { get; private set; } = new();
+ internal HashSet Rows { get; private set; } = [];
internal void ColumnResized()
{
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/License.md b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/License.md
similarity index 100%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/License.md
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/License.md
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/DefaultSVGRenderer.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/DefaultSVGRenderer.cs
similarity index 80%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/DefaultSVGRenderer.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/DefaultSVGRenderer.cs
index bd2f5faf19..6c59c0930f 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/DefaultSVGRenderer.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/DefaultSVGRenderer.cs
@@ -7,7 +7,10 @@
using System;
using System.IO;
using System.Threading.Tasks;
+using Windows.Foundation;
+
// ReSharper disable InconsistentNaming
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock;
@@ -15,11 +18,11 @@ internal class DefaultSVGRenderer : ISVGRenderer
{
public async Task SvgToImage(string svgString)
{
- SvgImageSource svgImageSource = new SvgImageSource();
- var image = new Image();
+ SvgImageSource svgImageSource = new();
+ Image image = new();
// Create a MemoryStream object and write the SVG string to it
- using (var memoryStream = new MemoryStream())
- await using (var streamWriter = new StreamWriter(memoryStream))
+ using (MemoryStream memoryStream = new())
+ await using (StreamWriter streamWriter = new(memoryStream))
{
await streamWriter.WriteAsync(svgString);
await streamWriter.FlushAsync();
@@ -33,7 +36,7 @@ public async Task SvgToImage(string svgString)
// Set the Source property of the Image control to the SvgImageSource object
image.Source = svgImageSource;
- var size = Extensions.GetSvgSize(svgString);
+ Size size = Extensions.GetSvgSize(svgString);
if (size.Width != 0)
{
image.Width = size.Width;
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Extensions.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Extensions.cs
similarity index 98%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Extensions.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Extensions.cs
index c737f49196..e12ad079d8 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Extensions.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Extensions.cs
@@ -23,6 +23,8 @@
// ReSharper disable UnusedMember.Global
// ReSharper disable IdentifierTypo
// ReSharper disable CommentTypo
+// ReSharper disable StringLiteralTypo
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock;
@@ -328,9 +330,9 @@ public static partial class Extensions
public static string ToAlphabetical(this int index)
{
- string alphabetical = "abcdefghijklmnopqrstuvwxyz";
- int remainder = index;
- StringBuilder stringBuilder = new StringBuilder();
+ const string alphabetical = "abcdefghijklmnopqrstuvwxyz";
+ int remainder = index;
+ StringBuilder stringBuilder = new();
while (remainder != 0)
{
if (remainder > 26)
@@ -670,13 +672,13 @@ public static Size GetMarkdownImageSize(LinkInline link)
public static SolidColorBrush GetAccentColorBrush()
{
// Create a UISettings object to get the accent color
- UISettings uiSettings = new UISettings();
+ UISettings uiSettings = new();
// Get the accent color as a Color value
Color accentColor = uiSettings.GetColorValue(UIColorType.Accent);
// Create a SolidColorBrush from the accent color
- SolidColorBrush accentBrush = new SolidColorBrush(accentColor);
+ SolidColorBrush accentBrush = new(accentColor);
return accentBrush;
}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/HtmlWriter.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/HtmlWriter.cs
similarity index 89%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/HtmlWriter.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/HtmlWriter.cs
index c83c8686fa..709026fe97 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/HtmlWriter.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/HtmlWriter.cs
@@ -7,6 +7,7 @@
using CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements.Html;
using HtmlAgilityPack;
using System.Linq;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock;
@@ -15,7 +16,7 @@ internal class HtmlWriter
public static void WriteHtml(WinUIRenderer renderer, HtmlNodeCollection nodes)
{
if (nodes == null || nodes.Count == 0) return;
- foreach (var node in nodes)
+ foreach (HtmlNode node in nodes)
{
if (node.NodeType == HtmlNodeType.Text)
{
@@ -24,7 +25,7 @@ public static void WriteHtml(WinUIRenderer renderer, HtmlNodeCollection nodes)
else if (node.NodeType == HtmlNodeType.Element && node.Name.TagToType() == HtmlElementType.Inline)
{
// detect br here
- var inlineTagName = node.Name.ToLower();
+ string inlineTagName = node.Name.ToLower();
if (inlineTagName == "br")
{
renderer.WriteInline(new MyLineBreak());
@@ -46,12 +47,12 @@ public static void WriteHtml(WinUIRenderer renderer, HtmlNodeCollection nodes)
}
else if (inlineTagName == "img")
{
- var image = new MyImage(node, renderer.Config);
+ MyImage image = new(node, renderer.Config);
renderer.WriteInline(image);
}
else
{
- var inline = new MyInline();
+ MyInline inline = new();
renderer.Push(inline);
WriteHtml(renderer, node.ChildNodes);
renderer.Pop();
@@ -60,7 +61,7 @@ public static void WriteHtml(WinUIRenderer renderer, HtmlNodeCollection nodes)
else if (node.NodeType == HtmlNodeType.Element && node.Name.TagToType() == HtmlElementType.Block)
{
IAddChild block;
- var tag = node.Name.ToLower();
+ string tag = node.Name.ToLower();
if (tag == "details")
{
block = new MyDetails(node);
@@ -70,7 +71,7 @@ public static void WriteHtml(WinUIRenderer renderer, HtmlNodeCollection nodes)
}
else if (tag.IsHeading())
{
- var heading = new MyHeading(node, renderer.Config);
+ MyHeading heading = new(node);
renderer.Push(heading);
WriteHtml(renderer, node.ChildNodes);
}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/IImageProvider.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/IImageProvider.cs
similarity index 93%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/IImageProvider.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/IImageProvider.cs
index 5e631f3158..1b9bcc8638 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/IImageProvider.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/IImageProvider.cs
@@ -4,6 +4,7 @@
using Microsoft.UI.Xaml.Controls;
using System.Threading.Tasks;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock;
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/ISVGRenderer.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/ISVGRenderer.cs
similarity index 93%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/ISVGRenderer.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/ISVGRenderer.cs
index 8793b55f75..a8ded60445 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/ISVGRenderer.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/ISVGRenderer.cs
@@ -5,6 +5,7 @@
using Microsoft.UI.Xaml.Controls;
using System.Threading.Tasks;
// ReSharper disable InconsistentNaming
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock;
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownConfig.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownConfig.cs
similarity index 100%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownConfig.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownConfig.cs
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownTextBlock.xaml b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownTextBlock.xaml
similarity index 100%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownTextBlock.xaml
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownTextBlock.xaml
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownTextBlock.xaml.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownTextBlock.xaml.cs
similarity index 88%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownTextBlock.xaml.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownTextBlock.xaml.cs
index d7a9c6f191..471f626d43 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownTextBlock.xaml.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownTextBlock.xaml.cs
@@ -8,6 +8,8 @@
using Markdig;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
+#pragma warning disable IDE0130
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock;
// ReSharper disable All
@@ -15,11 +17,11 @@ namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock;
[TemplatePart(Name = MarkdownContainerName, Type = typeof(Grid))]
public partial class MarkdownTextBlock : Control
{
- private const string MarkdownContainerName = "MarkdownContainer";
- private Grid? _container;
- private MarkdownPipeline _pipeline;
- private MyFlowDocument _document;
- private WinUIRenderer? _renderer;
+ private const string MarkdownContainerName = "MarkdownContainer";
+ private Grid? _container;
+ private readonly MarkdownPipeline _pipeline;
+ private readonly MyFlowDocument _document;
+ private WinUIRenderer? _renderer;
private static readonly DependencyProperty ConfigProperty = DependencyProperty.Register(
nameof(Config),
@@ -106,10 +108,7 @@ private void ApplyText(string text, bool rerender)
private void Build()
{
- if (_renderer == null)
- {
- _renderer = new WinUIRenderer(_document, Config);
- }
+ _renderer ??= new WinUIRenderer(_document, Config);
_pipeline.Setup(_renderer);
ApplyText(Text, false);
}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownThemes.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownThemes.cs
similarity index 98%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownThemes.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownThemes.cs
index 55cacf83d5..281b0e42e0 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownThemes.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/MarkdownThemes.cs
@@ -9,6 +9,7 @@
using FontWeights = Microsoft.UI.Text.FontWeights;
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable UnusedMember.Global
+#pragma warning disable IDE0130
namespace CommunityToolkit.WinUI.Controls.MarkdownTextBlockRns;
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/CodeBlockRenderer.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/CodeBlockRenderer.cs
similarity index 90%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/CodeBlockRenderer.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/CodeBlockRenderer.cs
index 797abbdc57..9b06513b2a 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/CodeBlockRenderer.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/CodeBlockRenderer.cs
@@ -5,6 +5,7 @@
using CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
using Markdig.Renderers;
using Markdig.Syntax;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.Renderers.ObjectRenderers;
@@ -12,7 +13,7 @@ internal class CodeBlockRenderer : MarkdownObjectRenderer 0)
{
@@ -50,7 +52,7 @@ protected override void Write(WinUIRenderer renderer, Table table)
};
}
- var myCell = new MyTableCell(cell, textAlignment, row.IsHeader, columnIndex, rowIndex);
+ MyTableCell myCell = new(cell, textAlignment, row.IsHeader, columnIndex, rowIndex);
renderer.Push(myCell);
renderer.Write(cell);
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Extensions/TaskListRenderer.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Extensions/TaskListRenderer.cs
similarity index 90%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Extensions/TaskListRenderer.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Extensions/TaskListRenderer.cs
index d840b422de..ac0a3e4384 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Extensions/TaskListRenderer.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Extensions/TaskListRenderer.cs
@@ -6,6 +6,7 @@
using Markdig.Extensions.TaskLists;
using Markdig.Renderers;
using System;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.Renderers.ObjectRenderers.Extensions;
@@ -16,7 +17,7 @@ protected override void Write(WinUIRenderer renderer, TaskList taskList)
if (renderer == null) throw new ArgumentNullException(nameof(renderer));
if (taskList == null) throw new ArgumentNullException(nameof(taskList));
- var checkBox = new MyTaskListCheckBox(taskList);
+ MyTaskListCheckBox checkBox = new(taskList);
renderer.WriteInline(checkBox);
}
}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/HeadingRenderer.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/HeadingRenderer.cs
similarity index 92%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/HeadingRenderer.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/HeadingRenderer.cs
index 6347fba864..7cda09c9aa 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/HeadingRenderer.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/HeadingRenderer.cs
@@ -6,6 +6,7 @@
using Markdig.Renderers;
using Markdig.Syntax;
using System;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.Renderers.ObjectRenderers;
@@ -16,7 +17,7 @@ protected override void Write(WinUIRenderer renderer, HeadingBlock obj)
if (renderer == null) throw new ArgumentNullException(nameof(renderer));
if (obj == null) throw new ArgumentNullException(nameof(obj));
- var paragraph = new MyHeading(obj, renderer.Config);
+ MyHeading paragraph = new(obj);
renderer.Push(paragraph);
renderer.WriteLeafInline(obj);
renderer.Pop();
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/HtmlBlockRenderer.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/HtmlBlockRenderer.cs
similarity index 98%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/HtmlBlockRenderer.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/HtmlBlockRenderer.cs
index 7c41bab4d2..266e4ab546 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/HtmlBlockRenderer.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/HtmlBlockRenderer.cs
@@ -9,6 +9,7 @@
using System;
using System.Text;
using System.Text.RegularExpressions;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.Renderers.ObjectRenderers;
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/AutoLinkInlineRenderer.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/AutoLinkInlineRenderer.cs
similarity index 90%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/AutoLinkInlineRenderer.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/AutoLinkInlineRenderer.cs
index e873d7ebc4..de168d035c 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/AutoLinkInlineRenderer.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/AutoLinkInlineRenderer.cs
@@ -6,6 +6,7 @@
using Markdig.Renderers;
using Markdig.Syntax.Inlines;
using System;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.Renderers.ObjectRenderers.Inlines;
@@ -16,7 +17,7 @@ protected override void Write(WinUIRenderer renderer, AutolinkInline link)
if (renderer == null) throw new ArgumentNullException(nameof(renderer));
if (link == null) throw new ArgumentNullException(nameof(link));
- var url = link.Url;
+ string url = link.Url;
if (link.IsEmail)
{
url = "mailto:" + url;
@@ -27,7 +28,7 @@ protected override void Write(WinUIRenderer renderer, AutolinkInline link)
url = "#";
}
- var autolink = new MyAutolinkInline(link);
+ MyAutolinkInline autolink = new(link);
renderer.Push(autolink);
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/CodeInlineRenderer.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/CodeInlineRenderer.cs
similarity index 90%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/CodeInlineRenderer.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/CodeInlineRenderer.cs
index 8cff68fce4..36f8b38e59 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/CodeInlineRenderer.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/CodeInlineRenderer.cs
@@ -6,6 +6,7 @@
using Markdig.Renderers;
using Markdig.Syntax.Inlines;
using System;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.Renderers.ObjectRenderers.Inlines;
@@ -16,6 +17,6 @@ protected override void Write(WinUIRenderer renderer, CodeInline obj)
if (renderer == null) throw new ArgumentNullException(nameof(renderer));
if (obj == null) throw new ArgumentNullException(nameof(obj));
- renderer.WriteInline(new MyInlineCode(obj, renderer.Config));
+ renderer.WriteInline(new MyInlineCode(obj));
}
}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/ContainerInlineRenderer.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/ContainerInlineRenderer.cs
similarity index 89%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/ContainerInlineRenderer.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/ContainerInlineRenderer.cs
index 93dd1ba865..3c0700f5e8 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/ContainerInlineRenderer.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/Renderers/ObjectRenderers/Inlines/ContainerInlineRenderer.cs
@@ -4,6 +4,7 @@
using Markdig.Renderers;
using Markdig.Syntax.Inlines;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.Renderers.ObjectRenderers.Inlines;
@@ -11,7 +12,7 @@ internal class ContainerInlineRenderer : MarkdownObjectRenderer _richTextBlocks;
- public TextElement TextElement
- {
- get => _paragraph;
- }
+ public TextElement TextElement => _paragraph;
public MyBlock(HtmlNode block)
{
_htmlNode = block;
- var align = _htmlNode.GetAttributeValue("align", "left");
+ string align = _htmlNode.GetAttributeValue("align", "left");
_richTextBlocks = [];
_paragraph = new Paragraph
{
@@ -46,8 +44,8 @@ public void AddChild(IAddChild child)
if (child.TextElement is Block blockChild)
{
_paragraph.Inlines.Add(new LineBreak());
- var inlineUIContainer = new InlineUIContainer();
- var richTextBlock = new RichTextBlock();
+ InlineUIContainer inlineUIContainer = new();
+ RichTextBlock richTextBlock = new();
richTextBlock.Blocks.Add(blockChild);
inlineUIContainer.Child = richTextBlock;
_richTextBlocks.Add(richTextBlock);
@@ -66,7 +64,7 @@ private void StyleBlock()
{
case "address":
_paragraph.FontStyle = FontStyle.Italic;
- foreach (var richTextBlock in _richTextBlocks)
+ foreach (RichTextBlock richTextBlock in _richTextBlocks)
{
richTextBlock.FontStyle = FontStyle.Italic;
}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/Html/MyDetails.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/Html/MyDetails.cs
similarity index 66%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/Html/MyDetails.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/Html/MyDetails.cs
index b94d20a205..1553f9508d 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/Html/MyDetails.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/Html/MyDetails.cs
@@ -7,6 +7,7 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Documents;
using System.Linq;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements.Html;
@@ -16,32 +17,27 @@ internal class MyDetails : IAddChild
private readonly MyFlowDocument _flowDocument;
private readonly Paragraph _paragraph;
- public TextElement TextElement
- {
- get => _paragraph;
- }
+ public TextElement TextElement => _paragraph;
public MyDetails(HtmlNode details)
{
- var header = details.ChildNodes
- .FirstOrDefault(
- x => x.Name == "summary" ||
- x.Name == "header");
+ HtmlNode header = details.ChildNodes
+ .FirstOrDefault(x => x.Name is "summary" or "header");
- InlineUIContainer inlineUIContainer = new InlineUIContainer();
- Expander expander = new Expander
+ InlineUIContainer inlineUIContainer = new();
+ Expander expander = new()
{
HorizontalAlignment = HorizontalAlignment.Stretch
};
- _flowDocument = new MyFlowDocument
+ _flowDocument = new MyFlowDocument
{
RichTextBlock =
{
HorizontalAlignment = HorizontalAlignment.Stretch
}
};
- expander.Content = _flowDocument.RichTextBlock;
- var headerBlock = new TextBlock
+ expander.Content = _flowDocument.RichTextBlock;
+ TextBlock headerBlock = new()
{
Text = header?.InnerText,
HorizontalAlignment = HorizontalAlignment.Stretch
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/Html/MyInline.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/Html/MyInline.cs
similarity index 92%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/Html/MyInline.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/Html/MyInline.cs
index d6dca2f9c4..b2bb311966 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/Html/MyInline.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/Html/MyInline.cs
@@ -5,6 +5,7 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Documents;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements.Html;
@@ -13,16 +14,13 @@ internal class MyInline : IAddChild
private readonly Paragraph _paragraph;
private readonly InlineUIContainer _inlineUIContainer;
- public TextElement TextElement
- {
- get => _inlineUIContainer;
- }
+ public TextElement TextElement => _inlineUIContainer;
public MyInline()
{
_paragraph = new Paragraph();
_inlineUIContainer = new InlineUIContainer();
- RichTextBlock richTextBlock = new RichTextBlock();
+ RichTextBlock richTextBlock = new();
richTextBlock.Blocks.Add(_paragraph);
richTextBlock.HorizontalAlignment = HorizontalAlignment.Stretch;
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/HtmlElementType.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/HtmlElementType.cs
similarity index 91%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/HtmlElementType.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/HtmlElementType.cs
index 3e362145ae..98091f73e3 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/HtmlElementType.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/HtmlElementType.cs
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/IAddChild.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/IAddChild.cs
similarity index 92%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/IAddChild.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/IAddChild.cs
index 7d81f740bf..65c71fd2c0 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/IAddChild.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/IAddChild.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using Microsoft.UI.Xaml.Documents;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyAutolinkInline.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyAutolinkInline.cs
similarity index 90%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyAutolinkInline.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyAutolinkInline.cs
index 10a8c1b5a2..4785c30347 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyAutolinkInline.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyAutolinkInline.cs
@@ -5,6 +5,7 @@
using Markdig.Syntax.Inlines;
using Microsoft.UI.Xaml.Documents;
using System;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -20,7 +21,7 @@ public void AddChild(IAddChild child)
{
try
{
- var text = (MyInlineText)child;
+ MyInlineText text = (MyInlineText)child;
((Hyperlink)TextElement).Inlines.Add((Run)text.TextElement);
}
catch (Exception ex)
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyBlockContainer.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyBlockContainer.cs
similarity index 84%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyBlockContainer.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyBlockContainer.cs
index e7a4f41882..1536b39cdc 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyBlockContainer.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyBlockContainer.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using Microsoft.UI.Xaml.Documents;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -11,14 +12,11 @@ internal class MyBlockContainer : IAddChild
private readonly MyFlowDocument _flowDocument;
private readonly Paragraph _paragraph;
- public TextElement TextElement
- {
- get => _paragraph;
- }
+ public TextElement TextElement => _paragraph;
public MyBlockContainer()
{
- InlineUIContainer inlineUIContainer = new InlineUIContainer();
+ InlineUIContainer inlineUIContainer = new();
_flowDocument = new MyFlowDocument();
inlineUIContainer.Child = _flowDocument.RichTextBlock;
_paragraph = new Paragraph();
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyCodeBlock.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyCodeBlock.cs
similarity index 81%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyCodeBlock.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyCodeBlock.cs
index 1a7111ee91..2f920c5b41 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyCodeBlock.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyCodeBlock.cs
@@ -11,6 +11,7 @@
using System.Collections.Generic;
using System.Text;
// ReSharper disable CommentTypo
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -18,23 +19,20 @@ internal class MyCodeBlock : IAddChild
{
private readonly Paragraph _paragraph;
- public TextElement TextElement
- {
- get => _paragraph;
- }
+ public TextElement TextElement => _paragraph;
- public MyCodeBlock(CodeBlock codeBlock, MarkdownConfig config)
+ public MyCodeBlock(CodeBlock codeBlock)
{
_paragraph = new Paragraph();
- var container = new InlineUIContainer();
- var border = new Border
+ InlineUIContainer container = new();
+ Border border = new()
{
Background = (Brush)Application.Current.Resources["ExpanderHeaderBackground"],
Padding = MarkdownConfig.Themes.Padding,
Margin = MarkdownConfig.Themes.InternalMargin,
CornerRadius = MarkdownConfig.Themes.CornerRadius
};
- var richTextBlock = new RichTextBlock();
+ RichTextBlock richTextBlock = new();
if (codeBlock is FencedCodeBlock fencedCodeBlock)
{
@@ -43,17 +41,17 @@ public MyCodeBlock(CodeBlock codeBlock, MarkdownConfig config)
//#else
// var formatter = new ColorCode.RichTextBlockFormatter(Extensions.GetOneDarkProStyle());
//#endif
- var stringBuilder = new StringBuilder();
+ StringBuilder stringBuilder = new();
// go through all the lines backwards and only add the lines to a stack if we have encountered the first non-empty line
StringLine[] lines = fencedCodeBlock.Lines.Lines;
Stack stack = new();
- var encounteredFirstNonEmptyLine = false;
+ bool encounteredFirstNonEmptyLine = false;
if (lines.Length != 0)
{
- for (var i = lines.Length - 1; i >= 0; i--)
+ for (int i = lines.Length - 1; i >= 0; i--)
{
- var line = lines[i];
+ StringLine line = lines[i];
if (string.IsNullOrWhiteSpace(line.ToString()) && !encounteredFirstNonEmptyLine)
{
continue;
@@ -74,10 +72,10 @@ public MyCodeBlock(CodeBlock codeBlock, MarkdownConfig config)
}
else
{
- foreach (var line in codeBlock.Lines.Lines)
+ foreach (StringLine line in codeBlock.Lines.Lines)
{
- var paragraph = new Paragraph();
- var lineString = line.ToString();
+ Paragraph paragraph = new();
+ string lineString = line.ToString();
if (!string.IsNullOrWhiteSpace(lineString))
{
paragraph.Inlines.Add(new Run { Text = lineString });
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyEmphasisInline.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyEmphasisInline.cs
similarity index 96%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyEmphasisInline.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyEmphasisInline.cs
index 40d6f95e7e..d190e3d5d0 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyEmphasisInline.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyEmphasisInline.cs
@@ -7,6 +7,7 @@
using Microsoft.UI.Xaml.Documents;
using System;
using Windows.UI.Text;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -18,10 +19,7 @@ internal class MyEmphasisInline : IAddChild
private bool _isItalic;
private bool _isStrikeThrough;
- public TextElement TextElement
- {
- get => _span;
- }
+ public TextElement TextElement => _span;
public void AddChild(IAddChild child)
{
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyFlowDocument.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyFlowDocument.cs
similarity index 57%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyFlowDocument.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyFlowDocument.cs
index 67f909ca54..cb07f7460b 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyFlowDocument.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyFlowDocument.cs
@@ -7,38 +7,31 @@
using Microsoft.UI.Xaml.Documents;
using Block = Microsoft.UI.Xaml.Documents.Block;
using Inline = Microsoft.UI.Xaml.Documents.Inline;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
public class MyFlowDocument : IAddChild
{
- private RichTextBlock _richTextBlock = new();
-
// useless property
public TextElement TextElement { get; set; } = new Run();
//
- public RichTextBlock RichTextBlock
- {
- get => _richTextBlock;
- set => _richTextBlock = value;
- }
+ public RichTextBlock RichTextBlock { get; set; } = new();
public void AddChild(IAddChild child)
{
TextElement element = child.TextElement;
- if (element != null)
+ if (element == null) return;
+ if (element is Block block)
+ {
+ RichTextBlock.Blocks.Add(block);
+ }
+ else if (element is Inline inline)
{
- if (element is Block block)
- {
- _richTextBlock.Blocks.Add(block);
- }
- else if (element is Inline inline)
- {
- var paragraph = new Paragraph();
- paragraph.Inlines.Add(inline);
- _richTextBlock.Blocks.Add(paragraph);
- }
+ Paragraph paragraph = new();
+ paragraph.Inlines.Add(inline);
+ RichTextBlock.Blocks.Add(paragraph);
}
}
}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHeading.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHeading.cs
similarity index 89%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHeading.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHeading.cs
index 6293c86c7d..d44524a115 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHeading.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHeading.cs
@@ -8,6 +8,7 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Documents;
// ReSharper disable UnusedMember.Global
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -18,16 +19,13 @@ internal class MyHeading : IAddChild
public bool IsHtml => _htmlNode != null;
- public TextElement TextElement
- {
- get => _paragraph;
- }
+ public TextElement TextElement => _paragraph;
- public MyHeading(HeadingBlock headingBlock, MarkdownConfig config)
+ public MyHeading(HeadingBlock headingBlock)
{
_paragraph = new Paragraph();
- var level = headingBlock.Level;
+ int level = headingBlock.Level;
_paragraph.FontSize = level switch
{
1 => MarkdownConfig.Themes.H1FontSize,
@@ -56,12 +54,12 @@ public MyHeading(HeadingBlock headingBlock, MarkdownConfig config)
});
}
- public MyHeading(HtmlNode htmlNode, MarkdownConfig config)
+ public MyHeading(HtmlNode htmlNode)
{
_htmlNode = htmlNode;
_paragraph = new Paragraph();
- var align = _htmlNode?.GetAttributeValue("align", "left");
+ string? align = _htmlNode?.GetAttributeValue("align", "left");
_paragraph.TextAlignment = align switch
{
"left" => TextAlignment.Left,
@@ -71,7 +69,7 @@ public MyHeading(HtmlNode htmlNode, MarkdownConfig config)
_ => TextAlignment.Left
};
- var level = int.Parse(htmlNode.Name.Substring(1));
+ int level = int.Parse(htmlNode.Name.Substring(1));
_paragraph.FontSize = level switch
{
1 => MarkdownConfig.Themes.H1FontSize,
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHyperlink.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHyperlink.cs
similarity index 61%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHyperlink.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHyperlink.cs
index 5564eff419..980ea52af8 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHyperlink.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHyperlink.cs
@@ -9,6 +9,7 @@
using Microsoft.UI.Xaml.Documents;
using System;
using Inline = Microsoft.UI.Xaml.Documents.Inline;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -16,14 +17,11 @@ internal class MyHyperlink : IAddChild
{
private readonly Hyperlink _hyperlink;
- public TextElement TextElement
- {
- get => _hyperlink;
- }
+ public TextElement TextElement => _hyperlink;
public MyHyperlink(LinkInline linkInline, string? baseUrl)
{
- var url = linkInline.GetDynamicUrl != null ? linkInline.GetDynamicUrl() : linkInline.Url;
+ string? url = linkInline.GetDynamicUrl != null ? linkInline.GetDynamicUrl() : linkInline.Url;
_hyperlink = new Hyperlink
{
NavigateUri = Extensions.GetUri(url, baseUrl)
@@ -32,7 +30,7 @@ public MyHyperlink(LinkInline linkInline, string? baseUrl)
public MyHyperlink(HtmlNode htmlNode, string? baseUrl)
{
- var url = htmlNode.GetAttributeValue("href", "#");
+ string url = htmlNode.GetAttributeValue("href", "#");
_hyperlink = new Hyperlink
{
NavigateUri = Extensions.GetUri(url, baseUrl)
@@ -41,17 +39,15 @@ public MyHyperlink(HtmlNode htmlNode, string? baseUrl)
public void AddChild(IAddChild child)
{
- if (child.TextElement is Inline inlineChild)
+ if (child.TextElement is not Inline inlineChild) return;
+ try
+ {
+ _hyperlink.Inlines.Add(inlineChild);
+ // TODO: Add support for click handler
+ }
+ catch (Exception ex)
{
- try
- {
- _hyperlink.Inlines.Add(inlineChild);
- // TODO: Add support for click handler
- }
- catch (Exception ex)
- {
- Logger.LogWriteLine($"[MyHyperlink::AddChild()] Failed while adding inlines\r\n{ex}", LogType.Error, true);
- }
+ Logger.LogWriteLine($"[MyHyperlink::AddChild()] Failed while adding inlines\r\n{ex}", LogType.Error, true);
}
}
}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHyperlinkButton.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHyperlinkButton.cs
similarity index 81%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHyperlinkButton.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHyperlinkButton.cs
index cacc447547..ca7e9ed8a1 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHyperlinkButton.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyHyperlinkButton.cs
@@ -8,6 +8,7 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Documents;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -21,14 +22,11 @@ internal class MyHyperlinkButton : IAddChild
public bool IsHtml => _htmlNode != null;
- public TextElement TextElement
- {
- get => _inlineUIContainer;
- }
+ public TextElement TextElement => _inlineUIContainer;
public MyHyperlinkButton(LinkInline linkInline, string? baseUrl)
{
- var url = linkInline.GetDynamicUrl != null ? linkInline.GetDynamicUrl() : linkInline.Url;
+ string? url = linkInline.GetDynamicUrl != null ? linkInline.GetDynamicUrl() : linkInline.Url;
_linkInline = linkInline;
Init(url, baseUrl);
}
@@ -36,7 +34,7 @@ public MyHyperlinkButton(LinkInline linkInline, string? baseUrl)
public MyHyperlinkButton(HtmlNode htmlNode, string? baseUrl)
{
_htmlNode = htmlNode;
- var url = htmlNode.GetAttributeValue("href", "#");
+ string url = htmlNode.GetAttributeValue("href", "#");
Init(url, baseUrl);
}
@@ -48,14 +46,11 @@ private void Init(string? url, string? baseUrl)
Padding = new Thickness(0),
Margin = new Thickness(0)
};
- if (IsHtml && _htmlNode != null)
- {
- _flowDoc = new MyFlowDocument();
- }
- else if (_linkInline != null)
+ if ((IsHtml && _htmlNode != null) || _linkInline != null)
{
_flowDoc = new MyFlowDocument();
}
+
_inlineUIContainer.Child = _hyperLinkButton;
_hyperLinkButton.Content = _flowDoc?.RichTextBlock;
}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyImage.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyImage.cs
similarity index 93%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyImage.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyImage.cs
index 6de75e0410..07094f2021 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyImage.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyImage.cs
@@ -15,8 +15,10 @@
using System.Globalization;
using System.Net.Http;
using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
using Windows.Storage.Streams;
// ReSharper disable AsyncVoidMethod
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -32,10 +34,7 @@ internal class MyImage : IAddChild
private readonly double _precedentHeight;
private bool _loaded;
- public TextElement TextElement
- {
- get => _container;
- }
+ public TextElement TextElement => _container;
public MyImage(LinkInline linkInline, Uri uri, MarkdownConfig config)
{
@@ -43,7 +42,7 @@ public MyImage(LinkInline linkInline, Uri uri, MarkdownConfig config)
_imageProvider = config.ImageProvider;
_svgRenderer = config.SVGRenderer ?? new DefaultSVGRenderer();
Init();
- var size = Extensions.GetMarkdownImageSize(linkInline);
+ Size size = Extensions.GetMarkdownImageSize(linkInline);
if (size.Width != 0)
{
_precedentWidth = size.Width;
@@ -64,13 +63,13 @@ public MyImage(HtmlNode htmlNode, MarkdownConfig? config)
htmlNode.GetAttributeValue("width", "0"),
NumberStyles.Integer,
CultureInfo.InvariantCulture,
- out var width
+ out int width
);
int.TryParse(
htmlNode.GetAttributeValue("height", "0"),
NumberStyles.Integer,
CultureInfo.InvariantCulture,
- out var height
+ out int height
);
if (width > 0)
{
@@ -115,7 +114,7 @@ private async void LoadImage(object sender, RoutedEventArgs e)
if (contentType == "image/svg+xml")
{
string svgString = await response.Content.ReadAsStringAsync();
- var resImage = await _svgRenderer.SvgToImage(svgString);
+ Image? resImage = await _svgRenderer.SvgToImage(svgString);
if (resImage != null)
{
_image = resImage;
@@ -126,8 +125,8 @@ private async void LoadImage(object sender, RoutedEventArgs e)
{
byte[] data = await response.Content.ReadAsByteArrayAsync();
// Create a BitmapImage for other supported formats
- BitmapImage bitmap = new BitmapImage();
- using (InMemoryRandomAccessStream stream = new InMemoryRandomAccessStream())
+ BitmapImage bitmap = new();
+ using (InMemoryRandomAccessStream stream = new())
{
// Write the data to the stream
await stream.WriteAsync(data.AsBuffer());
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyInlineCode.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyInlineCode.cs
similarity index 84%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyInlineCode.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyInlineCode.cs
index 7c3796fbb5..98e27eeb1d 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyInlineCode.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyInlineCode.cs
@@ -8,6 +8,7 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Documents;
using Microsoft.UI.Xaml.Media.Media3D;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -15,15 +16,12 @@ internal class MyInlineCode : IAddChild
{
private readonly InlineUIContainer _inlineContainer;
- public TextElement TextElement
- {
- get => _inlineContainer;
- }
+ public TextElement TextElement => _inlineContainer;
- public MyInlineCode(CodeInline codeInline, MarkdownConfig config)
+ public MyInlineCode(CodeInline codeInline)
{
_inlineContainer = new InlineUIContainer();
- var border = new Border
+ Border border = new()
{
VerticalAlignment = VerticalAlignment.Bottom,
Background = MarkdownConfig.Themes.InlineCodeBackground,
@@ -32,12 +30,12 @@ public MyInlineCode(CodeInline codeInline, MarkdownConfig config)
CornerRadius = MarkdownConfig.Themes.InlineCodeCornerRadius,
Padding = MarkdownConfig.Themes.InlineCodePadding
};
- CompositeTransform3D transform = new CompositeTransform3D
+ CompositeTransform3D transform = new()
{
TranslateY = 4
};
border.Transform3D = transform;
- var textBlock = new TextBlock
+ TextBlock textBlock = new()
{
FontFamily = MarkdownConfig.Themes.InlineCodeFontFamily,
FontSize = MarkdownConfig.Themes.InlineCodeFontSize,
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyInlineText.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyInlineText.cs
similarity index 86%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyInlineText.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyInlineText.cs
index 6119923b60..e17820a053 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyInlineText.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyInlineText.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using Microsoft.UI.Xaml.Documents;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -13,10 +14,7 @@ internal class MyInlineText(string text) : IAddChild
Text = text
};
- public TextElement TextElement
- {
- get => _run;
- }
+ public TextElement TextElement => _run;
public void AddChild(IAddChild child) { }
}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyLineBreak.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyLineBreak.cs
similarity index 84%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyLineBreak.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyLineBreak.cs
index 8a627c919d..21c7368b4b 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyLineBreak.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyLineBreak.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using Microsoft.UI.Xaml.Documents;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -10,10 +11,7 @@ internal class MyLineBreak : IAddChild
{
private readonly LineBreak _lineBreak = new();
- public TextElement TextElement
- {
- get => _lineBreak;
- }
+ public TextElement TextElement => _lineBreak;
public void AddChild(IAddChild child) { }
}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyList.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyList.cs
similarity index 93%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyList.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyList.cs
index 065c5c77b7..bb50ce4ecb 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyList.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyList.cs
@@ -8,6 +8,7 @@
using Microsoft.UI.Xaml.Documents;
using RomanNumerals;
using System.Globalization;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -20,15 +21,12 @@ internal class MyList : IAddChild
private int _index = 1;
private const string Dot = "• ";
- public TextElement TextElement
- {
- get => _paragraph;
- }
+ public TextElement TextElement => _paragraph;
public MyList(ListBlock listBlock)
{
_paragraph = new Paragraph();
- InlineUIContainer container = new InlineUIContainer();
+ InlineUIContainer container = new();
_stackPanel = new StackPanel();
if (listBlock.IsOrdered)
@@ -50,7 +48,7 @@ public MyList(ListBlock listBlock)
public void AddChild(IAddChild child)
{
- var grid = new Grid();
+ Grid grid = new();
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
string bullet;
@@ -71,14 +69,14 @@ public void AddChild(IAddChild child)
{
bullet = Dot;
}
- var textBlock = new TextBlock
+ TextBlock textBlock = new()
{
Text = bullet
};
textBlock.SetValue(Grid.ColumnProperty, 0);
textBlock.VerticalAlignment = VerticalAlignment.Top;
grid.Children.Add(textBlock);
- var flowDoc = new MyFlowDocument();
+ MyFlowDocument flowDoc = new();
flowDoc.AddChild(child);
flowDoc.RichTextBlock.SetValue(Grid.ColumnProperty, 1);
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyParagraph.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyParagraph.cs
similarity index 83%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyParagraph.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyParagraph.cs
index 3b64c16405..9ffd157e0d 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyParagraph.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyParagraph.cs
@@ -5,6 +5,7 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Documents;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -12,10 +13,7 @@ internal class MyParagraph : IAddChild
{
private readonly Paragraph _paragraph = new();
- public TextElement TextElement
- {
- get => _paragraph;
- }
+ public TextElement TextElement => _paragraph;
public void AddChild(IAddChild child)
{
@@ -25,8 +23,8 @@ public void AddChild(IAddChild child)
}
else if (child.TextElement is Block blockChild)
{
- var inlineUIContainer = new InlineUIContainer();
- var richTextBlock = new RichTextBlock
+ InlineUIContainer inlineUIContainer = new();
+ RichTextBlock richTextBlock = new()
{
TextWrapping = TextWrapping.Wrap
};
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyQuote.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyQuote.cs
similarity index 88%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyQuote.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyQuote.cs
index c4cdff1d91..47ba53ccee 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyQuote.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyQuote.cs
@@ -7,6 +7,7 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Documents;
using Microsoft.UI.Xaml.Media;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -15,23 +16,20 @@ internal class MyQuote : IAddChild
private readonly Paragraph _paragraph;
private readonly MyFlowDocument _flowDocument;
- public TextElement TextElement
- {
- get => _paragraph;
- }
+ public TextElement TextElement => _paragraph;
public MyQuote()
{
_paragraph = new Paragraph();
_flowDocument = new MyFlowDocument();
- var inlineUIContainer = new InlineUIContainer();
+ InlineUIContainer inlineUIContainer = new();
- var grid = new Grid();
+ Grid grid = new();
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) });
- var bar = new Grid
+ Grid bar = new()
{
Width = 4,
Background = new SolidColorBrush(Colors.Gray)
@@ -41,7 +39,7 @@ public MyQuote()
bar.Margin = new Thickness(0, 0, 4, 0);
grid.Children.Add(bar);
- var rightGrid = new Grid
+ Grid rightGrid = new()
{
Padding = new Thickness(4)
};
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTable.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTable.cs
similarity index 64%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTable.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTable.cs
index 4740ef55b8..10536e79d0 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTable.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTable.cs
@@ -8,6 +8,7 @@
using Microsoft.UI.Xaml.Documents;
using Microsoft.UI.Xaml.Media;
using System.Linq;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -16,15 +17,12 @@ internal class MyTable : IAddChild
private readonly Paragraph _paragraph;
private readonly MyTableUIElement _tableElement;
- public TextElement TextElement
- {
- get => _paragraph;
- }
+ public TextElement TextElement => _paragraph;
public MyTable(Table table)
{
_paragraph = new Paragraph();
- var column = table.FirstOrDefault() is not TableRow row ? 0 : row.Count;
+ int column = table.FirstOrDefault() is not TableRow row ? 0 : row.Count;
_tableElement = new MyTableUIElement
(
@@ -34,7 +32,7 @@ public MyTable(Table table)
new SolidColorBrush(Colors.Gray)
);
- var inlineUIContainer = new InlineUIContainer
+ InlineUIContainer inlineUIContainer = new()
{
Child = _tableElement
};
@@ -43,16 +41,14 @@ public MyTable(Table table)
public void AddChild(IAddChild child)
{
- if (child is MyTableCell cellChild)
- {
- var cell = cellChild.Container;
+ if (child is not MyTableCell cellChild) return;
+ Grid cell = cellChild.Container;
- Grid.SetColumn(cell, cellChild.ColumnIndex);
- Grid.SetRow(cell, cellChild.RowIndex);
- Grid.SetColumnSpan(cell, cellChild.ColumnSpan);
- Grid.SetRowSpan(cell, cellChild.RowSpan);
+ Grid.SetColumn(cell, cellChild.ColumnIndex);
+ Grid.SetRow(cell, cellChild.RowIndex);
+ Grid.SetColumnSpan(cell, cellChild.ColumnSpan);
+ Grid.SetRowSpan(cell, cellChild.RowSpan);
- _tableElement.Children.Add(cell);
- }
+ _tableElement.Children.Add(cell);
}
}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableCell.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableCell.cs
similarity index 88%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableCell.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableCell.cs
index 7de24bcbce..55e41ce2c6 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableCell.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableCell.cs
@@ -7,6 +7,7 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Documents;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -16,22 +17,13 @@ internal class MyTableCell : IAddChild
private readonly Paragraph _paragraph = new();
private readonly MyFlowDocument _flowDocument;
- public TextElement TextElement
- {
- get => _paragraph;
- }
+ public TextElement TextElement => _paragraph;
public Grid Container { get; }
- public int ColumnSpan
- {
- get => _tableCell.ColumnSpan;
- }
+ public int ColumnSpan => _tableCell.ColumnSpan;
- public int RowSpan
- {
- get => _tableCell.RowSpan;
- }
+ public int RowSpan => _tableCell.RowSpan;
public int ColumnIndex { get; }
@@ -44,7 +36,7 @@ public MyTableCell(TableCell tableCell, TextAlignment textAlignment, bool isHead
RowIndex = rowIndex;
Container = new Grid();
- _flowDocument = new MyFlowDocument
+ _flowDocument = new MyFlowDocument
{
RichTextBlock =
{
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableRow.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableRow.cs
similarity index 73%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableRow.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableRow.cs
index 0dbac0abcd..7a976643da 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableRow.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableRow.cs
@@ -7,14 +7,15 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Documents;
// ReSharper disable All
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.MarkdownTextBlock.TextElements;
internal class MyTableRow : IAddChild
{
- private TableRow _tableRow;
- private StackPanel _stackPanel;
- private Paragraph _paragraph;
+ private TableRow _tableRow;
+ private readonly StackPanel _stackPanel;
+ private readonly Paragraph _paragraph;
public TextElement TextElement
{
@@ -26,10 +27,14 @@ public MyTableRow(TableRow tableRow)
_tableRow = tableRow;
_paragraph = new Paragraph();
- _stackPanel = new StackPanel();
- _stackPanel.Orientation = Orientation.Horizontal;
- var inlineUIContainer = new InlineUIContainer();
- inlineUIContainer.Child = _stackPanel;
+ _stackPanel = new StackPanel
+ {
+ Orientation = Orientation.Horizontal
+ };
+ var inlineUIContainer = new InlineUIContainer
+ {
+ Child = _stackPanel
+ };
_paragraph.Inlines.Add(inlineUIContainer);
}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableUIElement.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableUIElement.cs
similarity index 99%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableUIElement.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableUIElement.cs
index 61d8d4f5b5..db4bf34035 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableUIElement.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTableUIElement.cs
@@ -11,6 +11,7 @@
using System.Collections.Generic;
using System.Linq;
using Windows.Foundation;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
// ReSharper disable All
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTaskListCheckBox.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTaskListCheckBox.cs
similarity index 87%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTaskListCheckBox.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTaskListCheckBox.cs
index c2812ac9a5..9b5b530f77 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTaskListCheckBox.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyTaskListCheckBox.cs
@@ -9,6 +9,7 @@
using Microsoft.UI.Xaml.Documents;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Media.Media3D;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -18,8 +19,8 @@ internal class MyTaskListCheckBox : IAddChild
public MyTaskListCheckBox(TaskList taskList)
{
- var grid = new Grid();
- CompositeTransform3D transform = new CompositeTransform3D
+ Grid grid = new();
+ CompositeTransform3D transform = new()
{
TranslateY = 2
};
@@ -29,7 +30,7 @@ public MyTaskListCheckBox(TaskList taskList)
grid.Margin = new Thickness(2, 0, 2, 0);
grid.BorderThickness = new Thickness(1);
grid.BorderBrush = new SolidColorBrush(Colors.Gray);
- FontIcon icon = new FontIcon
+ FontIcon icon = new()
{
FontSize = 16,
HorizontalAlignment = HorizontalAlignment.Center,
@@ -39,7 +40,7 @@ public MyTaskListCheckBox(TaskList taskList)
grid.Children.Add(taskList.Checked ? icon : new TextBlock());
grid.Padding = new Thickness(0);
grid.CornerRadius = new CornerRadius(2);
- var inlineUIContainer = new InlineUIContainer
+ InlineUIContainer inlineUIContainer = new()
{
Child = grid
};
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyThematicBreak.cs b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyThematicBreak.cs
similarity index 85%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyThematicBreak.cs
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyThematicBreak.cs
index 7cb6c9a149..9508a7b373 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyThematicBreak.cs
+++ b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/MarkdownTextBlock/TextElements/MyThematicBreak.cs
@@ -7,6 +7,7 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Documents;
using Microsoft.UI.Xaml.Media;
+#pragma warning disable IDE0130
namespace CommunityToolkit.Labs.WinUI.Labs.MarkdownTextBlock.TextElements;
@@ -14,17 +15,14 @@ internal class MyThematicBreak : IAddChild
{
private readonly Paragraph _paragraph;
- public TextElement TextElement
- {
- get => _paragraph;
- }
+ public TextElement TextElement => _paragraph;
public MyThematicBreak()
{
_paragraph = new Paragraph();
- var inlineUIContainer = new InlineUIContainer();
- var border = new Border
+ InlineUIContainer inlineUIContainer = new();
+ Border border = new()
{
Width = 500,
BorderThickness = new Thickness(1),
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/ReadMe.md b/CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/ReadMe.md
similarity index 100%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CommunityToolkit.Labs/ReadMe.md
rename to CollapseLauncher/XAMLs/Theme/CommunityToolkit.Labs/ReadMe.md
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/CompressedTextBlock.cs b/CollapseLauncher/XAMLs/Theme/CompressedTextBlock.cs
similarity index 99%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/CompressedTextBlock.cs
rename to CollapseLauncher/XAMLs/Theme/CompressedTextBlock.cs
index 246963073b..a6077c8174 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/CompressedTextBlock.cs
+++ b/CollapseLauncher/XAMLs/Theme/CompressedTextBlock.cs
@@ -5,9 +5,10 @@
using System.Collections.Generic;
using System.Numerics;
using Windows.Foundation;
+
// ReSharper disable PartialTypeWithSinglePart
-namespace CollapseLauncher.CustomControls
+namespace CollapseLauncher.XAMLs.Theme
{
public partial class CompressedTextBlock : Grid
{
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/ContentDialogCollapse.cs b/CollapseLauncher/XAMLs/Theme/ContentDialog/ContentDialogCollapse.cs
similarity index 91%
rename from CollapseLauncher/XAMLs/Theme/CustomControls/ContentDialogCollapse.cs
rename to CollapseLauncher/XAMLs/Theme/ContentDialog/ContentDialogCollapse.cs
index 87de1e1982..5026ad5043 100644
--- a/CollapseLauncher/XAMLs/Theme/CustomControls/ContentDialogCollapse.cs
+++ b/CollapseLauncher/XAMLs/Theme/ContentDialog/ContentDialogCollapse.cs
@@ -1,17 +1,15 @@
-// using Hi3Helper.Shared.ClassStruct;
-
-using CollapseLauncher.Extension;
+using CollapseLauncher.Extension;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
using Windows.Foundation;
using NColor = Windows.UI.Color;
// ReSharper disable PartialTypeWithSinglePart
-namespace CollapseLauncher.CustomControls
+namespace CollapseLauncher.XAMLs.Theme.ContentDialog
{
public enum ContentDialogTheme { Informational, Warning, Error, Success }
- public partial class ContentDialogCollapse : ContentDialog
+ public partial class ContentDialogCollapse : Microsoft.UI.Xaml.Controls.ContentDialog
{
private string ThemeTitleGlyph { get; }
private ContentDialogTheme Theme { get; }
@@ -44,6 +42,7 @@ public ContentDialogCollapse(ContentDialogTheme theme = ContentDialogTheme.Warni
=> ShowAsync(ContentDialogPlacement.Popup);
private new IAsyncOperation ShowAsync(
+ // ReSharper disable once UnusedParameter.Local
ContentDialogPlacement placement)
{
if (Title is not string titleString || Theme == ContentDialogTheme.Informational)
diff --git a/CollapseLauncher/XAMLs/Theme/ContentDialogCollapse.xaml b/CollapseLauncher/XAMLs/Theme/ContentDialog/ContentDialogCollapse.xaml
similarity index 98%
rename from CollapseLauncher/XAMLs/Theme/ContentDialogCollapse.xaml
rename to CollapseLauncher/XAMLs/Theme/ContentDialog/ContentDialogCollapse.xaml
index 689b3b5a61..ff29d2aa38 100644
--- a/CollapseLauncher/XAMLs/Theme/ContentDialogCollapse.xaml
+++ b/CollapseLauncher/XAMLs/Theme/ContentDialog/ContentDialogCollapse.xaml
@@ -1,9 +1,7 @@
-
+
-
-
+ xmlns:contentDialog="using:CollapseLauncher.XAMLs.Theme.ContentDialog">
+ TargetType="contentDialog:ContentDialogCollapse" />
+
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/LayeredBackgroundImageExtensions.cs b/CollapseLauncher/XAMLs/Theme/CustomControls/LayeredBackgroundImageExtensions.cs
new file mode 100644
index 0000000000..255ae24d2c
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/CustomControls/LayeredBackgroundImageExtensions.cs
@@ -0,0 +1,442 @@
+using Hi3Helper.Win32.WinRT.WindowsStream;
+using Microsoft.UI;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Media.Imaging;
+using PhotoSauce.MagicScaler;
+using PhotoSauce.MagicScaler.Transforms;
+using System;
+using System.IO;
+using System.Net.Http;
+using System.Threading;
+using System.Threading.Tasks;
+using Windows.Storage.Streams;
+// ReSharper disable GrammarMistakeInComment
+
+// ReSharper disable SwitchStatementHandlesSomeKnownEnumValuesWithDefault
+// ReSharper disable ConvertIfStatementToSwitchStatement
+
+#nullable enable
+namespace CollapseLauncher.XAMLs.Theme.CustomControls;
+
+internal static class LayeredBackgroundImageExtensions
+{
+ private static readonly HttpClient Client;
+
+ static LayeredBackgroundImageExtensions()
+ {
+ Client = CreateHttpClient();
+ }
+
+ private static HttpClient CreateHttpClient()
+ {
+ SocketsHttpHandler handler = new()
+ {
+ AllowAutoRedirect = true,
+ MaxConnectionsPerServer = Environment.ProcessorCount * 2
+ };
+ return new HttpClient(handler, false);
+ }
+
+ internal static async ValueTask LoadImageAsync(
+ this Image image,
+ Uri? sourceFromPath,
+ Stream? sourceFromStream,
+ LayeredBackgroundImage instance,
+ DependencyProperty useCacheProperty,
+ IPixelTransform? pixelTransform = null)
+ {
+ IMediaCacheHandler? cacheHandler = instance.MediaCacheHandler;
+ bool isDisposeStream = sourceFromStream == null;
+ bool forceUseInternalDecoder = false;
+
+ // Try get cached source from cache handler
+ if (cacheHandler != null)
+ {
+ object? source = sourceFromPath;
+ source ??= sourceFromStream;
+ MediaCacheResult cacheResult = await cacheHandler.LoadCachedSource(source);
+
+ forceUseInternalDecoder = cacheResult.ForceUseInternalDecoder;
+ isDisposeStream = cacheResult.DisposeStream;
+
+ if (cacheResult.CachedSource is Uri sourceAsPath)
+ {
+ sourceFromPath = sourceAsPath;
+ sourceFromStream = null;
+ }
+ else if (cacheResult.CachedSource is Stream sourceAsStream)
+ {
+ sourceFromPath = null;
+ sourceFromStream = sourceAsStream;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ try
+ {
+ if (sourceFromPath != null)
+ {
+ return await image.LoadImageFromUriPathSourceAsync(sourceFromPath,
+ forceUseInternalDecoder,
+ instance,
+ useCacheProperty,
+ pixelTransform);
+ }
+
+ if (sourceFromStream != null)
+ {
+ return await image.LoadImageFromStreamSourceAsync(sourceFromStream,
+ forceUseInternalDecoder,
+ instance,
+ useCacheProperty,
+ pixelTransform);
+ }
+
+ return false;
+ }
+ finally
+ {
+ if (isDisposeStream && sourceFromStream != null)
+ {
+ await sourceFromStream.DisposeAsync();
+ }
+ }
+ }
+
+ private static async ValueTask LoadImageFromUriPathSourceAsync(
+ this Image image,
+ Uri sourceFromPath,
+ bool forceUseInternalDecoder,
+ LayeredBackgroundImage instance,
+ DependencyProperty useCacheProperty,
+ IPixelTransform? pixelTransform = null)
+ {
+ string extension = Path.GetExtension(sourceFromPath.ToString());
+ bool isInternalFormat = LayeredBackgroundImage
+ .SupportedImageBitmapExtensionsLookup
+ .Contains(extension);
+ bool isSvgFormat = LayeredBackgroundImage
+ .SupportedImageVectorExtensionsLookup
+ .Contains(extension);
+
+ if ((forceUseInternalDecoder ||
+ isInternalFormat ||
+ isSvgFormat) && pixelTransform == null)
+ {
+ if (isSvgFormat)
+ {
+ image.Source = new SvgImageSource(sourceFromPath);
+ return true;
+ }
+
+ image.Source = new BitmapImage(sourceFromPath)
+ {
+ CreateOptions = (bool)instance.GetValue(useCacheProperty)
+ ? BitmapCreateOptions.None
+ : BitmapCreateOptions.IgnoreImageCache
+ };
+ return true;
+ }
+
+ await using FileStream? fileStream = await TryGetStreamFromPathAsync(sourceFromPath, instance.MediaSourceCacheDir);
+ if (fileStream == null)
+ {
+ return false;
+ }
+
+ // Borrow loading process from stream source loader.
+ // We gonna ignore internal decoder enforcement here because, uh... idk.
+ return await image
+ .LoadImageFromStreamSourceAsync(fileStream,
+ false,
+ instance,
+ useCacheProperty,
+ pixelTransform);
+ }
+
+ private static async ValueTask LoadImageFromStreamSourceAsync(
+ this Image image,
+ Stream sourceFromStream,
+ bool forceUseInternalDecoder,
+ LayeredBackgroundImage instance,
+ DependencyProperty useCacheProperty,
+ IPixelTransform? pixelTransform = null)
+ {
+ (Stream? stream, bool isTemporaryStream) =
+ await sourceFromStream.GetNativeOrCopiedStreamIfNotSeekable(CancellationToken.None);
+
+ if (stream == null)
+ {
+ return false;
+ }
+
+ try
+ {
+ // Reset position
+ stream.Position = 0;
+
+ // Guess codec type
+ ImageExternalCodecType codecType = await stream.GuessImageFormatFromStreamAsync();
+ if (codecType == ImageExternalCodecType.NotSupported)
+ {
+ return false;
+ }
+
+ // Reset position after format guessing
+ stream.Position = 0;
+
+ if ((forceUseInternalDecoder ||
+ codecType == ImageExternalCodecType.Default) &&
+ pixelTransform != null)
+ {
+ using IRandomAccessStream sourceRandomStream = stream.AsRandomAccessStream(true);
+ BitmapImage bitmapImage = new()
+ {
+ CreateOptions = (bool)instance.GetValue(useCacheProperty)
+ ? BitmapCreateOptions.None
+ : BitmapCreateOptions.IgnoreImageCache
+ };
+ await bitmapImage.SetSourceAsync(sourceRandomStream);
+ image.Source = bitmapImage;
+ return true;
+ }
+
+ if (codecType == ImageExternalCodecType.Svg)
+ {
+ using IRandomAccessStream sourceRandomStream = stream.AsRandomAccessStream(true);
+ SvgImageSource svgImageSource = new();
+ await svgImageSource.SetSourceAsync(sourceRandomStream);
+ image.Source = svgImageSource;
+ return true;
+ }
+
+ FileStream? tempStream = null;
+
+ try
+ {
+ string? userDefinedCacheDir = instance.MediaSourceCacheDir;
+ bool requireConversion = true;
+
+ if (!string.IsNullOrEmpty(userDefinedCacheDir) && stream is FileStream sourceAsFileStream)
+ {
+ Directory.CreateDirectory(userDefinedCacheDir);
+
+ string cachedFilename = $"decoded_{Path.GetFileNameWithoutExtension(sourceAsFileStream.Name)}.png";
+ string decodedFilepath = Path.Combine(userDefinedCacheDir, cachedFilename);
+ FileInfo decodedFileInfo = new(decodedFilepath);
+
+ if (decodedFileInfo is { Exists: true, Length: > 256 })
+ {
+ requireConversion = false;
+ }
+
+ tempStream = decodedFileInfo.Open(FileMode.OpenOrCreate,
+ FileAccess.ReadWrite,
+ FileShare.ReadWrite);
+ }
+
+ tempStream ??= CreateTemporaryStream();
+
+ if (requireConversion)
+ {
+ // Use MagicScaler for external codec types
+ await Task.Run(() =>
+ {
+ ProcessImageSettings settings = new();
+ settings.TrySetEncoderFormat(ImageMimeTypes.Png);
+
+ using ProcessingPipeline pipeline = MagicImageProcessor.BuildPipeline(stream, settings);
+ if (pixelTransform != null)
+ {
+ pipeline.AddTransform(pixelTransform);
+ }
+
+ pipeline.WriteOutput(tempStream);
+ });
+ }
+
+ tempStream.Position = 0;
+ using IRandomAccessStream tempRandomStream = tempStream.AsRandomAccessStream(true);
+ BitmapImage tempBitmapImage = new()
+ {
+ CreateOptions = (bool)instance.GetValue(useCacheProperty)
+ ? BitmapCreateOptions.None
+ : BitmapCreateOptions.IgnoreImageCache
+ };
+ await tempBitmapImage.SetSourceAsync(tempRandomStream);
+ image.Source = tempBitmapImage;
+ return true;
+ }
+ finally
+ {
+ if (tempStream != null)
+ {
+ await tempStream.DisposeAsync();
+ }
+ }
+ }
+ finally
+ {
+ if (isTemporaryStream)
+ {
+ await stream.DisposeAsync();
+ }
+ }
+ }
+
+ private static async Task TryGetStreamFromPathAsync(Uri? url, string? userDefinedTempDir)
+ {
+ if (url == null)
+ {
+ return null;
+ }
+
+ if (url.IsFile)
+ {
+ return File.Open(url.LocalPath, FileMode.Open, FileAccess.Read, FileShare.Read);
+ }
+
+ if (await GetFileLengthFromUrl(Client, url) is var fileLength &&
+ fileLength == 0)
+ {
+ return null;
+ }
+
+ HttpRequestMessage requestMessage = new(HttpMethod.Get, url);
+ HttpResponseMessage responseMessage =
+ await Client.SendAsync(requestMessage,
+ HttpCompletionOption.ResponseHeadersRead);
+
+ if (!responseMessage.IsSuccessStatusCode)
+ {
+ responseMessage.Dispose();
+ requestMessage.Dispose();
+ return null;
+ }
+
+ FileStream tempStream = url.CreateTemporaryStreamFromUrl(userDefinedTempDir);
+ if (tempStream.Length == fileLength)
+ {
+ return tempStream;
+ }
+
+ try
+ {
+ tempStream.SetLength(0); // Reset length.
+
+ await using Stream networkStream = await responseMessage.Content.ReadAsStreamAsync();
+ await networkStream.CopyToAsync(tempStream);
+ return tempStream;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ await tempStream.DisposeAsync();
+ }
+
+ return null;
+ }
+
+ private static async Task GetFileLengthFromUrl(HttpClient client, Uri url)
+ {
+ HttpRequestMessage requestMessage = new(HttpMethod.Head, url);
+ HttpResponseMessage responseMessage =
+ await client.SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead);
+
+ if (responseMessage.IsSuccessStatusCode)
+ {
+ return responseMessage.Content.Headers.ContentLength ?? 0;
+ }
+
+ responseMessage.Dispose();
+ requestMessage.Dispose();
+ return 0;
+ }
+
+ internal static double GetClampedVolume(this double thisVolume)
+ {
+ if (double.IsNaN(thisVolume) ||
+ double.IsInfinity(thisVolume))
+ {
+ thisVolume = 0;
+ }
+
+ return Math.Clamp(thisVolume, 0, 100d) / 100d;
+ }
+
+ private static async ValueTask<(Stream? Stream, bool IsTemporaryStream)>
+ GetNativeOrCopiedStreamIfNotSeekable(
+ this T stream,
+ CancellationToken token)
+ where T : Stream
+ {
+ // If it's seekable, then just return it
+ if (stream.CanSeek)
+ {
+ return (stream, false);
+ }
+
+ // Copy over
+ FileStream tempStream = CreateTemporaryStream();
+ try
+ {
+ await stream.CopyToAsync(tempStream, token);
+ return (tempStream, true);
+ }
+ catch
+ {
+ await tempStream.DisposeAsync();
+ return (null, false);
+ }
+ }
+
+ private static FileStream CreateTemporaryStreamFromUrl(this Uri url, string? userDefinedTempDir)
+ {
+ string path;
+ if (string.IsNullOrEmpty(userDefinedTempDir))
+ {
+ string extension = Path.GetExtension(url.AbsolutePath);
+ path = Path.Combine(Path.GetTempPath(), Path.GetTempFileName() + extension);
+ }
+ else
+ {
+ Directory.CreateDirectory(userDefinedTempDir);
+ path = Path.Combine(userDefinedTempDir, Path.GetFileName(url.AbsolutePath));
+ }
+
+ return File.Open(path,
+ new FileStreamOptions
+ {
+ Mode = FileMode.Create,
+ Access = FileAccess.ReadWrite,
+ Share = FileShare.ReadWrite,
+ Options = string.IsNullOrEmpty(userDefinedTempDir) ?
+ FileOptions.None :
+ FileOptions.DeleteOnClose
+ });
+ }
+
+ private static FileStream CreateTemporaryStream()
+ {
+ string path = Path.Combine(Path.GetTempPath(), Path.GetTempFileName());
+ return File.Open(path,
+ new FileStreamOptions
+ {
+ Mode = FileMode.Create,
+ Access = FileAccess.ReadWrite,
+ Share = FileShare.ReadWrite,
+ Options = FileOptions.DeleteOnClose
+ });
+ }
+
+ internal static WindowId GetElementWindowId(this LayeredBackgroundImage element)
+ {
+ XamlRoot root = element.XamlRoot;
+ WindowId windowId = root.ContentIslandEnvironment.AppWindowId;
+ return windowId;
+ }
+}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/LayeredBackgroundImage_themeresources.xaml b/CollapseLauncher/XAMLs/Theme/CustomControls/LayeredBackgroundImage_themeresources.xaml
new file mode 100644
index 0000000000..9a74e74828
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/CustomControls/LayeredBackgroundImage_themeresources.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Converters.cs b/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Converters.cs
new file mode 100644
index 0000000000..99b318e126
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Converters.cs
@@ -0,0 +1,23 @@
+#nullable enable
+using Microsoft.UI.Xaml.Data;
+using System;
+
+namespace CollapseLauncher.XAMLs.Theme.CustomControls;
+
+internal partial class IndexAddOneConverter : IValueConverter
+{
+ public object Convert(object value, Type targetType, object parameter, string language)
+ {
+ if (value is int asInt)
+ {
+ return asInt + 1;
+ }
+
+ return value;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Enums.cs b/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Enums.cs
new file mode 100644
index 0000000000..dda2d379c7
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Enums.cs
@@ -0,0 +1,14 @@
+namespace CollapseLauncher.XAMLs.Theme.CustomControls;
+
+public enum NewPipsPagerNavigationMode
+{
+ Auto,
+ Hidden,
+ Visible
+}
+
+public enum NewPipsPagerSelectionMode
+{
+ Click,
+ Hover
+}
\ No newline at end of file
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Events.cs b/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Events.cs
new file mode 100644
index 0000000000..fcdcb79cc0
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Events.cs
@@ -0,0 +1,390 @@
+#nullable enable
+using Microsoft.UI.Input;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Input;
+using System;
+using System.Linq;
+using System.Numerics;
+using Windows.Foundation;
+using Windows.System;
+
+namespace CollapseLauncher.XAMLs.Theme.CustomControls;
+
+public partial class NewPipsPager
+{
+ #region Size Measure Override
+
+ protected override Size MeasureOverride(Size parentSize)
+ {
+ Orientation orientation = Orientation;
+ Vector2 pipsButtonSize = PipButtonSize;
+
+ Vector2 repeaterSize = _pipsPagerItemsRepeater.ActualSize;
+ double repeaterWidth = repeaterSize.X;
+ double repeaterHeight = repeaterSize.Y;
+
+ GetNavigationButtonTotalSize(PreviousNavigationButtonMode, _previousPageButton, out double navPrevBtnWidth, out double navPrevBtnHeight);
+ GetNavigationButtonTotalSize(NextNavigationButtonMode, _nextPageButton, out double navNextBtnWidth, out double navNextBtnHeight);
+
+ Size availableSpace = base.MeasureOverride(parentSize);
+
+ double calculatedWidth = availableSpace.Width;
+ double calculatedHeight = availableSpace.Height;
+
+ if (orientation == Orientation.Horizontal)
+ {
+ calculatedWidth = CalculateElementSize(parentSize.Width,
+ repeaterWidth,
+ navPrevBtnWidth,
+ navNextBtnWidth,
+ pipsButtonSize.X,
+ out double repeaterFinalWidth);
+
+ calculatedHeight = GetMaxElementOtherSize(navPrevBtnHeight, navNextBtnHeight, calculatedHeight, repeaterHeight);
+ _pipsPagerScrollViewer.MaxWidth = repeaterFinalWidth;
+ }
+ else
+ {
+ calculatedHeight = CalculateElementSize(parentSize.Height,
+ repeaterHeight,
+ navPrevBtnHeight,
+ navNextBtnHeight,
+ pipsButtonSize.Y,
+ out double repeaterFinalHeight);
+
+ calculatedWidth = GetMaxElementOtherSize(navPrevBtnWidth, navNextBtnWidth, calculatedWidth, repeaterWidth);
+ _pipsPagerScrollViewer.MaxHeight = repeaterFinalHeight;
+ }
+
+ return new Size(calculatedWidth, calculatedHeight);
+ }
+
+ private static double CalculateElementSize(
+ double parentSize,
+ double repeaterSize,
+ double navPrevBtnSize,
+ double navNextBtnSize,
+ double pipBtnSize,
+ out double repeaterFinalSize)
+ {
+ double remainedSize = parentSize - navPrevBtnSize - navNextBtnSize;
+ repeaterFinalSize = remainedSize >= repeaterSize
+ ? repeaterSize
+ : GetClampedRepeaterSize(remainedSize, pipBtnSize);
+
+ return navPrevBtnSize + navNextBtnSize + repeaterFinalSize;
+ }
+
+ private static double GetMaxElementOtherSize(
+ double navPrevBtnSize,
+ double navNextBtnSize,
+ double calculatedSize,
+ double repeaterSize)
+ {
+ double elementMaxSize = Math.Max(navPrevBtnSize,
+ Math.Max(navNextBtnSize, repeaterSize));
+
+ if (calculatedSize > elementMaxSize)
+ {
+ calculatedSize = elementMaxSize;
+ }
+
+ return calculatedSize;
+ }
+
+ private static void GetNavigationButtonTotalSize(
+ NewPipsPagerNavigationMode mode,
+ Button element,
+ out double width,
+ out double height)
+ {
+ bool isVisible = mode != NewPipsPagerNavigationMode.Hidden;
+ Vector2 size = isVisible ? element.ActualSize : Vector2.Zero;
+ Thickness margin = isVisible ? element.Margin : default;
+ width = size.X + margin.Left + margin.Right;
+ height = size.Y + margin.Top + margin.Bottom;
+ }
+
+ private static double GetClampedRepeaterSize(
+ double remainedAvailSpace,
+ double buttonSize)
+ {
+ if (remainedAvailSpace < buttonSize ||
+ !double.IsFinite(remainedAvailSpace) ||
+ buttonSize <= 0)
+ {
+ return 0;
+ }
+
+ double itemCountDisplay = Math.Round(remainedAvailSpace / buttonSize);
+ double itemCountDisplayClamp = itemCountDisplay % 2 == 0 ? itemCountDisplay - 1 : itemCountDisplay;
+
+ return itemCountDisplayClamp * buttonSize;
+ }
+
+ #endregion
+
+ #region UI Events - Navigation Buttons
+
+ private void PreviousPageButton_OnClick(object sender, RoutedEventArgs e) => ItemIndex--;
+
+ private void NextPageButton_OnClick(object sender, RoutedEventArgs e) => ItemIndex++;
+
+ private void KeyboardKeys_Pressed(object sender, KeyRoutedEventArgs e)
+ {
+ switch (e.Key)
+ {
+ case VirtualKey.Left:
+ case VirtualKey.Up:
+ PreviousPageButton_OnClick(sender, e);
+ break;
+ case VirtualKey.Right:
+ case VirtualKey.Down:
+ NextPageButton_OnClick(sender, e);
+ break;
+ }
+ }
+
+ #endregion
+
+ #region UI Events - Orientation
+
+ private static void Orientation_OnChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ NewPipsPager pager = (NewPipsPager)d;
+ Orientation orientation = (Orientation)e.NewValue;
+
+ Orientation_OnChange(pager, orientation);
+ }
+
+ private static void Orientation_OnChange(NewPipsPager pager, Orientation orientation)
+ {
+ string state = orientation == Orientation.Vertical
+ ? "VerticalOrientationView"
+ : "HorizontalOrientationView";
+ VisualStateManager.GoToState(pager, state, true);
+ }
+
+ #endregion
+
+ #region Property Changes
+
+ private static void ItemsCount_OnChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is not NewPipsPager pager)
+ {
+ return;
+ }
+
+ object obj = e.NewValue;
+ int value = 0;
+ if (obj is int asInt)
+ {
+ value = asInt;
+ }
+
+ pager.ItemsCount_OnChange(value);
+ }
+
+ private void ItemsCount_OnChange(int value)
+ {
+ if (!_isTemplateLoaded)
+ {
+ return;
+ }
+
+ if (value < 0)
+ {
+ throw new IndexOutOfRangeException("ItemsCount cannot be negative!");
+ }
+
+ int oldItemsCount = _itemsDummy.Length;
+
+ using (_atomicLock.EnterScope())
+ {
+ try
+ {
+
+ if (value == 0)
+ {
+ _itemsDummy = [];
+ return;
+ }
+
+ _itemsDummy = Enumerable.Range(0, value).ToArray();
+ }
+ finally
+ {
+ // Update ItemsSource if already assigned
+ _pipsPagerItemsRepeater.ItemsSource = _itemsDummy;
+ _pipsPagerItemsRepeater.UpdateLayout();
+
+ // Update index only if the count is invalid
+ int currentIndex = ItemIndex;
+ if (currentIndex > value ||
+ (value != 0 && currentIndex < 0))
+ {
+ ItemIndex = 0;
+ }
+
+ ItemsCountChanged?.Invoke(this, new ChangedStructItemArgs(oldItemsCount, value));
+ }
+ }
+ }
+
+ private static void ItemIndex_OnChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ // Ignore if the old and new index are equal
+ if (e is not { NewValue: int asNewIndex, OldValue: int asOldIndex } ||
+ asNewIndex == asOldIndex)
+ {
+ return;
+ }
+
+ NewPipsPager pager = (NewPipsPager)d;
+ if (!pager.IsLoaded)
+ {
+ return;
+ }
+
+ // Update navigation buttons state
+ UpdatePreviousButtonVisualState(pager);
+ UpdateNextButtonVisualState(pager);
+
+ // Update pip buttons state
+ UpdateAndBringSelectedPipToView(pager, asNewIndex, asOldIndex);
+
+ // Update pager layout
+ pager.UpdateLayout();
+ }
+
+ #endregion
+
+ #region ItemsRepeater
+
+ private void ItemsRepeater_ElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args)
+ {
+ if (args.Element is not Button asButton)
+ {
+ return;
+ }
+
+ AssignPipButtonStyle(asButton, args.Index != ItemIndex
+ ? NormalPipButtonStyle
+ : SelectedPipButtonStyle);
+
+ if (asButton.Tag is true)
+ {
+ return;
+ }
+
+ // Store Tag as true so the event won't be subscribed more than once.
+ asButton.Tag = true;
+ asButton.Loaded += ItemsRepeaterPipButton_LoadedEvent;
+ asButton.Unloaded += ItemsRepeaterPipButton_UnloadedEvent;
+ }
+
+ private void ItemsRepeater_OnSizeChanged(object sender, SizeChangedEventArgs e) => InvalidateMeasure();
+
+ private void ItemsRepeaterPipButton_UnloadedEvent(object sender, RoutedEventArgs e)
+ {
+ Button button = (Button)sender;
+ if (SelectionMode == NewPipsPagerSelectionMode.Click)
+ {
+ button.Click -= ItemsRepeaterPipButton_OnClick;
+ }
+ else
+ {
+ button.PointerEntered -= ItemsRepeaterPipButton_OnClick;
+ }
+ }
+
+ private void ItemsRepeaterPipButton_LoadedEvent(object sender, RoutedEventArgs e)
+ {
+ Button button = (Button)sender;
+ if (SelectionMode == NewPipsPagerSelectionMode.Click)
+ {
+ button.Click += ItemsRepeaterPipButton_OnClick;
+ }
+ else
+ {
+ button.PointerEntered += ItemsRepeaterPipButton_OnClick;
+ }
+ }
+
+ private void ItemsRepeaterPipButton_OnClick(object sender, RoutedEventArgs args)
+ {
+ if (sender is not Button asButton)
+ {
+ return;
+ }
+
+ int index = _pipsPagerItemsRepeater.GetElementIndex(asButton);
+ if (index < 0 ||
+ ItemsCount <= index)
+ {
+ return;
+ }
+
+ ItemIndex = index;
+ }
+
+ #endregion
+
+ #region ScrollViewer
+
+ private void ScrollViewer_OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)
+ {
+ if (!e.Pointer.IsInRange ||
+ sender is not UIElement element)
+ {
+ return;
+ }
+
+ Orientation layoutOrientation = Orientation;
+ double pipsButtonSize = layoutOrientation == Orientation.Horizontal ? PipButtonSize.X : PipButtonSize.Y;
+
+ PointerPoint pointer = e.GetCurrentPoint(element);
+ int orientation = pointer.Properties.MouseWheelDelta;
+ bool isHorizontal = layoutOrientation == Orientation.Horizontal;
+ double delta = pipsButtonSize * (orientation / 120d);
+
+ double toOffset = (isHorizontal
+ ? _pipsPagerScrollViewer.HorizontalOffset
+ : _pipsPagerScrollViewer.VerticalOffset) + -delta;
+ toOffset = Math.Round(toOffset / pipsButtonSize) * pipsButtonSize;
+
+ if (isHorizontal)
+ {
+ toOffset = Math.Clamp(toOffset, 0, _pipsPagerScrollViewer.ExtentWidth);
+ _pipsPagerScrollViewer.ChangeView(toOffset, _pipsPagerScrollViewer.VerticalOffset, _pipsPagerScrollViewer.ZoomFactor);
+ }
+ else
+ {
+ toOffset = Math.Clamp(toOffset, 0, _pipsPagerScrollViewer.ExtentHeight);
+ _pipsPagerScrollViewer.ChangeView(_pipsPagerScrollViewer.HorizontalOffset, toOffset, _pipsPagerScrollViewer.ZoomFactor);
+ }
+ }
+
+ #endregion
+
+ #region Loaded and Unloaded
+
+ private void NewPipsPager_Unloaded(object sender, RoutedEventArgs e)
+ {
+ _pipsPagerItemsRepeater.ItemsSource = null;
+ }
+
+ private void NewPipsPager_Loaded(object sender, RoutedEventArgs e)
+ {
+ ItemsCount_OnChange(ItemsCount);
+ UpdateAndBringSelectedPipToView(this, ItemIndex, -1);
+
+ // Update navigation buttons state
+ UpdatePreviousButtonVisualState(this);
+ UpdateNextButtonVisualState(this);
+ }
+
+ #endregion
+}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Properties.cs b/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Properties.cs
new file mode 100644
index 0000000000..67a208a7a1
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Properties.cs
@@ -0,0 +1,310 @@
+#nullable enable
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using System.Numerics;
+using System.Threading;
+using Windows.Foundation;
+
+namespace CollapseLauncher.XAMLs.Theme.CustomControls;
+
+public partial class NewPipsPager
+{
+ #region Events
+
+ public event TypedEventHandler>? ItemsCountChanged;
+ public event TypedEventHandler>? ItemIndexChanged;
+
+ #endregion
+
+ #region Properties
+
+ public Orientation Orientation
+ {
+ get => (Orientation)GetValue(OrientationProperty);
+ set => SetValue(OrientationProperty, value);
+ }
+
+ public int ItemsCount
+ {
+ get => (int)GetValue(ItemsCountProperty);
+ set => SetValue(ItemsCountProperty, value);
+ }
+
+ public int ItemIndex
+ {
+ get => (int)GetValue(ItemIndexProperty);
+ set
+ {
+ using (_atomicLock.EnterScope())
+ {
+ int itemsCount = ItemsCount;
+ if (itemsCount == 0)
+ {
+ return;
+ }
+
+ if (value < 0)
+ {
+ value = itemsCount - 1;
+ }
+
+ if (value >= itemsCount)
+ {
+ value = 0;
+ }
+
+ SetValue(ItemIndexProperty, value);
+ }
+ }
+ }
+
+ public NewPipsPagerSelectionMode SelectionMode
+ {
+ get => (NewPipsPagerSelectionMode)GetValue(SelectionModeProperty);
+ set => SetValue(SelectionModeProperty, value);
+ }
+
+ public NewPipsPagerNavigationMode PreviousNavigationButtonMode
+ {
+ get => (NewPipsPagerNavigationMode)GetValue(PreviousNavigationButtonModeProperty);
+ set => SetValue(PreviousNavigationButtonModeProperty, value);
+ }
+
+ public NewPipsPagerNavigationMode NextNavigationButtonMode
+ {
+ get => (NewPipsPagerNavigationMode)GetValue(NextNavigationButtonModeProperty);
+ set => SetValue(NextNavigationButtonModeProperty, value);
+ }
+
+ public Style PreviousButtonStyle
+ {
+ get => (Style)GetValue(PreviousButtonStyleProperty);
+ set => SetValue(PreviousButtonStyleProperty, value);
+ }
+
+ public Style NextButtonStyle
+ {
+ get => (Style)GetValue(NextButtonStyleProperty);
+ set => SetValue(NextButtonStyleProperty, value);
+ }
+
+ public Style NormalPipButtonStyle
+ {
+ get => (Style)GetValue(NormalPipButtonStyleProperty);
+ set => SetValue(NormalPipButtonStyleProperty, value);
+ }
+
+ public Style SelectedPipButtonStyle
+ {
+ get => (Style)GetValue(SelectedPipButtonStyleProperty);
+ set => SetValue(SelectedPipButtonStyleProperty, value);
+ }
+
+ public Vector2 PipButtonSize => _pipsPagerItemsRepeater.TryGetElement(ItemIndex) is not { } button ? default : button.ActualSize;
+
+#endregion
+
+ #region Fields
+
+ private readonly Lock _atomicLock = new();
+
+ private int[] _itemsDummy = [];
+
+ #endregion
+
+ #region Dependency Change Methods
+
+ private static void UpdatePreviousButtonVisualState(NewPipsPager pager)
+ {
+ UpdateButtonVisualState(pager,
+ pager._previousPageButton,
+ pager.ItemIndex > 0,
+ NavButtonStatePreviousPageButtonCollapsed,
+ NavButtonStatePreviousPageButtonVisible,
+ NavButtonStatePreviousPageButtonHidden,
+ pager.PreviousNavigationButtonMode);
+ }
+
+ private static void UpdateNextButtonVisualState(NewPipsPager pager)
+ {
+ UpdateButtonVisualState(pager,
+ pager._nextPageButton,
+ pager.ItemIndex + 1 < pager.ItemsCount,
+ NavButtonStateNextPageButtonCollapsed,
+ NavButtonStateNextPageButtonVisible,
+ NavButtonStateNextPageButtonHidden,
+ pager.NextNavigationButtonMode);
+ }
+
+ private static void UpdateButtonVisualState(
+ NewPipsPager instance,
+ Button? button,
+ bool conditionForAutoVisible,
+ string stateNameForCollapsed,
+ string stateNameForVisible,
+ string stateNameForHidden,
+ NewPipsPagerNavigationMode mode)
+ {
+ if (button == null)
+ {
+ return;
+ }
+
+ if (mode == NewPipsPagerNavigationMode.Hidden)
+ {
+ VisualStateManager.GoToState(instance, stateNameForCollapsed, true);
+ return;
+ }
+
+ VisualStateManager.GoToState(instance, stateNameForVisible, true);
+ button.IsEnabled = true;
+ if (mode == NewPipsPagerNavigationMode.Visible)
+ {
+ return;
+ }
+
+ if (conditionForAutoVisible)
+ {
+ return;
+ }
+
+ button.IsEnabled = false;
+ VisualStateManager.GoToState(instance, stateNameForHidden, true);
+ }
+
+ private static void UpdateAndBringSelectedPipToView(NewPipsPager pager, int newIndex, int oldIndex)
+ {
+ if (pager.UpdateSelectedPipStyle(newIndex, oldIndex) is not { } asButton)
+ {
+ return;
+ }
+
+ BringElementIntoCenterView(asButton, pager.Orientation);
+ }
+
+ private static void BringElementIntoCenterView(UIElement element, Orientation orientation)
+ {
+ BringIntoViewOptions options = new()
+ {
+ AnimationDesired = true
+ };
+ if (orientation == Orientation.Horizontal)
+ {
+ options.HorizontalAlignmentRatio = 0.5d;
+ }
+ else
+ {
+ options.VerticalAlignmentRatio = 0.5d;
+ }
+ element.StartBringIntoView(options);
+ }
+
+ public void BringCurrentPipButtonIntoView()
+ {
+ if (_pipsPagerItemsRepeater.TryGetElement(ItemIndex) is not { } element)
+ {
+ return;
+ }
+
+ BringElementIntoCenterView(element, Orientation);
+ }
+
+ private Button? UpdateSelectedPipStyle(int newIndex, int oldIndex)
+ {
+ ItemsRepeater repeater = _pipsPagerItemsRepeater;
+ if (repeater == null!)
+ {
+ return null;
+ }
+
+ try
+ {
+ if (!_isTemplateLoaded ||
+ repeater.ItemsSourceView == null)
+ {
+ return null;
+ }
+
+ int childCount = repeater.ItemsSourceView.Count;
+ bool isUpdateNewChild = newIndex >= 0 && newIndex < childCount;
+ bool isUpdateOldChild = oldIndex >= 0 && oldIndex < childCount;
+
+ if (ItemsCount == 0)
+ {
+ return null;
+ }
+
+ Button? newIndexPipButton = repeater.GetOrCreateElement(newIndex) as Button;
+ Button? oldIndexPipButton = repeater.TryGetElement(oldIndex) as Button;
+
+ try
+ {
+ if (isUpdateOldChild)
+ {
+ AssignPipButtonStyle(oldIndexPipButton, NormalPipButtonStyle);
+ }
+
+ if (isUpdateNewChild)
+ {
+ return AssignPipButtonStyle(newIndexPipButton, SelectedPipButtonStyle);
+ }
+
+ return newIndexPipButton;
+ }
+ finally
+ {
+ if (newIndex != oldIndex)
+ {
+ ItemIndexChanged?.Invoke(this, new ChangedStructItemArgs(oldIndex, newIndex));
+ }
+ }
+ }
+ catch
+ {
+ // ignored
+ }
+
+ return null;
+ }
+
+ private static Button? AssignPipButtonStyle(Button? button, Style? style)
+ {
+ if (button is null)
+ {
+ return button;
+ }
+
+ button.Style = style;
+ button.UpdateLayout();
+ VisualStateManager.GoToState(button, PipButtonStateNormal, true);
+ return button;
+ }
+
+ private static void PreviousNavigationButtonMode_OnChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ UpdatePreviousButtonVisualState((NewPipsPager)d);
+ }
+
+ private static void NextNavigationButtonMode_OnChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ UpdateNextButtonVisualState((NewPipsPager)d);
+ }
+
+ #endregion
+
+ #region Dependency Properties
+
+ public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(nameof(Orientation), typeof(Orientation), typeof(NewPipsPager), new PropertyMetadata(Orientation.Vertical, Orientation_OnChange));
+ public static readonly DependencyProperty ItemsCountProperty = DependencyProperty.Register(nameof(ItemsCount), typeof(int), typeof(NewPipsPager), new PropertyMetadata(0, ItemsCount_OnChange));
+ public static readonly DependencyProperty ItemIndexProperty = DependencyProperty.Register(nameof(ItemIndex), typeof(int), typeof(NewPipsPager), new PropertyMetadata(-1, ItemIndex_OnChange));
+ public static readonly DependencyProperty SelectionModeProperty = DependencyProperty.Register(nameof(SelectionMode), typeof(bool), typeof(NewPipsPager), new PropertyMetadata(NewPipsPagerSelectionMode.Click));
+ public static readonly DependencyProperty PreviousNavigationButtonModeProperty = DependencyProperty.Register(nameof(PreviousNavigationButtonMode), typeof(NewPipsPagerNavigationMode), typeof(NewPipsPager), new PropertyMetadata(NewPipsPagerNavigationMode.Auto, PreviousNavigationButtonMode_OnChange));
+ public static readonly DependencyProperty NextNavigationButtonModeProperty = DependencyProperty.Register(nameof(NextNavigationButtonMode), typeof(NewPipsPagerNavigationMode), typeof(NewPipsPager), new PropertyMetadata(NewPipsPagerNavigationMode.Auto, NextNavigationButtonMode_OnChange));
+
+ public static readonly DependencyProperty PreviousButtonStyleProperty = DependencyProperty.Register(nameof(PreviousButtonStyle), typeof(Style), typeof(NewPipsPager), new PropertyMetadata(null!));
+ public static readonly DependencyProperty NextButtonStyleProperty = DependencyProperty.Register(nameof(NextButtonStyle), typeof(Style), typeof(NewPipsPager), new PropertyMetadata(null!));
+ public static readonly DependencyProperty NormalPipButtonStyleProperty = DependencyProperty.Register(nameof(NormalPipButtonStyle), typeof(Style), typeof(NewPipsPager), new PropertyMetadata(null!));
+ public static readonly DependencyProperty SelectedPipButtonStyleProperty = DependencyProperty.Register(nameof(SelectedPipButtonStyle), typeof(Style), typeof(NewPipsPager), new PropertyMetadata(null!));
+
+ #endregion
+}
diff --git a/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Templates.cs b/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Templates.cs
new file mode 100644
index 0000000000..91a4b5e8c1
--- /dev/null
+++ b/CollapseLauncher/XAMLs/Theme/CustomControls/NewPipsPager.Templates.cs
@@ -0,0 +1,124 @@
+#nullable enable
+using CollapseLauncher.Extension;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using System.Threading;
+
+namespace CollapseLauncher.XAMLs.Theme.CustomControls;
+
+[TemplatePart(Name = TemplateNamePreviousPageButton, Type = typeof(Button))]
+[TemplatePart(Name = TemplateNameNextPageButton, Type = typeof(Button))]
+[TemplatePart(Name = TemplateNamePipsPagerScrollViewer, Type = typeof(ScrollViewer))]
+[TemplatePart(Name = TemplateNamePipsPagerItemsRepeater, Type = typeof(ItemsRepeater))]
+public partial class NewPipsPager
+{
+ #region Constants
+
+ private const string TemplateNamePreviousPageButton = "PreviousPageButton";
+ private const string TemplateNameNextPageButton = "NextPageButton";
+ private const string TemplateNamePipsPagerScrollViewer = "PipsPagerScrollViewer";
+ private const string TemplateNamePipsPagerItemsRepeater = "PipsPagerItemsRepeater";
+
+ private const string PipButtonStateNormal = "Normal";
+
+ private const string NavButtonStatePreviousPageButtonCollapsed = "PreviousPageButtonCollapsed";
+ private const string NavButtonStatePreviousPageButtonVisible = "PreviousPageButtonVisible";
+ private const string NavButtonStatePreviousPageButtonHidden = "PreviousPageButtonHidden";
+ private const string NavButtonStateNextPageButtonCollapsed = "NextPageButtonCollapsed";
+ private const string NavButtonStateNextPageButtonVisible = "NextPageButtonVisible";
+ private const string NavButtonStateNextPageButtonHidden = "NextPageButtonHidden";
+
+ #endregion
+
+ #region Fields
+
+ private Button _previousPageButton = null!;
+ private Button _nextPageButton = null!;
+ private ScrollViewer _pipsPagerScrollViewer = null!;
+ private ItemsRepeater _pipsPagerItemsRepeater = null!;
+
+ private bool _isTemplateLoaded;
+
+ #endregion
+
+ #region Apply Template Methods
+
+ protected override void OnApplyTemplate()
+ {
+ if (Interlocked.Exchange(ref _isTemplateLoaded, true))
+ {
+ return;
+ }
+
+ base.OnApplyTemplate();
+
+ _previousPageButton = this.GetTemplateChild