Skip to content

Free, open-source Windows optimization tool for performance, privacy, and simplicity.

refactor(ui): centralize converters and extract reusable badge/empty/loading controls

fatDuck69a5639fcf2b
diff --git a/optimizerDuck.Test/Domain/Conditions/ConditionTests.cs b/optimizerDuck.Test/Domain/Conditions/ConditionTests.cs
index 117c806..7023be3 100644
--- a/optimizerDuck.Test/Domain/Conditions/ConditionTests.cs
+++ b/optimizerDuck.Test/Domain/Conditions/ConditionTests.cs
@@ -19,59 +19,60 @@ public class ConditionTests
GpuVendor gpuVendor = GpuVendor.Unknown,
CpuVendor cpuVendor = CpuVendor.Unknown,
double ramGb = 0
- ) => new()
- {
- Cpu = new CpuInfo
- {
- Name = "Test CPU",
- Manufacturer = "TestManufacturer",
- Vendor = cpuVendor,
- Architecture = "64-bit",
- Cores = 8,
- Threads = 16,
- MaxClockMHz = 4000,
- CurrentClockMHz = 4000,
- L2CacheKB = 0,
- L3CacheKB = 0,
- },
- Ram = new RamInfo
+ ) =>
+ new()
{
- TotalGB = ramGb,
- TotalMB = (long)(ramGb * 1024),
- TotalKB = (long)(ramGb * 1024 * 1024),
- AvailableGB = ramGb,
- UsedPercent = 0,
- UsedGB = 0,
- Modules = [],
- },
- Os = new OsInfo
- {
- Name = "Microsoft Windows 11 Pro",
- Version = "11",
- BuildNumber = build,
- Edition = "Pro",
- Architecture = "64-bit",
- DeviceType = "Desktop",
- InstallDate = "2024-01-01",
- LastBootUpTime = "2024-01-01 00:00",
- },
- Bios = BiosInfo.Unknown,
- Gpus =
- gpuVendor == GpuVendor.Unknown
- ? []
- :
- [
- new GpuInfo
- {
- Name = "Test GPU",
- DriverVersion = "1.0",
- Vendor = gpuVendor,
- MemoryMB = 8192,
- },
- ],
- PrimaryGpu = null,
- Disk = DiskInfo.Unknown,
- };
+ Cpu = new CpuInfo
+ {
+ Name = "Test CPU",
+ Manufacturer = "TestManufacturer",
+ Vendor = cpuVendor,
+ Architecture = "64-bit",
+ Cores = 8,
+ Threads = 16,
+ MaxClockMHz = 4000,
+ CurrentClockMHz = 4000,
+ L2CacheKB = 0,
+ L3CacheKB = 0,
+ },
+ Ram = new RamInfo
+ {
+ TotalGB = ramGb,
+ TotalMB = (long)(ramGb * 1024),
+ TotalKB = (long)(ramGb * 1024 * 1024),
+ AvailableGB = ramGb,
+ UsedPercent = 0,
+ UsedGB = 0,
+ Modules = [],
+ },
+ Os = new OsInfo
+ {
+ Name = "Microsoft Windows 11 Pro",
+ Version = "11",
+ BuildNumber = build,
+ Edition = "Pro",
+ Architecture = "64-bit",
+ DeviceType = "Desktop",
+ InstallDate = "2024-01-01",
+ LastBootUpTime = "2024-01-01 00:00",
+ },
+ Bios = BiosInfo.Unknown,
+ Gpus =
+ gpuVendor == GpuVendor.Unknown
+ ? []
+ :
+ [
+ new GpuInfo
+ {
+ Name = "Test GPU",
+ DriverVersion = "1.0",
+ Vendor = gpuVendor,
+ MemoryMB = 8192,
+ },
+ ],
+ PrimaryGpu = null,
+ Disk = DiskInfo.Unknown,
+ };
#endregion
@@ -365,11 +366,26 @@ public class ConditionTests
public void ConditionEvaluator_UnknownSnapshot_FailOpenToAvailable()
{
// An unpopulated snapshot (detection not finished/failed) never hides an item.
- Assert.Equal(ConditionState.Available, Evaluate(typeof(Windows11Condition), SystemSnapshot.Unknown).State);
- Assert.Equal(ConditionState.Available, Evaluate(typeof(Windows11_24H2OrGreaterCondition), SystemSnapshot.Unknown).State);
- Assert.Equal(ConditionState.Available, Evaluate(typeof(NvidiaGpuCondition), SystemSnapshot.Unknown).State);
- Assert.Equal(ConditionState.Available, Evaluate(typeof(SixteenGbRamCondition), SystemSnapshot.Unknown).State);
- Assert.Equal(ConditionState.Available, Evaluate(typeof(IntelCpuCondition), SystemSnapshot.Unknown).State);
+ Assert.Equal(
+ ConditionState.Available,
+ Evaluate(typeof(Windows11Condition), SystemSnapshot.Unknown).State
+ );
+ Assert.Equal(
+ ConditionState.Available,
+ Evaluate(typeof(Windows11_24H2OrGreaterCondition), SystemSnapshot.Unknown).State
+ );
+ Assert.Equal(
+ ConditionState.Available,
+ Evaluate(typeof(NvidiaGpuCondition), SystemSnapshot.Unknown).State
+ );
+ Assert.Equal(
+ ConditionState.Available,
+ Evaluate(typeof(SixteenGbRamCondition), SystemSnapshot.Unknown).State
+ );
+ Assert.Equal(
+ ConditionState.Available,
+ Evaluate(typeof(IntelCpuCondition), SystemSnapshot.Unknown).State
+ );
}
[Fact]
diff --git a/optimizerDuck.Test/Domain/Customize/BaseCustomizeSettingTests.cs b/optimizerDuck.Test/Domain/Customize/BaseCustomizeSettingTests.cs
index 76a9b68..6d2de0d 100644
--- a/optimizerDuck.Test/Domain/Customize/BaseCustomizeSettingTests.cs
+++ b/optimizerDuck.Test/Domain/Customize/BaseCustomizeSettingTests.cs
@@ -646,20 +646,15 @@ public class BaseCustomizeSettingTests : IDisposable
private class TestDropdownSetting : BaseCustomizeSetting
{
- private const string RegPath =
- @"HKCU\Software\TestOptimizerDuckCustomize";
+ private const string RegPath = @"HKCU\Software\TestOptimizerDuckCustomize";
private const string RegName = "DropdownTest";
public override CustomizeControlType ControlType => CustomizeControlType.Dropdown;
protected override IReadOnlyList<SettingOption>? GetOptions() =>
- [
- Option("OptionA", RegPath, RegName, 1),
- Option("OptionB", RegPath, RegName, 2),
- ];
+ [Option("OptionA", RegPath, RegName, 1), Option("OptionB", RegPath, RegName, 2)];
- protected override CustomizeRefreshScope RefreshScope =>
- CustomizeRefreshScope.Settings;
+ protected override CustomizeRefreshScope RefreshScope => CustomizeRefreshScope.Settings;
}
[Fact]
@@ -733,7 +728,10 @@ public class BaseCustomizeSettingTests : IDisposable
Assert.NotNull(effective);
Assert.Equal(3, effective!.Count);
Assert.Equal(99, effective[2].Value);
- Assert.Equal(Loc.Instance[BaseCustomizeSetting.CustomOptionTranslationKey], effective[2].DisplayName);
+ Assert.Equal(
+ Loc.Instance[BaseCustomizeSetting.CustomOptionTranslationKey],
+ effective[2].DisplayName
+ );
Assert.Null(effective[2].Bindings);
Assert.Equal(99, setting.CurrentValue);
@@ -856,7 +854,9 @@ public class BaseCustomizeSettingTests : IDisposable
// Key A = 1 (matches "On" primary) but Key B = 0 → no full match; the raw primary
// value (1) already equals the declared "On" value, so no "Custom" duplicate.
RegistryService.Write(new RegistryItem(TestKeyPath, "Key1", 1));
- RegistryService.Write(new RegistryItem(@"HKCU\Software\TestOptimizerDuckMultiKey", "Key2", 0));
+ RegistryService.Write(
+ new RegistryItem(@"HKCU\Software\TestOptimizerDuckMultiKey", "Key2", 0)
+ );
var effective = setting.Options;
@@ -905,11 +905,15 @@ public class BaseCustomizeSettingTests : IDisposable
public override CustomizeControlType ControlType => CustomizeControlType.Dropdown;
protected override IReadOnlyList<SettingOption>? GetOptions() =>
- [
- new SettingOption("Off", 0, [new RegistryBinding(RegPath, RegName, 0)]),
- new SettingOption("On", 1, [new RegistryBinding(RegPath, RegName, 1)]),
- new SettingOption("NotSet", "notset", [new RegistryBinding(RegPath, RegName, null)]),
- ];
+ [
+ new SettingOption("Off", 0, [new RegistryBinding(RegPath, RegName, 0)]),
+ new SettingOption("On", 1, [new RegistryBinding(RegPath, RegName, 1)]),
+ new SettingOption(
+ "NotSet",
+ "notset",
+ [new RegistryBinding(RegPath, RegName, null)]
+ ),
+ ];
}
[Fact]
@@ -945,9 +949,7 @@ public class BaseCustomizeSettingTests : IDisposable
// Selecting the declared "NotSet" option deletes the registry value (binding null).
await setting.ApplyAsync("notset");
- var value = RegistryService.Read<object>(
- new RegistryItem(TestKeyPath, "NotSetOptionTest")
- );
+ var value = RegistryService.Read<object>(new RegistryItem(TestKeyPath, "NotSetOptionTest"));
Assert.Null(value);
Assert.Equal("notset", setting.CurrentValue);
@@ -967,9 +969,7 @@ public class BaseCustomizeSettingTests : IDisposable
Assert.Equal(1, setting.CurrentValue);
await setting.ApplyAsync("notset");
- var value = RegistryService.Read<object>(
- new RegistryItem(TestKeyPath, "NotSetOptionTest")
- );
+ var value = RegistryService.Read<object>(new RegistryItem(TestKeyPath, "NotSetOptionTest"));
Assert.Null(value);
Assert.Equal("notset", setting.CurrentValue);
@@ -984,10 +984,24 @@ public class BaseCustomizeSettingTests : IDisposable
public override CustomizeControlType ControlType => CustomizeControlType.Dropdown;
protected override IReadOnlyList<SettingOption>? GetOptions() =>
- [
- new SettingOption("Off", 0, [new RegistryBinding(RegPathA, "Key1", 0), new RegistryBinding(RegPathB, "Key2", 0)]),
- new SettingOption("On", 1, [new RegistryBinding(RegPathA, "Key1", 1), new RegistryBinding(RegPathB, "Key2", 1)]),
- ];
+ [
+ new SettingOption(
+ "Off",
+ 0,
+ [
+ new RegistryBinding(RegPathA, "Key1", 0),
+ new RegistryBinding(RegPathB, "Key2", 0),
+ ]
+ ),
+ new SettingOption(
+ "On",
+ 1,
+ [
+ new RegistryBinding(RegPathA, "Key1", 1),
+ new RegistryBinding(RegPathB, "Key2", 1),
+ ]
+ ),
+ ];
protected override CustomizeRefreshScope RefreshScope => CustomizeRefreshScope.Settings;
}
@@ -1000,7 +1014,9 @@ public class BaseCustomizeSettingTests : IDisposable
await setting.ApplyAsync(1);
var valA = RegistryService.Read<int>(new RegistryItem(TestKeyPath, "Key1"));
- var valB = RegistryService.Read<int>(new RegistryItem(@"HKCU\Software\TestOptimizerDuckMultiKey", "Key2"));
+ var valB = RegistryService.Read<int>(
+ new RegistryItem(@"HKCU\Software\TestOptimizerDuckMultiKey", "Key2")
+ );
Assert.Equal(1, valA);
Assert.Equal(1, valB);
@@ -1020,12 +1036,16 @@ public class BaseCustomizeSettingTests : IDisposable
// Both keys = 1 → option "On" matches
RegistryService.Write(new RegistryItem(TestKeyPath, "Key1", 1));
- RegistryService.Write(new RegistryItem(@"HKCU\Software\TestOptimizerDuckMultiKey", "Key2", 1));
+ RegistryService.Write(
+ new RegistryItem(@"HKCU\Software\TestOptimizerDuckMultiKey", "Key2", 1)
+ );
Assert.Equal(1, setting.CurrentValue);
// Key A = 1, Key B = 0 → no match → returns primary binding raw value
RegistryService.Write(new RegistryItem(TestKeyPath, "Key1", 1));
- RegistryService.Write(new RegistryItem(@"HKCU\Software\TestOptimizerDuckMultiKey", "Key2", 0));
+ RegistryService.Write(
+ new RegistryItem(@"HKCU\Software\TestOptimizerDuckMultiKey", "Key2", 0)
+ );
Assert.Equal(1, setting.CurrentValue);
CleanupTestKeys();
@@ -1052,7 +1072,9 @@ public class BaseCustomizeSettingTests : IDisposable
private class OverrideWinsSetting : BaseCustomizeSetting
{
public override object? CurrentValue => "custom";
+
public override Task ApplyAsync(object? value) => Task.CompletedTask;
+
public override Task<bool> GetStateAsync() => Task.FromResult(true);
}
@@ -1119,7 +1141,9 @@ public class BaseCustomizeSettingTests : IDisposable
// Both absent -> matches Always (0)
RegistryService.DeleteValue(new RegistryItem(TestKeyPath, "Glom1"));
- RegistryService.DeleteValue(new RegistryItem(@"HKCU\Software\TestOptimizerDuckMultiKey", "Glom2"));
+ RegistryService.DeleteValue(
+ new RegistryItem(@"HKCU\Software\TestOptimizerDuckMultiKey", "Glom2")
+ );
Assert.Equal(0, setting.CurrentValue);
@@ -1127,7 +1151,12 @@ public class BaseCustomizeSettingTests : IDisposable
await setting.ApplyAsync(2);
Assert.Equal(2, setting.CurrentValue);
Assert.Equal(2, RegistryService.Read<int>(new RegistryItem(TestKeyPath, "Glom1")));
- Assert.Equal(2, RegistryService.Read<int>(new RegistryItem(@"HKCU\Software\TestOptimizerDuckMultiKey", "Glom2")));
+ Assert.Equal(
+ 2,
+ RegistryService.Read<int>(
+ new RegistryItem(@"HKCU\Software\TestOptimizerDuckMultiKey", "Glom2")
+ )
+ );
CleanupTestKeys();
try
diff --git a/optimizerDuck.Test/Services/ApplyRevertComprehensiveTests.cs b/optimizerDuck.Test/Services/ApplyRevertComprehensiveTests.cs
index 23d0045..c699ddb 100644
--- a/optimizerDuck.Test/Services/ApplyRevertComprehensiveTests.cs
+++ b/optimizerDuck.Test/Services/ApplyRevertComprehensiveTests.cs
@@ -6,11 +6,11 @@ using optimizerDuck.Domain.Execution;
using optimizerDuck.Domain.Optimizations.Models;
using optimizerDuck.Domain.Revert;
using optimizerDuck.Domain.Revert.Steps;
-using optimizerDuck.Test.TestDoubles;
using optimizerDuck.Domain.UI;
using optimizerDuck.Services.Optimization;
using optimizerDuck.Services.Revert;
using optimizerDuck.Services.System;
+using optimizerDuck.Test.TestDoubles;
using Wpf.Ui;
namespace optimizerDuck.Test.Services;
diff --git a/optimizerDuck.Test/Services/Managers/RevertManagerTests.cs b/optimizerDuck.Test/Services/Managers/RevertManagerTests.cs
index 73e38b2..e305784 100644
--- a/optimizerDuck.Test/Services/Managers/RevertManagerTests.cs
+++ b/optimizerDuck.Test/Services/Managers/RevertManagerTests.cs
@@ -6,9 +6,9 @@ using optimizerDuck.Domain.Abstractions;
using optimizerDuck.Domain.Optimizations.Models;
using optimizerDuck.Domain.Revert;
using optimizerDuck.Domain.Revert.Steps;
-using optimizerDuck.Test.TestDoubles;
using optimizerDuck.Domain.UI;
using optimizerDuck.Services.Revert;
+using optimizerDuck.Test.TestDoubles;
namespace optimizerDuck.Test.Services.Managers;
@@ -312,7 +312,11 @@ public class RevertManagerTests
AppliedAt = DateTime.UtcNow,
Steps = [],
};
- await File.WriteAllTextAsync(siblingFile, JsonConvert.SerializeObject(payload), cancellationToken);
+ await File.WriteAllTextAsync(
+ siblingFile,
+ JsonConvert.SerializeObject(payload),
+ cancellationToken
+ );
var loadMethod = typeof(RevertManager).GetMethod(
"LoadAsync",
diff --git a/optimizerDuck.Test/Services/OptimizationServiceIntegrationTests.cs b/optimizerDuck.Test/Services/OptimizationServiceIntegrationTests.cs
index d4b4411..8a517e0 100644
--- a/optimizerDuck.Test/Services/OptimizationServiceIntegrationTests.cs
+++ b/optimizerDuck.Test/Services/OptimizationServiceIntegrationTests.cs
@@ -12,10 +12,10 @@ using optimizerDuck.Domain.Execution;
using optimizerDuck.Domain.Optimizations.Models;
using optimizerDuck.Domain.Revert;
using optimizerDuck.Domain.UI;
-using optimizerDuck.Test.TestDoubles;
using optimizerDuck.Services.Optimization;
using optimizerDuck.Services.Revert;
using optimizerDuck.Services.System;
+using optimizerDuck.Test.TestDoubles;
using Xunit;
namespace optimizerDuck.Test.Services;
diff --git a/optimizerDuck.Test/Services/OptimizationServiceTests.cs b/optimizerDuck.Test/Services/OptimizationServiceTests.cs
index f74362e..5aca4c6 100644
--- a/optimizerDuck.Test/Services/OptimizationServiceTests.cs
+++ b/optimizerDuck.Test/Services/OptimizationServiceTests.cs
@@ -7,10 +7,10 @@ using optimizerDuck.Domain.Optimizations.Models;
using optimizerDuck.Domain.Revert;
using optimizerDuck.Domain.Revert.Steps;
using optimizerDuck.Domain.UI;
-using optimizerDuck.Test.TestDoubles;
using optimizerDuck.Services.Optimization;
using optimizerDuck.Services.Revert;
using optimizerDuck.Services.System;
+using optimizerDuck.Test.TestDoubles;
using Wpf.Ui;
namespace optimizerDuck.Test.Services;
diff --git a/optimizerDuck.Test/Services/OptimizationServices/RegistryServiceTests.cs b/optimizerDuck.Test/Services/OptimizationServices/RegistryServiceTests.cs
index 5140d98..cd3c9db 100644
--- a/optimizerDuck.Test/Services/OptimizationServices/RegistryServiceTests.cs
+++ b/optimizerDuck.Test/Services/OptimizationServices/RegistryServiceTests.cs
@@ -8,8 +8,8 @@ using optimizerDuck.Domain.Execution;
using optimizerDuck.Domain.Optimizations.Models;
using optimizerDuck.Domain.Optimizations.Models.Services;
using optimizerDuck.Domain.UI;
-using optimizerDuck.Test.TestDoubles;
using optimizerDuck.Services.Optimization.Providers;
+using optimizerDuck.Test.TestDoubles;
using Xunit;
namespace optimizerDuck.Test.Services.OptimizationServices;
diff --git a/optimizerDuck.Test/UI/ViewModels/CustomizeItemViewModelTests.cs b/optimizerDuck.Test/UI/ViewModels/CustomizeItemViewModelTests.cs
index 7ec4cb2..fb4b36c 100644
--- a/optimizerDuck.Test/UI/ViewModels/CustomizeItemViewModelTests.cs
+++ b/optimizerDuck.Test/UI/ViewModels/CustomizeItemViewModelTests.cs
@@ -49,10 +49,10 @@ public class CustomizeItemViewModelTests : IDisposable
public override CustomizeControlType ControlType => CustomizeControlType.Dropdown;
protected override IReadOnlyList<SettingOption>? GetOptions() =>
- [
- Option("OptionA", TestKeyPath, RegName, 1),
- Option("OptionB", TestKeyPath, RegName, 2),
- ];
+ [
+ Option("OptionA", TestKeyPath, RegName, 1),
+ Option("OptionB", TestKeyPath, RegName, 2),
+ ];
public override async Task ApplyAsync(object? value)
{
@@ -77,8 +77,11 @@ public class CustomizeItemViewModelTests : IDisposable
public void Dispose() { }
}
- private static (TestDropdownVmSetting setting, FakeRegistryWatcher watcher, CustomizeItemViewModel vm)
- CreateVm()
+ private static (
+ TestDropdownVmSetting setting,
+ FakeRegistryWatcher watcher,
+ CustomizeItemViewModel vm
+ ) CreateVm()
{
var setting = new TestDropdownVmSetting { OwnerType = typeof(TestDropdownVmSetting) };
var watcher = new FakeRegistryWatcher();
@@ -322,10 +325,9 @@ public class CustomizeItemViewModelTests : IDisposable
DeleteValue();
watcher.Raise(TestKeyPath);
- await WaitUntilAsync(
- () =>
- ReferenceEquals(vm.CurrentValue, BaseCustomizeSetting.MissingValueSentinel)
- && vm.Options!.Count == 3
+ await WaitUntilAsync(() =>
+ ReferenceEquals(vm.CurrentValue, BaseCustomizeSetting.MissingValueSentinel)
+ && vm.Options!.Count == 3
);
Assert.Equal(
@@ -367,7 +369,9 @@ public class CustomizeItemViewModelTests : IDisposable
WriteValue(123);
watcher.Raise(TestKeyPath);
- await WaitUntilAsync(() => Equals(vm.CurrentValue, 123) && Equals(vm.Options[2].Value, 123));
+ await WaitUntilAsync(() =>
+ Equals(vm.CurrentValue, 123) && Equals(vm.Options[2].Value, 123)
+ );
Assert.Equal(3, vm.Options.Count);
Assert.Equal(
@@ -425,10 +429,9 @@ public class CustomizeItemViewModelTests : IDisposable
DeleteValue();
watcher.Raise(TestKeyPath);
- await WaitUntilAsync(
- () =>
- ReferenceEquals(vm.CurrentValue, BaseCustomizeSetting.MissingValueSentinel)
- && vm.Options!.Count == 3
+ await WaitUntilAsync(() =>
+ ReferenceEquals(vm.CurrentValue, BaseCustomizeSetting.MissingValueSentinel)
+ && vm.Options!.Count == 3
);
Assert.Equal(1, vm.Options![0].Value);
@@ -451,7 +454,10 @@ public class CustomizeItemViewModelTests : IDisposable
vm.Dispose();
- Assert.Equal(watcher.WatchedPaths.OrderBy(p => p).ToArray(), watcher.UnwatchedPaths.OrderBy(p => p).ToArray());
+ Assert.Equal(
+ watcher.WatchedPaths.OrderBy(p => p).ToArray(),
+ watcher.UnwatchedPaths.OrderBy(p => p).ToArray()
+ );
}
#endregion
diff --git a/optimizerDuck/App.xaml b/optimizerDuck/App.xaml
index 56101e5..492d39e 100644
--- a/optimizerDuck/App.xaml
+++ b/optimizerDuck/App.xaml
@@ -1,4 +1,4 @@
-<Application
+<Application
x:Class="optimizerDuck.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
@@ -10,6 +10,7 @@
<ui:ThemesDictionary Theme="Dark" />
<ui:ControlsDictionary />
<ResourceDictionary Source="pack://application:,,,/UI/Styles/FluentDesign.xaml" />
+ <ResourceDictionary Source="pack://application:,,,/UI/Styles/Converters.xaml" />
<ResourceDictionary Source="pack://application:,,,/UI/Styles/NavigationViewOverride.xaml" />
<ResourceDictionary Source="pack://application:,,,/UI/Styles/ToolTipOverride.xaml" />
</ResourceDictionary.MergedDictionaries>
diff --git a/optimizerDuck/App.xaml.cs b/optimizerDuck/App.xaml.cs
index bb3b0da..ed6ada8 100644
--- a/optimizerDuck/App.xaml.cs
+++ b/optimizerDuck/App.xaml.cs
@@ -305,9 +305,7 @@ public partial class App : Application
.ConfigureAppConfiguration(c =>
{
using var loggerFactory = LoggerFactory.Create(b => b.AddSerilog(Log.Logger));
- ConfigManager.ValidateConfig(
- loggerFactory.CreateLogger(typeof(ConfigManager))
- );
+ ConfigManager.ValidateConfig(loggerFactory.CreateLogger(typeof(ConfigManager)));
c.AddJsonFile(Path.Combine(Shared.RootDirectory, "appsettings.json"), false, true);
})
.ConfigureServices(
diff --git a/optimizerDuck/Common/Converters/ObjectToNullableDoubleConverter.cs b/optimizerDuck/Common/Converters/ObjectToNullableDoubleConverter.cs
index a4dae83..ab0994b 100644
--- a/optimizerDuck/Common/Converters/ObjectToNullableDoubleConverter.cs
+++ b/optimizerDuck/Common/Converters/ObjectToNullableDoubleConverter.cs
@@ -60,13 +60,17 @@ public sealed class ObjectToNullableDoubleConverter : IValueConverter
return DependencyProperty.UnsetValue;
}
- public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object? ConvertBack(
+ object? value,
+ Type targetType,
+ object? parameter,
+ CultureInfo culture
+ )
{
if (value is null)
return null;
- var isInt =
- parameter is string p && p.Equals("Int", StringComparison.OrdinalIgnoreCase);
+ var isInt = parameter is string p && p.Equals("Int", StringComparison.OrdinalIgnoreCase);
if (value is double db)
return isInt ? (int)Math.Round(db) : db;
diff --git a/optimizerDuck/Common/Converters/ProgressBarValueToBrushConverter.cs b/optimizerDuck/Common/Converters/ProgressBarValueToBrushConverter.cs
index dbd756f..3e89b1f 100644
--- a/optimizerDuck/Common/Converters/ProgressBarValueToBrushConverter.cs
+++ b/optimizerDuck/Common/Converters/ProgressBarValueToBrushConverter.cs
@@ -8,18 +8,6 @@ namespace optimizerDuck.Common.Converters;
/// <summary>Maps a progress percentage to a theme brush: green under 50%, yellow under 80%, red above.</summary>
public class ProgressBarValueToBrushConverter : IValueConverter
{
- private static readonly SolidColorBrush GreenBrush =
- ThemeResource.Get<SolidColorBrush>("SystemFillColorSuccessBrush")
- ?? new SolidColorBrush(Color.FromRgb(0, 180, 0));
-
- private static readonly SolidColorBrush YellowBrush =
- ThemeResource.Get<SolidColorBrush>("SystemFillColorCautionBrush")
- ?? new SolidColorBrush(Color.FromRgb(255, 140, 0));
-
- private static readonly SolidColorBrush RedBrush =
- ThemeResource.Get<SolidColorBrush>("SystemFillColorCriticalBrush")
- ?? new SolidColorBrush(Color.FromRgb(220, 0, 0));
-
private static readonly SolidColorBrush DefaultBrush = new(Color.FromArgb(0x0, 0x0, 0x0, 0x0));
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
@@ -30,9 +18,12 @@ public class ProgressBarValueToBrushConverter : IValueConverter
return percent switch
{
< 0 => DefaultBrush,
- < 50 => GreenBrush,
- < 80 => YellowBrush,
- _ => RedBrush,
+ < 50 => ThemeResource.Get<Brush>("SystemFillColorSuccessBrush")
+ ?? new SolidColorBrush(Color.FromRgb(0, 180, 0)),
+ < 80 => ThemeResource.Get<Brush>("SystemFillColorCautionBrush")
+ ?? new SolidColorBrush(Color.FromRgb(255, 140, 0)),
+ _ => ThemeResource.Get<Brush>("SystemFillColorCriticalBrush")
+ ?? new SolidColorBrush(Color.FromRgb(220, 0, 0)),
};
}
diff --git a/optimizerDuck/Common/Converters/RecommendationForegroundConverter.cs b/optimizerDuck/Common/Converters/RecommendationForegroundConverter.cs
index b1606c4..e07bf9e 100644
--- a/optimizerDuck/Common/Converters/RecommendationForegroundConverter.cs
+++ b/optimizerDuck/Common/Converters/RecommendationForegroundConverter.cs
@@ -11,20 +11,14 @@ namespace optimizerDuck.Common.Converters;
/// <summary>Provides theme-aware text brushes for converter use.</summary>
public static class ThemeBrushes
{
- public static Brush Primary => Clone("TextFillColorPrimaryBrush");
+ public static Brush Primary =>
+ ThemeResource.Get<Brush>("TextFillColorPrimaryBrush") ?? Brushes.White;
- public static Brush Inverse => Clone("TextFillColorInverseBrush");
+ public static Brush Inverse =>
+ ThemeResource.Get<Brush>("TextFillColorInverseBrush") ?? Brushes.White;
- public static Brush Secondary => Clone("TextFillColorSecondaryBrush");
-
- private static Brush Clone(string key)
- {
- var brush = ThemeResource.Get<SolidColorBrush>(key);
- if (brush != null)
- return brush.Clone();
-
- return Brushes.White;
- }
+ public static Brush Secondary =>
+ ThemeResource.Get<Brush>("TextFillColorSecondaryBrush") ?? Brushes.Gray;
}
/// <summary>Picks a foreground brush for a recommendation state based on the current app theme.</summary>
diff --git a/optimizerDuck/Common/Converters/SizeToBrushConverter.cs b/optimizerDuck/Common/Converters/SizeToBrushConverter.cs
index b5e90ae..a716625 100644
--- a/optimizerDuck/Common/Converters/SizeToBrushConverter.cs
+++ b/optimizerDuck/Common/Converters/SizeToBrushConverter.cs
@@ -1,4 +1,4 @@
-using System.Globalization;
+using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using optimizerDuck.Common.Helpers;
@@ -14,18 +14,6 @@ public class SizeToBrushConverter : IValueConverter
private const long TenMB = 10L * 1024 * 1024;
private const long HundredMB = 100L * 1024 * 1024;
- private static readonly SolidColorBrush GreenBrush =
- ThemeResource.Get<SolidColorBrush>("SystemFillColorSuccessBrush")
- ?? new SolidColorBrush(Color.FromRgb(0, 180, 0));
-
- private static readonly SolidColorBrush OrangeBrush =
- ThemeResource.Get<SolidColorBrush>("SystemFillColorCautionBrush")
- ?? new SolidColorBrush(Color.FromRgb(255, 140, 0));
-
- private static readonly SolidColorBrush RedBrush =
- ThemeResource.Get<SolidColorBrush>("SystemFillColorCriticalBrush")
- ?? new SolidColorBrush(Color.FromRgb(220, 0, 0));
-
private static readonly SolidColorBrush DefaultBrush = new(Color.FromArgb(0x0, 0x0, 0x0, 0x0));
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
@@ -36,9 +24,12 @@ public class SizeToBrushConverter : IValueConverter
return bytes switch
{
<= 0 => DefaultBrush,
- < TenMB => GreenBrush,
- < HundredMB => OrangeBrush,
- _ => RedBrush,
+ < TenMB => ThemeResource.Get<Brush>("SystemFillColorSuccessBrush")
+ ?? new SolidColorBrush(Color.FromRgb(0, 180, 0)),
+ < HundredMB => ThemeResource.Get<Brush>("SystemFillColorCautionBrush")
+ ?? new SolidColorBrush(Color.FromRgb(255, 140, 0)),
+ _ => ThemeResource.Get<Brush>("SystemFillColorCriticalBrush")
+ ?? new SolidColorBrush(Color.FromRgb(220, 0, 0)),
};
}
diff --git a/optimizerDuck/Common/Extensions/CustomizePageRegistryExtensions.cs b/optimizerDuck/Common/Extensions/CustomizePageRegistryExtensions.cs
index e6464dc..d6a36e3 100644
--- a/optimizerDuck/Common/Extensions/CustomizePageRegistryExtensions.cs
+++ b/optimizerDuck/Common/Extensions/CustomizePageRegistryExtensions.cs
@@ -39,7 +39,6 @@ public static class CustomizePageRegistryExtensions
var registryWatcher = serviceProvider.GetRequiredService<IRegistryWatcher>();
var systemInfoService = serviceProvider.GetRequiredService<SystemInfoService>();
-
var category = registry.Categories.First(c => c.GetType() == categoryType);
var viewModel = new CustomizeCategoryViewModel(
diff --git a/optimizerDuck/Common/Helpers/ThemeResource.cs b/optimizerDuck/Common/Helpers/ThemeResource.cs
index 992d173..bd44d25 100644
--- a/optimizerDuck/Common/Helpers/ThemeResource.cs
+++ b/optimizerDuck/Common/Helpers/ThemeResource.cs
@@ -7,6 +7,9 @@ public static class ThemeResource
public static T? Get<T>(string key)
where T : class
{
- return Application.Current.Resources[key] as T;
+ if (Application.Current is null)
+ return null;
+
+ return Application.Current.TryFindResource(key) as T;
}
}
diff --git a/optimizerDuck/Domain/Conditions/BuiltIn/CpuBrandCondition.cs b/optimizerDuck/Domain/Conditions/BuiltIn/CpuBrandCondition.cs
index 3148a03..e480f4f 100644
--- a/optimizerDuck/Domain/Conditions/BuiltIn/CpuBrandCondition.cs
+++ b/optimizerDuck/Domain/Conditions/BuiltIn/CpuBrandCondition.cs
@@ -34,7 +34,8 @@ public sealed class IntelCpuCondition : CpuBrandCondition
{
protected override CpuVendor RequiredVendor => CpuVendor.Intel;
protected override Func<string> Title => () => Translations.Condition_Cpu_Intel_Title;
- protected override Func<string> Description => () => Translations.Condition_Cpu_Intel_Description;
+ protected override Func<string> Description =>
+ () => Translations.Condition_Cpu_Intel_Description;
}
/// <summary>Requires an AMD CPU.</summary>
diff --git a/optimizerDuck/Domain/Conditions/BuiltIn/GpuBrandCondition.cs b/optimizerDuck/Domain/Conditions/BuiltIn/GpuBrandCondition.cs
index 5acedc4..fedf822 100644
--- a/optimizerDuck/Domain/Conditions/BuiltIn/GpuBrandCondition.cs
+++ b/optimizerDuck/Domain/Conditions/BuiltIn/GpuBrandCondition.cs
@@ -38,7 +38,8 @@ public sealed class NvidiaGpuCondition : GpuBrandCondition
{
protected override GpuVendor RequiredVendor => GpuVendor.NVIDIA;
protected override Func<string> Title => () => Translations.Condition_Gpu_Nvidia_Title;
- protected override Func<string> Description => () => Translations.Condition_Gpu_Nvidia_Description;
+ protected override Func<string> Description =>
+ () => Translations.Condition_Gpu_Nvidia_Description;
}
/// <summary>Requires an AMD GPU.</summary>
@@ -54,5 +55,6 @@ public sealed class IntelGpuCondition : GpuBrandCondition
{
protected override GpuVendor RequiredVendor => GpuVendor.Intel;
protected override Func<string> Title => () => Translations.Condition_Gpu_Intel_Title;
- protected override Func<string> Description => () => Translations.Condition_Gpu_Intel_Description;
+ protected override Func<string> Description =>
+ () => Translations.Condition_Gpu_Intel_Description;
}
diff --git a/optimizerDuck/Domain/Conditions/BuiltIn/Windows10Condition.cs b/optimizerDuck/Domain/Conditions/BuiltIn/Windows10Condition.cs
index bb87050..4029bfd 100644
--- a/optimizerDuck/Domain/Conditions/BuiltIn/Windows10Condition.cs
+++ b/optimizerDuck/Domain/Conditions/BuiltIn/Windows10Condition.cs
@@ -7,7 +7,8 @@ namespace optimizerDuck.Domain.Conditions;
public sealed class Windows10Condition : ConditionBase
{
public override ConditionResult Evaluate(SystemSnapshot snapshot) =>
- TryGetOsBuild(snapshot, out var build) && build is >= WindowsBuilds.Windows10 and < WindowsBuilds.Windows11
+ TryGetOsBuild(snapshot, out var build)
+ && build is >= WindowsBuilds.Windows10 and < WindowsBuilds.Windows11
? ConditionResult.Available
: ConditionResult.Unsupported(
() => Translations.Condition_Windows10_Title,
diff --git a/optimizerDuck/Domain/Customize/Categories/Preferences.cs b/optimizerDuck/Domain/Customize/Categories/Preferences.cs
index 209e2de..021351d 100644
--- a/optimizerDuck/Domain/Customize/Categories/Preferences.cs
+++ b/optimizerDuck/Domain/Customize/Categories/Preferences.cs
@@ -48,13 +48,12 @@ public class Preferences : ICustomizeCategory
Option("Center", RegPath, RegName, 1, matchMissingAsDefault: true),
Option("Left", RegPath, RegName, 0),
];
+
protected override CustomizeRefreshScope RefreshScope =>
CustomizeRefreshScope.TaskbarSettings;
}
- [CustomizeSetting(
- Section = nameof(Sections.Taskbar),
- Icon = SymbolRegular.AppGeneric24
- )]
+
+ [CustomizeSetting(Section = nameof(Sections.Taskbar), Icon = SymbolRegular.AppGeneric24)]
public class CombineTaskbarButtons : BaseCustomizeSetting
{
private const string RegPath =
@@ -557,10 +556,7 @@ public class Preferences : ICustomizeCategory
CustomizeRefreshScope.TaskbarSettings;
}
- [CustomizeSetting(
- Section = nameof(Sections.Taskbar),
- Icon = SymbolRegular.CursorClick24
- )]
+ [CustomizeSetting(Section = nameof(Sections.Taskbar), Icon = SymbolRegular.CursorClick24)]
public class TaskbarLastActiveClick : BaseCustomizeSetting
{
private const string RegPath =
diff --git a/optimizerDuck/Domain/Customize/Models/BaseCustomizeSetting.cs b/optimizerDuck/Domain/Customize/Models/BaseCustomizeSetting.cs
index ad2a088..a0c6588 100644
--- a/optimizerDuck/Domain/Customize/Models/BaseCustomizeSetting.cs
+++ b/optimizerDuck/Domain/Customize/Models/BaseCustomizeSetting.cs
@@ -239,16 +239,13 @@ public abstract partial class BaseCustomizeSetting : ObservableObject, ICustomiz
// From ALL Dropdown option bindings (not just primary)
var fromOptions =
ControlType == CustomizeControlType.Dropdown && Options != null
- ? Options.Where(o => o.Bindings != null)
+ ? Options
+ .Where(o => o.Bindings != null)
.SelectMany(o => o.Bindings!)
.Select(b => b.Path)
: [];
- return [
- .. fromToggles
- .Concat(fromOptions)
- .Distinct(StringComparer.OrdinalIgnoreCase),
- ];
+ return [.. fromToggles.Concat(fromOptions).Distinct(StringComparer.OrdinalIgnoreCase)];
}
/// <summary>
@@ -370,18 +367,8 @@ public abstract partial class BaseCustomizeSetting : ObservableObject, ICustomiz
additionalMatchValues.Length > 0 ? [value, .. additionalMatchValues] : null
);
- protected RegistryBinding BindWithDefault(
- string regPath,
- string? regName,
- object value
- ) =>
- new(
- regPath,
- regName,
- value,
- Microsoft.Win32.RegistryValueKind.DWord,
- [value, null]
- );
+ protected RegistryBinding BindWithDefault(string regPath, string? regName, object value) =>
+ new(regPath, regName, value, Microsoft.Win32.RegistryValueKind.DWord, [value, null]);
protected string RecommendationPrefix => $"Customize.{OwnerKey}.{FeatureKey}.Recommendation";
diff --git a/optimizerDuck/Domain/Optimizations/Categories/SecurityAndPrivacy.cs b/optimizerDuck/Domain/Optimizations/Categories/SecurityAndPrivacy.cs
index 7ca2d97..b3d8900 100644
--- a/optimizerDuck/Domain/Optimizations/Categories/SecurityAndPrivacy.cs
+++ b/optimizerDuck/Domain/Optimizations/Categories/SecurityAndPrivacy.cs
@@ -542,9 +542,7 @@ public class SecurityAndPrivacy : IOptimizationCategory
[Optimization(
Id = "6856782A-B530-4623-BD89-942D73FB82FD",
Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.Privacy
- | OptimizationTags.System
- | OptimizationTags.Windows10Only,
+ Tags = OptimizationTags.Privacy | OptimizationTags.System | OptimizationTags.Windows10Only,
Condition = typeof(Windows10Condition)
)]
public class DisableCortana : BaseOptimization
@@ -732,11 +730,8 @@ public class SecurityAndPrivacy : IOptimizationCategory
0
)
);
- context.Logger.LogInformation(
- "Disabled peer-to-peer Delivery Optimization sharing"
- );
+ context.Logger.LogInformation("Disabled peer-to-peer Delivery Optimization sharing");
return Task.FromResult(CompleteFromScope());
}
}
-
}
diff --git a/optimizerDuck/Domain/Optimizations/Models/BaseOptimization.cs b/optimizerDuck/Domain/Optimizations/Models/BaseOptimization.cs
index 76d25ff..c92dc93 100644
--- a/optimizerDuck/Domain/Optimizations/Models/BaseOptimization.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/BaseOptimization.cs
@@ -193,4 +193,3 @@ public abstract partial class BaseOptimization : ObservableObject, IOptimization
?? ApplyResult.False(Translations.Revert_Error_NoSteps);
}
}
-
diff --git a/optimizerDuck/Domain/UI/OptimizationState.cs b/optimizerDuck/Domain/UI/OptimizationState.cs
index 0624c3b..a8a6cbe 100644
--- a/optimizerDuck/Domain/UI/OptimizationState.cs
+++ b/optimizerDuck/Domain/UI/OptimizationState.cs
@@ -72,7 +72,7 @@ public partial class OptimizationState : ObservableObject
TimeSpan.FromSeconds(1),
DispatcherPriority.Render,
(s, e) => UpdateAllRelativeTimes(),
- System.Windows.Application.Current.Dispatcher
+ dispatcher
);
_globalTimer.Start();
}
diff --git a/optimizerDuck/Services/Customize/CustomizeRegistry.cs b/optimizerDuck/Services/Customize/CustomizeRegistry.cs
index a8b2f06..622f1a6 100644
--- a/optimizerDuck/Services/Customize/CustomizeRegistry.cs
+++ b/optimizerDuck/Services/Customize/CustomizeRegistry.cs
@@ -100,6 +100,7 @@ public class CustomizeRegistry
Categories = categories;
IsPreloaded = true;
}
+
/// <summary>Builds the navigation items for the UI from the registered categories.</summary>
/// <returns>A sequence of <see cref="NavigationViewItem"/> instances mapped to customize pages.</returns>
public IEnumerable<NavigationViewItem> GetNavigationItems()
diff --git a/optimizerDuck/Services/Optimization/OptimizationRegistry.cs b/optimizerDuck/Services/Optimization/OptimizationRegistry.cs
index d3b6580..399ea5b 100644
--- a/optimizerDuck/Services/Optimization/OptimizationRegistry.cs
+++ b/optimizerDuck/Services/Optimization/OptimizationRegistry.cs
@@ -48,7 +48,10 @@ public class OptimizationRegistry(ILoggerFactory loggerFactory)
if (opt is BaseOptimization bo)
{
bo.OwnerType = t;
- ConditionValidation.Validate(bo.ConditionType, bo.OptimizationKey);
+ ConditionValidation.Validate(
+ bo.ConditionType,
+ bo.OptimizationKey
+ );
}
return opt;
diff --git a/optimizerDuck/Services/Optimization/OptimizationService.cs b/optimizerDuck/Services/Optimization/OptimizationService.cs
index d2869e1..e46cafd 100644
--- a/optimizerDuck/Services/Optimization/OptimizationService.cs
+++ b/optimizerDuck/Services/Optimization/OptimizationService.cs
@@ -63,9 +63,11 @@ public class OptimizationService(
using var scope = ExecutionScope.BeginForLogging(_logger);
- var result = await ShellService.PowerShellAsync(
- $"Checkpoint-Computer -Description \"{Shared.RestorePointName}\" -RestorePointType MODIFY_SETTINGS"
- ).ConfigureAwait(false);
+ var result = await ShellService
+ .PowerShellAsync(
+ $"Checkpoint-Computer -Description \"{Shared.RestorePointName}\" -RestorePointType MODIFY_SETTINGS"
+ )
+ .ConfigureAwait(false);
if (IsFrequencyLimited(result.Stderr))
{
@@ -94,9 +96,9 @@ public class OptimizationService(
}
);
- var enableResult = await ShellService.PowerShellAsync(
- "Enable-ComputerRestore -Drive \"$env:SystemDrive\""
- ).ConfigureAwait(false);
+ var enableResult = await ShellService
+ .PowerShellAsync("Enable-ComputerRestore -Drive \"$env:SystemDrive\"")
+ .ConfigureAwait(false);
if (enableResult.ExitCode != 0)
{
@@ -115,9 +117,11 @@ public class OptimizationService(
}
);
- result = await ShellService.PowerShellAsync(
- $"Checkpoint-Computer -Description \"{Shared.RestorePointName}\" -RestorePointType MODIFY_SETTINGS"
- ).ConfigureAwait(false);
+ result = await ShellService
+ .PowerShellAsync(
+ $"Checkpoint-Computer -Description \"{Shared.RestorePointName}\" -RestorePointType MODIFY_SETTINGS"
+ )
+ .ConfigureAwait(false);
if (IsFrequencyLimited(result.Stderr))
return RestorePointResult.FrequencyLimitReached;
@@ -169,15 +173,17 @@ public class OptimizationService(
try
{
- var applyResult = await optimization.ApplyAsync(
- progress,
- new OptimizationContext
- {
- Logger = optLogger,
- Snapshot = systemInfoService.Snapshot,
- StreamService = streamService,
- }
- ).ConfigureAwait(false);
+ var applyResult = await optimization
+ .ApplyAsync(
+ progress,
+ new OptimizationContext
+ {
+ Logger = optLogger,
+ Snapshot = systemInfoService.Snapshot,
+ StreamService = streamService,
+ }
+ )
+ .ConfigureAwait(false);
if (!string.IsNullOrWhiteSpace(applyResult.ErrorMessage))
{
@@ -281,16 +287,17 @@ public class OptimizationService(
// scan revert directory for which optimizations are currently applied
// we infer applied state from file presence, not a database
var revertFiles = await Task.Run(() =>
- {
- if (!Directory.Exists(Shared.RevertDirectory))
- return new HashSet<string>();
+ {
+ if (!Directory.Exists(Shared.RevertDirectory))
+ return new HashSet<string>();
- return Directory
- .GetFiles(Shared.RevertDirectory, "*.json")
- .Select(Path.GetFileNameWithoutExtension)
- .Where(f => f != null)
- .ToHashSet(StringComparer.OrdinalIgnoreCase)!;
- }).ConfigureAwait(false);
+ return Directory
+ .GetFiles(Shared.RevertDirectory, "*.json")
+ .Select(Path.GetFileNameWithoutExtension)
+ .Where(f => f != null)
+ .ToHashSet(StringComparer.OrdinalIgnoreCase)!;
+ })
+ .ConfigureAwait(false);
foreach (var opt in optimizations)
{
@@ -337,14 +344,15 @@ public class OptimizationService(
{
return (
await RetryFailedStepsWithResultsAsync(
- failedSteps,
- reverseOrder,
- logger,
- revertManager,
- optimizationId,
- optimizationKey,
- progress
- ).ConfigureAwait(false)
+ failedSteps,
+ reverseOrder,
+ logger,
+ revertManager,
+ optimizationId,
+ optimizationKey,
+ progress
+ )
+ .ConfigureAwait(false)
).FailedSteps;
}
@@ -445,12 +453,14 @@ public class OptimizationService(
{
try
{
- await revertManager.UpsertRevertStepAtIndexAsync(
- optimizationId.Value,
- optimizationKey ?? string.Empty,
- step.Index, // Use original failed step's index
- recoveredStep.RevertStep
- ).ConfigureAwait(false);
+ await revertManager
+ .UpsertRevertStepAtIndexAsync(
+ optimizationId.Value,
+ optimizationKey ?? string.Empty,
+ step.Index, // Use original failed step's index
+ recoveredStep.RevertStep
+ )
+ .ConfigureAwait(false);
}
catch (Exception ex)
{
diff --git a/optimizerDuck/Services/Revert/RevertManager.cs b/optimizerDuck/Services/Revert/RevertManager.cs
index 4099a04..dc0b0cb 100644
--- a/optimizerDuck/Services/Revert/RevertManager.cs
+++ b/optimizerDuck/Services/Revert/RevertManager.cs
@@ -50,17 +50,18 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _logge
var optimizationId = scope.OptimizationId!.Value;
await WriteJsonAsync(
- optimizationId,
- GetFilePath(optimizationId),
- new RevertData
- {
- SchemaVersion = SchemaVersion,
- OptimizationId = optimizationId,
- OptimizationName = scope.OptimizationName ?? scope.OptimizationKey!,
- AppliedAt = DateTime.Now,
- Steps = steps,
- }
- ).ConfigureAwait(false);
+ optimizationId,
+ GetFilePath(optimizationId),
+ new RevertData
+ {
+ SchemaVersion = SchemaVersion,
+ OptimizationId = optimizationId,
+ OptimizationName = scope.OptimizationName ?? scope.OptimizationKey!,
+ AppliedAt = DateTime.Now,
+ Steps = steps,
+ }
+ )
+ .ConfigureAwait(false);
}
public async Task<RevertResult> RevertAsync(
@@ -147,10 +148,11 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _logge
if (!failedIndexes.Contains(idx))
{
await RemoveRevertStepAtIndexAsync(
- optimization.Id,
- optimization.OptimizationKey,
- idx
- ).ConfigureAwait(false);
+ optimization.Id,
+ optimization.OptimizationKey,
+ idx
+ )
+ .ConfigureAwait(false);
}
}
}
@@ -230,11 +232,8 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _logge
lockObj.Release();
}
}
- public async Task RemoveRevertStepAtIndexAsync(
- Guid id,
- string? name,
- int stepIndex
- )
+
+ public async Task RemoveRevertStepAtIndexAsync(Guid id, string? name, int stepIndex)
{
if (stepIndex <= 0)
return;
@@ -275,7 +274,6 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _logge
}
}
-
public static async Task<bool> IsAppliedAsync(Guid id)
{
var data = await LoadAsync(GetFilePath(id)).ConfigureAwait(false);
@@ -354,10 +352,20 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _logge
return null;
}
- var canonicalRevertDir = Path.GetFullPath(revertDir).TrimEnd(Path.DirectorySeparatorChar);
+ var canonicalRevertDir = Path.GetFullPath(revertDir)
+ .TrimEnd(Path.DirectorySeparatorChar);
var canonicalPath = Path.GetFullPath(resolvedPath);
- if (!canonicalPath.StartsWith(canonicalRevertDir + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase)
- && !string.Equals(canonicalPath, canonicalRevertDir, StringComparison.OrdinalIgnoreCase))
+ if (
+ !canonicalPath.StartsWith(
+ canonicalRevertDir + Path.DirectorySeparatorChar,
+ StringComparison.OrdinalIgnoreCase
+ )
+ && !string.Equals(
+ canonicalPath,
+ canonicalRevertDir,
+ StringComparison.OrdinalIgnoreCase
+ )
+ )
{
LogCorruptRevertFile(
logger,
@@ -415,13 +423,9 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _logge
}
else
{
- Serilog.Log.ForContext<RevertManager>()
- .Warning(
- ex,
- "Corrupt or invalid revert file {Path}: {Message}",
- path,
- ex.Message
- );
+ Serilog
+ .Log.ForContext<RevertManager>()
+ .Warning(ex, "Corrupt or invalid revert file {Path}: {Message}", path, ex.Message);
}
}
@@ -585,7 +589,8 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _logge
}
catch (Exception ex)
{
- Serilog.Log.ForContext<RevertManager>()
+ Serilog
+ .Log.ForContext<RevertManager>()
.Warning(
ex,
"Failed to register revert step {Type}: {Message}",
diff --git a/optimizerDuck/Services/System/SystemInfoService.cs b/optimizerDuck/Services/System/SystemInfoService.cs
index ad77e28..4cb74f3 100644
--- a/optimizerDuck/Services/System/SystemInfoService.cs
+++ b/optimizerDuck/Services/System/SystemInfoService.cs
@@ -2218,7 +2218,8 @@ public sealed class SystemInfoService : IDisposable
var osTask = Task.Run(OsProvider.Get, ct);
var biosTask = Task.Run(BiosProvider.Get, ct);
- await Task.WhenAll(cpuTask, ramTask, gpusTask, diskTask, osTask, biosTask).ConfigureAwait(false);
+ await Task.WhenAll(cpuTask, ramTask, gpusTask, diskTask, osTask, biosTask)
+ .ConfigureAwait(false);
_cachedCpu = await cpuTask.ConfigureAwait(false);
_cachedOs = await osTask.ConfigureAwait(false);
diff --git a/optimizerDuck/Services/UI/BloatwareService.cs b/optimizerDuck/Services/UI/BloatwareService.cs
index ab0652d..8e49c0b 100644
--- a/optimizerDuck/Services/UI/BloatwareService.cs
+++ b/optimizerDuck/Services/UI/BloatwareService.cs
@@ -154,6 +154,7 @@ public class BloatwareService(
@"^[a-zA-Z0-9._\-]+_[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+_[a-zA-Z0-9_]+__[a-zA-Z0-9_]+$",
RegexOptions.Compiled
);
+
/// <summary>
/// Validates whether an AppX package has standard, safe identifiers.
/// </summary>
@@ -168,7 +169,6 @@ public class BloatwareService(
return nameValid && fullNameValid;
}
-
/// <summary>
/// Escapes a string value for safe embedding in a PowerShell single-quoted string literal.
/// Single quotes in PowerShell do not evaluate variables or subexpressions.
diff --git a/optimizerDuck/UI/Controls/EmptyStateView.xaml b/optimizerDuck/UI/Controls/EmptyStateView.xaml
new file mode 100644
index 0000000..7d0fc71
--- /dev/null
+++ b/optimizerDuck/UI/Controls/EmptyStateView.xaml
@@ -0,0 +1,34 @@
+<UserControl
+ x:Class="optimizerDuck.UI.Controls.EmptyStateView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ x:Name="EmptyRoot">
+ <StackPanel Style="{StaticResource EmptyStatePanelStyle}">
+ <ui:SymbolIcon
+ Style="{StaticResource EmptyStateIconStyle}"
+ Symbol="{Binding Symbol, ElementName=EmptyRoot}" />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ Style="{StaticResource SecondaryTextStyle}"
+ Text="{Binding Title, ElementName=EmptyRoot}"
+ TextAlignment="Center"
+ TextWrapping="Wrap"
+ Visibility="{Binding Title, ElementName=EmptyRoot, Converter={StaticResource NotNullToVisibilityConverter}}" />
+ <ui:TextBlock
+ Margin="0,6,0,0"
+ HorizontalAlignment="Center"
+ Style="{StaticResource CaptionTextStyle}"
+ Text="{Binding Description, ElementName=EmptyRoot}"
+ TextAlignment="Center"
+ TextWrapping="Wrap"
+ Visibility="{Binding Description, ElementName=EmptyRoot, Converter={StaticResource NotNullToVisibilityConverter}}" />
+ <ui:Button
+ Margin="0,12,0,0"
+ HorizontalAlignment="Center"
+ Command="{Binding ActionCommand, ElementName=EmptyRoot}"
+ CommandParameter="{Binding ActionCommandParameter, ElementName=EmptyRoot}"
+ Content="{Binding ActionButtonText, ElementName=EmptyRoot}"
+ Visibility="{Binding ActionButtonText, ElementName=EmptyRoot, Converter={StaticResource NotNullToVisibilityConverter}}" />
+ </StackPanel>
+</UserControl>
diff --git a/optimizerDuck/UI/Controls/EmptyStateView.xaml.cs b/optimizerDuck/UI/Controls/EmptyStateView.xaml.cs
new file mode 100644
index 0000000..2313741
--- /dev/null
+++ b/optimizerDuck/UI/Controls/EmptyStateView.xaml.cs
@@ -0,0 +1,94 @@
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using Wpf.Ui.Controls;
+
+namespace optimizerDuck.UI.Controls;
+
+public partial class EmptyStateView : UserControl
+{
+ public static readonly DependencyProperty SymbolProperty = DependencyProperty.Register(
+ nameof(Symbol),
+ typeof(SymbolRegular),
+ typeof(EmptyStateView),
+ new PropertyMetadata(SymbolRegular.SearchInfo24)
+ );
+
+ public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(
+ nameof(Title),
+ typeof(string),
+ typeof(EmptyStateView),
+ new PropertyMetadata(null)
+ );
+
+ public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register(
+ nameof(Description),
+ typeof(string),
+ typeof(EmptyStateView),
+ new PropertyMetadata(null)
+ );
+
+ public static readonly DependencyProperty ActionButtonTextProperty =
+ DependencyProperty.Register(
+ nameof(ActionButtonText),
+ typeof(string),
+ typeof(EmptyStateView),
+ new PropertyMetadata(null)
+ );
+
+ public static readonly DependencyProperty ActionCommandProperty = DependencyProperty.Register(
+ nameof(ActionCommand),
+ typeof(ICommand),
+ typeof(EmptyStateView),
+ new PropertyMetadata(null)
+ );
+
+ public static readonly DependencyProperty ActionCommandParameterProperty =
+ DependencyProperty.Register(
+ nameof(ActionCommandParameter),
+ typeof(object),
+ typeof(EmptyStateView),
+ new PropertyMetadata(null)
+ );
+
+ public EmptyStateView()
+ {
+ InitializeComponent();
+ }
+
+ public SymbolRegular Symbol
+ {
+ get => (SymbolRegular)GetValue(SymbolProperty);
+ set => SetValue(SymbolProperty, value);
+ }
+
+ public string? Title
+ {
+ get => (string?)GetValue(TitleProperty);
+ set => SetValue(TitleProperty, value);
+ }
+
+ public string? Description
+ {
+ get => (string?)GetValue(DescriptionProperty);
+ set => SetValue(DescriptionProperty, value);
+ }
+
+ public string? ActionButtonText
+ {
+ get => (string?)GetValue(ActionButtonTextProperty);
+ set => SetValue(ActionButtonTextProperty, value);
+ }
+
+ public ICommand? ActionCommand
+ {
+ get => (ICommand?)GetValue(ActionCommandProperty);
+ set => SetValue(ActionCommandProperty, value);
+ }
+
+ public object? ActionCommandParameter
+ {
+ get => GetValue(ActionCommandParameterProperty);
+ set => SetValue(ActionCommandParameterProperty, value);
+ }
+}
diff --git a/optimizerDuck/UI/Controls/LoadingStateOverlay.xaml b/optimizerDuck/UI/Controls/LoadingStateOverlay.xaml
new file mode 100644
index 0000000..029250d
--- /dev/null
+++ b/optimizerDuck/UI/Controls/LoadingStateOverlay.xaml
@@ -0,0 +1,33 @@
+<UserControl
+ x:Class="optimizerDuck.UI.Controls.LoadingStateOverlay"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ x:Name="LoadingRoot">
+ <Grid Visibility="{Binding IsLoading, ElementName=LoadingRoot, Converter={StaticResource BooleanToVisibilityConverter}}">
+ <Border
+ Background="{DynamicResource ApplicationBackgroundBrush}"
+ Opacity="0.85"
+ Visibility="{Binding DimBackground, ElementName=LoadingRoot, Converter={StaticResource BooleanToVisibilityConverter}}" />
+
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+ <ui:ProgressRing
+ Width="48"
+ Height="48"
+ Margin="0,0,0,16"
+ IsIndeterminate="True" />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ FontTypography="BodyStrong"
+ Text="{Binding Title, ElementName=LoadingRoot}"
+ Visibility="{Binding Title, ElementName=LoadingRoot, Converter={StaticResource NotNullToVisibilityConverter}}" />
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Text="{Binding Subtitle, ElementName=LoadingRoot}"
+ Visibility="{Binding Subtitle, ElementName=LoadingRoot, Converter={StaticResource NotNullToVisibilityConverter}}" />
+ </StackPanel>
+ </Grid>
+</UserControl>
diff --git a/optimizerDuck/UI/Controls/LoadingStateOverlay.xaml.cs b/optimizerDuck/UI/Controls/LoadingStateOverlay.xaml.cs
new file mode 100644
index 0000000..103b13b
--- /dev/null
+++ b/optimizerDuck/UI/Controls/LoadingStateOverlay.xaml.cs
@@ -0,0 +1,64 @@
+using System.Windows;
+using System.Windows.Controls;
+
+namespace optimizerDuck.UI.Controls;
+
+public partial class LoadingStateOverlay : UserControl
+{
+ public static readonly DependencyProperty IsLoadingProperty = DependencyProperty.Register(
+ nameof(IsLoading),
+ typeof(bool),
+ typeof(LoadingStateOverlay),
+ new PropertyMetadata(false)
+ );
+
+ public static readonly DependencyProperty DimBackgroundProperty = DependencyProperty.Register(
+ nameof(DimBackground),
+ typeof(bool),
+ typeof(LoadingStateOverlay),
+ new PropertyMetadata(false)
+ );
+
+ public bool DimBackground
+ {
+ get => (bool)GetValue(DimBackgroundProperty);
+ set => SetValue(DimBackgroundProperty, value);
+ }
+
+ public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(
+ nameof(Title),
+ typeof(string),
+ typeof(LoadingStateOverlay),
+ new PropertyMetadata(null)
+ );
+
+ public static readonly DependencyProperty SubtitleProperty = DependencyProperty.Register(
+ nameof(Subtitle),
+ typeof(string),
+ typeof(LoadingStateOverlay),
+ new PropertyMetadata(null)
+ );
+
+ public LoadingStateOverlay()
+ {
+ InitializeComponent();
+ }
+
+ public bool IsLoading
+ {
+ get => (bool)GetValue(IsLoadingProperty);
+ set => SetValue(IsLoadingProperty, value);
+ }
+
+ public string? Title
+ {
+ get => (string?)GetValue(TitleProperty);
+ set => SetValue(TitleProperty, value);
+ }
+
+ public string? Subtitle
+ {
+ get => (string?)GetValue(SubtitleProperty);
+ set => SetValue(SubtitleProperty, value);
+ }
+}
diff --git a/optimizerDuck/UI/Controls/RiskBadge.xaml b/optimizerDuck/UI/Controls/RiskBadge.xaml
new file mode 100644
index 0000000..7674a38
--- /dev/null
+++ b/optimizerDuck/UI/Controls/RiskBadge.xaml
@@ -0,0 +1,42 @@
+<UserControl
+ x:Class="optimizerDuck.UI.Controls.RiskBadge"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ x:Name="BadgeRoot">
+ <Border
+ Padding="6,2"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ CornerRadius="{StaticResource CornerRadiusSmall}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Risk, ElementName=BadgeRoot}" Value="Moderate">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Risk, ElementName=BadgeRoot}" Value="Caution">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Risk, ElementName=BadgeRoot}" Value="Risky">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Symbol="{Binding RiskVisual.Icon, ElementName=BadgeRoot}" />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Text="{Binding RiskVisual.Display, ElementName=BadgeRoot}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </Border>
+</UserControl>
diff --git a/optimizerDuck/UI/Controls/RiskBadge.xaml.cs b/optimizerDuck/UI/Controls/RiskBadge.xaml.cs
new file mode 100644
index 0000000..dd499e7
--- /dev/null
+++ b/optimizerDuck/UI/Controls/RiskBadge.xaml.cs
@@ -0,0 +1,39 @@
+using System.Windows;
+using System.Windows.Controls;
+using optimizerDuck.Domain.UI;
+
+namespace optimizerDuck.UI.Controls;
+
+public partial class RiskBadge : UserControl
+{
+ public static readonly DependencyProperty RiskProperty = DependencyProperty.Register(
+ nameof(Risk),
+ typeof(object),
+ typeof(RiskBadge),
+ new PropertyMetadata(null)
+ );
+
+ public static readonly DependencyProperty RiskVisualProperty = DependencyProperty.Register(
+ nameof(RiskVisual),
+ typeof(RiskVisual),
+ typeof(RiskBadge),
+ new PropertyMetadata(null)
+ );
+
+ public RiskBadge()
+ {
+ InitializeComponent();
+ }
+
+ public object? Risk
+ {
+ get => GetValue(RiskProperty);
+ set => SetValue(RiskProperty, value);
+ }
+
+ public RiskVisual? RiskVisual
+ {
+ get => (RiskVisual?)GetValue(RiskVisualProperty);
+ set => SetValue(RiskVisualProperty, value);
+ }
+}
diff --git a/optimizerDuck/UI/Controls/TaskStateBadge.xaml b/optimizerDuck/UI/Controls/TaskStateBadge.xaml
new file mode 100644
index 0000000..ae9ee4f
--- /dev/null
+++ b/optimizerDuck/UI/Controls/TaskStateBadge.xaml
@@ -0,0 +1,89 @@
+<UserControl
+ x:Class="optimizerDuck.UI.Controls.TaskStateBadge"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ x:Name="TaskStateRoot">
+ <Border
+ Padding="6,1"
+ VerticalAlignment="Center"
+ CornerRadius="{StaticResource CornerRadiusSmall}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Background" Value="{DynamicResource CardBackgroundFillColorSecondaryBrush}" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsReady, ElementName=TaskStateRoot}" Value="True">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsRunning, ElementName=TaskStateRoot}" Value="True">
+ <Setter Property="Background" Value="{DynamicResource AccentButtonBackground}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsEnabledState, ElementName=TaskStateRoot}" Value="True">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsEnabledState, ElementName=TaskStateRoot}" Value="False">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding State, ElementName=TaskStateRoot}" Value="Ready">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding State, ElementName=TaskStateRoot}" Value="Running">
+ <Setter Property="Background" Value="{DynamicResource AccentButtonBackground}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding State, ElementName=TaskStateRoot}" Value="Disabled">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ x:Name="StateIcon"
+ Margin="0,0,4,0"
+ FontSize="14">
+ <ui:SymbolIcon.Style>
+ <Style TargetType="ui:SymbolIcon">
+ <Setter Property="Symbol" Value="Circle24" />
+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsReady, ElementName=TaskStateRoot}" Value="True">
+ <Setter Property="Symbol" Value="CheckmarkCircle24" />
+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsRunning, ElementName=TaskStateRoot}" Value="True">
+ <Setter Property="Symbol" Value="Play24" />
+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsEnabledState, ElementName=TaskStateRoot}" Value="True">
+ <Setter Property="Symbol" Value="CheckmarkCircle24" />
+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsEnabledState, ElementName=TaskStateRoot}" Value="False">
+ <Setter Property="Symbol" Value="Dismiss24" />
+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding State, ElementName=TaskStateRoot}" Value="Ready">
+ <Setter Property="Symbol" Value="CheckmarkCircle24" />
+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding State, ElementName=TaskStateRoot}" Value="Running">
+ <Setter Property="Symbol" Value="Play24" />
+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding State, ElementName=TaskStateRoot}" Value="Disabled">
+ <Setter Property="Symbol" Value="Dismiss24" />
+ <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ui:SymbolIcon.Style>
+ </ui:SymbolIcon>
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ FontTypography="Caption"
+ Foreground="{Binding ElementName=StateIcon, Path=Foreground}"
+ Text="{Binding EffectiveStateDisplay, ElementName=TaskStateRoot}" />
+ </StackPanel>
+ </Border>
+</UserControl>
diff --git a/optimizerDuck/UI/Controls/TaskStateBadge.xaml.cs b/optimizerDuck/UI/Controls/TaskStateBadge.xaml.cs
new file mode 100644
index 0000000..14b81c6
--- /dev/null
+++ b/optimizerDuck/UI/Controls/TaskStateBadge.xaml.cs
@@ -0,0 +1,114 @@
+using System.Windows;
+using System.Windows.Controls;
+
+namespace optimizerDuck.UI.Controls;
+
+public partial class TaskStateBadge : UserControl
+{
+ public static readonly DependencyProperty StateProperty = DependencyProperty.Register(
+ nameof(State),
+ typeof(string),
+ typeof(TaskStateBadge),
+ new PropertyMetadata(null, OnStateOrEnabledChanged)
+ );
+
+ public static readonly DependencyProperty IsReadyProperty = DependencyProperty.Register(
+ nameof(IsReady),
+ typeof(bool),
+ typeof(TaskStateBadge),
+ new PropertyMetadata(false)
+ );
+
+ public static readonly DependencyProperty IsRunningProperty = DependencyProperty.Register(
+ nameof(IsRunning),
+ typeof(bool),
+ typeof(TaskStateBadge),
+ new PropertyMetadata(false)
+ );
+
+ public static readonly DependencyProperty IsDisabledStateProperty = DependencyProperty.Register(
+ nameof(IsDisabledState),
+ typeof(bool),
+ typeof(TaskStateBadge),
+ new PropertyMetadata(false)
+ );
+
+ public static readonly DependencyProperty IsEnabledStateProperty = DependencyProperty.Register(
+ nameof(IsEnabledState),
+ typeof(bool?),
+ typeof(TaskStateBadge),
+ new PropertyMetadata(null, OnStateOrEnabledChanged)
+ );
+
+ public static readonly DependencyProperty EffectiveStateDisplayProperty =
+ DependencyProperty.Register(
+ nameof(EffectiveStateDisplay),
+ typeof(string),
+ typeof(TaskStateBadge),
+ new PropertyMetadata(null)
+ );
+
+ public TaskStateBadge()
+ {
+ InitializeComponent();
+ }
+
+ public string? State
+ {
+ get => (string?)GetValue(StateProperty);
+ set => SetValue(StateProperty, value);
+ }
+
+ public bool IsReady
+ {
+ get => (bool)GetValue(IsReadyProperty);
+ set => SetValue(IsReadyProperty, value);
+ }
+
+ public bool IsRunning
+ {
+ get => (bool)GetValue(IsRunningProperty);
+ set => SetValue(IsRunningProperty, value);
+ }
+
+ public bool IsDisabledState
+ {
+ get => (bool)GetValue(IsDisabledStateProperty);
+ set => SetValue(IsDisabledStateProperty, value);
+ }
+
+ public bool? IsEnabledState
+ {
+ get => (bool?)GetValue(IsEnabledStateProperty);
+ set => SetValue(IsEnabledStateProperty, value);
+ }
+
+ public string? EffectiveStateDisplay
+ {
+ get => (string?)GetValue(EffectiveStateDisplayProperty);
+ private set => SetValue(EffectiveStateDisplayProperty, value);
+ }
+
+ private static void OnStateOrEnabledChanged(
+ DependencyObject d,
+ DependencyPropertyChangedEventArgs e
+ )
+ {
+ if (d is TaskStateBadge badge)
+ badge.UpdateEffectiveStateDisplay();
+ }
+
+ private void UpdateEffectiveStateDisplay()
+ {
+ if (IsEnabledState.HasValue)
+ {
+ EffectiveStateDisplay = IsEnabledState.Value
+ ? optimizerDuck.Resources.Languages.Translations.Common_Toggle_On
+ : optimizerDuck.Resources.Languages.Translations.Common_Toggle_Off;
+ }
+ else
+ {
+ EffectiveStateDisplay = State;
+ }
+ }
+}
diff --git a/optimizerDuck/UI/Controls/TriggerBadgeList.xaml b/optimizerDuck/UI/Controls/TriggerBadgeList.xaml
new file mode 100644
index 0000000..c9ecc03
--- /dev/null
+++ b/optimizerDuck/UI/Controls/TriggerBadgeList.xaml
@@ -0,0 +1,36 @@
+<UserControl
+ x:Class="optimizerDuck.UI.Controls.TriggerBadgeList"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ x:Name="TriggerListRoot">
+ <ItemsControl ItemsSource="{Binding ItemsSource, ElementName=TriggerListRoot}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel Orientation="Horizontal" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border
+ Margin="0,0,4,2"
+ Padding="6,2"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="{StaticResource CornerRadiusSmall}">
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Margin="0,0,4,0"
+ FontSize="12"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Symbol="Timer24" />
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Text="{Binding}" />
+ </StackPanel>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+</UserControl>
diff --git a/optimizerDuck/UI/Controls/TriggerBadgeList.xaml.cs b/optimizerDuck/UI/Controls/TriggerBadgeList.xaml.cs
new file mode 100644
index 0000000..ed29cc4
--- /dev/null
+++ b/optimizerDuck/UI/Controls/TriggerBadgeList.xaml.cs
@@ -0,0 +1,26 @@
+using System.Collections;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace optimizerDuck.UI.Controls;
+
+public partial class TriggerBadgeList : UserControl
+{
+ public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register(
+ nameof(ItemsSource),
+ typeof(IEnumerable),
+ typeof(TriggerBadgeList),
+ new PropertyMetadata(null)
+ );
+
+ public TriggerBadgeList()
+ {
+ InitializeComponent();
+ }
+
+ public IEnumerable? ItemsSource
+ {
+ get => (IEnumerable?)GetValue(ItemsSourceProperty);
+ set => SetValue(ItemsSourceProperty, value);
+ }
+}
diff --git a/optimizerDuck/UI/Dialogs/BloatwareConfirmationDialog.xaml b/optimizerDuck/UI/Dialogs/BloatwareConfirmationDialog.xaml
index 3a240e5..9328a66 100644
--- a/optimizerDuck/UI/Dialogs/BloatwareConfirmationDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/BloatwareConfirmationDialog.xaml
@@ -2,7 +2,7 @@
x:Class="optimizerDuck.UI.Dialogs.BloatwareConfirmationDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dialogVm="clr-namespace:optimizerDuck.UI.ViewModels.Dialogs"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
@@ -12,13 +12,6 @@
d:DesignHeight="520"
d:DesignWidth="900"
mc:Ignorable="d">
- <UserControl.Resources>
- <converters:NumericComparisonToVisibilityConverter
- x:Key="GreaterThanZeroToVisibilityConverter"
- ComparisonType="GreaterThan"
- Threshold="0" />
- <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
- </UserControl.Resources>
<Grid MinWidth="720">
<Grid.RowDefinitions>
@@ -62,14 +55,7 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
- <Border
- Grid.Column="0"
- MinWidth="34"
- Margin="0,0,12,0"
- Padding="6,2"
- VerticalAlignment="Top"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="{StaticResource CornerRadiusSmall}">
+ <Border Grid.Column="0" Style="{StaticResource IndexBadgeStyle}">
<ui:TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
@@ -96,8 +82,7 @@
Padding="4,1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="{StaticResource CornerRadiusSmall}">
+ Style="{StaticResource SubtlePillStyle}">
<ui:TextBlock
VerticalAlignment="Center"
Appearance="Tertiary"
@@ -105,37 +90,11 @@
Text="{Binding Package.Version}" />
</Border>
- <Border
+ <controls:RiskBadge
Margin="8,0,0,0"
- Padding="6,2"
- HorizontalAlignment="Left"
- CornerRadius="{StaticResource CornerRadiusSmall}"
- Visibility="{Binding Package.ShouldVisibleRisk, Converter={StaticResource BooleanToVisibilityConverter}}">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding Package.Risk}" Value="Caution">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,8,0"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Symbol="{Binding Package.RiskVisual.Icon}" />
-
- <ui:TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text="{Binding Package.RiskVisual.Display}"
- TextWrapping="Wrap" />
- </StackPanel>
- </Border>
+ Risk="{Binding Package.Risk}"
+ RiskVisual="{Binding Package.RiskVisual}"
+ Visibility="{Binding Package.ShouldVisibleRisk, Converter={StaticResource BooleanToVisibilityConverter}}" />
</DockPanel>
<ui:TextBlock
diff --git a/optimizerDuck/UI/Dialogs/BloatwareWarningDialog.xaml b/optimizerDuck/UI/Dialogs/BloatwareWarningDialog.xaml
index b048341..3df4eee 100644
--- a/optimizerDuck/UI/Dialogs/BloatwareWarningDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/BloatwareWarningDialog.xaml
@@ -2,7 +2,7 @@
x:Class="optimizerDuck.UI.Dialogs.BloatwareWarningDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dialogVm="clr-namespace:optimizerDuck.UI.ViewModels.Dialogs"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
@@ -12,13 +12,6 @@
d:DesignHeight="520"
d:DesignWidth="900"
mc:Ignorable="d">
- <UserControl.Resources>
- <converters:NumericComparisonToVisibilityConverter
- x:Key="GreaterThanZeroToVisibilityConverter"
- ComparisonType="GreaterThan"
- Threshold="0" />
- <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
- </UserControl.Resources>
<Grid MinWidth="720">
<Grid.RowDefinitions>
@@ -63,14 +56,7 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
- <Border
- Grid.Column="0"
- MinWidth="34"
- Margin="0,0,12,0"
- Padding="6,2"
- VerticalAlignment="Top"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="{StaticResource CornerRadiusSmall}">
+ <Border Grid.Column="0" Style="{StaticResource IndexBadgeStyle}">
<ui:TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
@@ -97,8 +83,7 @@
Padding="4,1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="{StaticResource CornerRadiusSmall}">
+ Style="{StaticResource SubtlePillStyle}">
<ui:TextBlock
VerticalAlignment="Center"
Appearance="Tertiary"
@@ -106,37 +91,11 @@
Text="{Binding Package.Version}" />
</Border>
- <Border
+ <controls:RiskBadge
Margin="8,0,0,0"
- Padding="6,2"
- HorizontalAlignment="Left"
- CornerRadius="{StaticResource CornerRadiusSmall}"
- Visibility="{Binding Package.ShouldVisibleRisk, Converter={StaticResource BooleanToVisibilityConverter}}">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding Package.Risk}" Value="Caution">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,8,0"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Symbol="{Binding Package.RiskVisual.Icon}" />
-
- <ui:TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text="{Binding Package.RiskVisual.Display}"
- TextWrapping="Wrap" />
- </StackPanel>
- </Border>
+ Risk="{Binding Package.Risk}"
+ RiskVisual="{Binding Package.RiskVisual}"
+ Visibility="{Binding Package.ShouldVisibleRisk, Converter={StaticResource BooleanToVisibilityConverter}}" />
</DockPanel>
<ui:TextBlock
diff --git a/optimizerDuck/UI/Dialogs/DiskCleanupConfirmationDialog.xaml b/optimizerDuck/UI/Dialogs/DiskCleanupConfirmationDialog.xaml
index a52c173..e6b07a3 100644
--- a/optimizerDuck/UI/Dialogs/DiskCleanupConfirmationDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/DiskCleanupConfirmationDialog.xaml
@@ -2,7 +2,6 @@
x:Class="optimizerDuck.UI.Dialogs.DiskCleanupConfirmationDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dialogVm="clr-namespace:optimizerDuck.UI.ViewModels.Dialogs"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
@@ -12,13 +11,6 @@
d:DesignHeight="500"
d:DesignWidth="700"
mc:Ignorable="d">
- <UserControl.Resources>
- <converters:NumericComparisonToVisibilityConverter
- x:Key="GreaterThanZeroToVisibilityConverter"
- ComparisonType="GreaterThan"
- Threshold="0" />
- <converters:SizeToBrushConverter x:Key="SizeToBrushConverter" />
- </UserControl.Resources>
<Grid MinWidth="560">
<Grid.RowDefinitions>
@@ -67,14 +59,7 @@
</Grid.ColumnDefinitions>
<!-- Index -->
- <Border
- Grid.Column="0"
- MinWidth="34"
- Margin="0,0,12,0"
- Padding="6,2"
- VerticalAlignment="Top"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="{StaticResource CornerRadiusSmall}">
+ <Border Grid.Column="0" Style="{StaticResource IndexBadgeStyle}">
<ui:TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
diff --git a/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml b/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml
index f6cb9eb..44e6615 100644
--- a/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml
@@ -2,7 +2,7 @@
x:Class="optimizerDuck.UI.Dialogs.OptimizationDetailsDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dialogVm="clr-namespace:optimizerDuck.UI.ViewModels.Dialogs"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
@@ -12,13 +12,6 @@
d:DesignHeight="760"
d:DesignWidth="760"
mc:Ignorable="d">
- <UserControl.Resources>
- <converters:ValueConditionToVisibilityConverter
- x:Key="NullToVisibilityConverter"
- ConditionType="IsNull"
- False="Visible"
- True="Collapsed" />
- </UserControl.Resources>
<StackPanel>
<Border
Margin="0,0,0,12"
@@ -56,10 +49,7 @@
</ui:VirtualizingItemsControl.ItemContainerStyle>
<ui:VirtualizingItemsControl.ItemTemplate>
<DataTemplate>
- <Border
- Padding="6,2"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="{StaticResource CornerRadiusSmall}">
+ <Border Style="{StaticResource SubtlePillStyle}">
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon
Margin="0,0,6,0"
@@ -80,35 +70,9 @@
Grid.Row="3"
Margin="0,4,0,0"
ColumnDefinitions="Auto,Auto,*">
- <Border
- Padding="6,4"
- HorizontalAlignment="Left"
- CornerRadius="{StaticResource CornerRadiusSmall}">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding Optimization.Risk}" Value="Moderate">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding Optimization.Risk}" Value="Risky">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Symbol="{Binding Optimization.RiskVisual.Icon}" />
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text="{Binding Optimization.RiskVisual.Display}" />
- </StackPanel>
- </Border>
+ <controls:RiskBadge
+ Risk="{Binding Optimization.Risk}"
+ RiskVisual="{Binding Optimization.RiskVisual}" />
<Border
Grid.Column="1"
diff --git a/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml b/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml
index 7143ca8..b43c9ec 100644
--- a/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml
@@ -2,7 +2,6 @@
x:Class="optimizerDuck.UI.Dialogs.OptimizationResultDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dialogVm="clr-namespace:optimizerDuck.UI.ViewModels.Dialogs"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
@@ -12,13 +11,6 @@
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
- <UserControl.Resources>
- <converters:ValueConditionToVisibilityConverter
- x:Key="NullToVisibilityConverter"
- ConditionType="IsNull"
- False="Visible"
- True="Collapsed" />
- </UserControl.Resources>
<Grid Style="{StaticResource DialogRootStyle}">
<StackPanel Style="{StaticResource DialogContentStackStyle}">
<!-- Header with failed count summary -->
diff --git a/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml b/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml
index f5a1de6..638eb85 100644
--- a/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml
@@ -12,10 +12,6 @@
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
- <UserControl.Resources>
- <converters:ProgressBarVisibilityConverter x:Key="ProgressBarVisibilityConverter" />
- </UserControl.Resources>
-
<StackPanel MinWidth="420">
<ui:TextBlock
Margin="0,0,0,12"
diff --git a/optimizerDuck/UI/Dialogs/ScheduledTaskDeleteDialog.xaml b/optimizerDuck/UI/Dialogs/ScheduledTaskDeleteDialog.xaml
index 2b42d78..f0812b8 100644
--- a/optimizerDuck/UI/Dialogs/ScheduledTaskDeleteDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/ScheduledTaskDeleteDialog.xaml
@@ -3,7 +3,6 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -13,10 +12,6 @@
d:DesignHeight="400"
d:DesignWidth="600"
mc:Ignorable="d">
- <UserControl.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BoolToVis" />
- <converters:InverseBooleanToVisibilityConverter x:Key="InverseBoolToVis" />
- </UserControl.Resources>
<Grid MinWidth="480">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -60,59 +55,12 @@
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<DockPanel LastChildFill="False">
<ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />
- <Border
+ <controls:TaskStateBadge
Margin="8,0,0,0"
- Padding="6,1"
- VerticalAlignment="Center"
- CornerRadius="4">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Background" Value="{DynamicResource CardBackgroundFillColorSecondaryBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsReady}" Value="True">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsRunning}" Value="True">
- <Setter Property="Background" Value="{DynamicResource AccentButtonBackground}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsDisabledState}" Value="True">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- x:Name="StateIcon"
- Margin="0,0,4,0"
- FontSize="10">
- <ui:SymbolIcon.Style>
- <Style TargetType="ui:SymbolIcon">
- <Setter Property="Symbol" Value="Circle24" />
- <Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsReady}" Value="True">
- <Setter Property="Symbol" Value="CheckmarkCircle24" />
- <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsRunning}" Value="True">
- <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
- <Setter Property="Symbol" Value="Play24" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsDisabledState}" Value="True">
- <Setter Property="Symbol" Value="Dismiss24" />
- <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ui:SymbolIcon.Style>
- </ui:SymbolIcon>
- <ui:TextBlock
- FontTypography="Caption"
- Foreground="{Binding ElementName=StateIcon, Path=Foreground}"
- Text="{Binding State}" />
- </StackPanel>
- </Border>
+ IsDisabledState="{Binding IsDisabledState}"
+ IsReady="{Binding IsReady}"
+ IsRunning="{Binding IsRunning}"
+ State="{Binding State}" />
</DockPanel>
<ui:TextBlock
diff --git a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml
index afa40aa..64eba6f 100644
--- a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml
@@ -3,7 +3,6 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -13,10 +12,6 @@
d:DesignHeight="700"
d:DesignWidth="760"
mc:Ignorable="d">
- <UserControl.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BoolToVis" />
- <converters:InverseBooleanToVisibilityConverter x:Key="InverseBoolToVis" />
- </UserControl.Resources>
<StackPanel>
<Border
Margin="0,0,0,12"
@@ -50,33 +45,19 @@
Margin="8,0,0,0"
Padding="6,1"
VerticalAlignment="Center"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4">
+ Style="{StaticResource SubtlePillStyle}">
<ui:TextBlock
VerticalAlignment="Center"
Appearance="Tertiary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Header.Title}" />
</Border>
- <Border
- x:Name="StateBorder"
+ <controls:TaskStateBadge
Margin="8,0,0,0"
- Padding="6,1"
- VerticalAlignment="Center"
- CornerRadius="4">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- x:Name="StateIcon"
- Margin="0,0,4,0"
- FontSize="10"
- Symbol="Circle24" />
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{Binding ElementName=StateIcon, Path=Foreground}"
- Text="{Binding State}" />
- </StackPanel>
- </Border>
+ IsDisabledState="{Binding IsDisabledState}"
+ IsReady="{Binding IsReady}"
+ IsRunning="{Binding IsRunning}"
+ State="{Binding State}" />
</DockPanel>
<ui:TextBlock
@@ -94,34 +75,7 @@
Text="{Binding FullPath}"
TextTrimming="CharacterEllipsis" />
- <ItemsControl Margin="0,6,0,0" ItemsSource="{Binding TriggerTypes}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border
- Margin="0,0,4,2"
- Padding="6,2"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,4,0"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Symbol="Timer24" />
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{Binding}" />
- </StackPanel>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
+ <controls:TriggerBadgeList Margin="0,6,0,0" ItemsSource="{Binding TriggerTypes}" />
</StackPanel>
</Grid>
</Border>
diff --git a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml.cs b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml.cs
index fbb59ee..7926686 100644
--- a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml.cs
+++ b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml.cs
@@ -1,10 +1,9 @@
-using System.Windows.Media;
-using Wpf.Ui.Controls;
+using System.Windows.Controls;
using ScheduledTaskModel = optimizerDuck.Domain.Optimizations.Models.ScheduledTask.ScheduledTaskModel;
namespace optimizerDuck.UI.Dialogs;
-public partial class ScheduledTaskDetailsDialog : System.Windows.Controls.UserControl
+public partial class ScheduledTaskDetailsDialog : UserControl
{
private ScheduledTaskModel? _taskModel;
@@ -19,42 +18,7 @@ public partial class ScheduledTaskDetailsDialog : System.Windows.Controls.UserCo
set
{
_taskModel = value;
- if (value == null)
- return;
-
DataContext = value;
-
- var backgroundBrushKey = value.State switch
- {
- "Ready" => "SystemFillColorSuccessBrush",
- "Running" => "AccentButtonBackground",
- "Disabled" => "SystemFillColorCautionBrush",
- _ => "CardBackgroundFillColorSecondaryBrush",
- };
-
- var iconSymbol = value.State switch
- {
- "Ready" => SymbolRegular.CheckmarkCircle24,
- "Running" => SymbolRegular.Play24,
- "Disabled" => SymbolRegular.Dismiss24,
- _ => SymbolRegular.Circle24,
- };
-
- var iconBrushKey = value.State switch
- {
- "Ready" => "TextFillColorInverseBrush",
- "Running" => "TextFillColorInverseBrush",
- "Disabled" => "TextFillColorInverseBrush",
- _ => "TextFillColorPrimaryBrush",
- };
-
- if (TryFindResource(backgroundBrushKey) is Brush backgroundBrush)
- StateBorder.Background = backgroundBrush;
-
- StateIcon.Symbol = iconSymbol;
-
- if (TryFindResource(iconBrushKey) is Brush iconBrush)
- StateIcon.Foreground = iconBrush;
}
}
}
diff --git a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml
index bec698d..4309919 100644
--- a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml
+++ b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml
@@ -3,7 +3,6 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -13,10 +12,6 @@
d:DesignHeight="520"
d:DesignWidth="620"
mc:Ignorable="d">
- <UserControl.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BoolToVis" />
- <converters:InverseBooleanToVisibilityConverter x:Key="InverseBoolToVis" />
- </UserControl.Resources>
<StackPanel MinWidth="540">
<Border
Margin="0,0,0,12"
@@ -50,27 +45,14 @@
Margin="8,0,0,0"
Padding="6,1"
VerticalAlignment="Center"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4">
+ Style="{StaticResource SubtlePillStyle}">
<ui:TextBlock
VerticalAlignment="Center"
Appearance="Tertiary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Header.Title}" />
</Border>
- <Border
- x:Name="TaskStateBadge"
- Margin="8,0,0,0"
- Padding="6,1"
- VerticalAlignment="Center"
- CornerRadius="4">
- <ui:TextBlock
- x:Name="TaskStateText"
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text="" />
- </Border>
+ <controls:TaskStateBadge Margin="8,0,0,0" IsEnabledState="{Binding IsEnabled}" />
</DockPanel>
<ui:TextBlock
@@ -89,35 +71,7 @@
Text="{Binding TaskPath}"
TextTrimming="CharacterEllipsis" />
- <ItemsControl Margin="0,6,0,0" ItemsSource="{Binding TriggerTypes}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border
- Margin="0,0,4,2"
- Padding="6,2"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,4,0"
- FontSize="14"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Symbol="Timer24" />
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{Binding}" />
- </StackPanel>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
+ <controls:TriggerBadgeList Margin="0,6,0,0" ItemsSource="{Binding TriggerTypes}" />
</StackPanel>
</Grid>
</Border>
diff --git a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml.cs b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml.cs
index 0166711..3c9efa3 100644
--- a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml.cs
+++ b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml.cs
@@ -1,25 +1,13 @@
-using System.Windows.Media;
-using optimizerDuck.Resources.Languages;
-using Wpf.Ui.Controls;
+using System.Windows.Controls;
using StartupTask = optimizerDuck.Domain.Optimizations.Models.StartupManager.StartupTask;
namespace optimizerDuck.UI.Dialogs;
-public partial class StartupTaskDetailsPanel : System.Windows.Controls.UserControl
+public partial class StartupTaskDetailsPanel : UserControl
{
public StartupTaskDetailsPanel(StartupTask task)
{
InitializeComponent();
-
DataContext = task;
-
- TaskStateText.Text = task.IsEnabled
- ? Translations.Common_Toggle_On
- : Translations.Common_Toggle_Off;
- var brushKey = task.IsEnabled
- ? "SystemFillColorSuccessBrush"
- : "SystemFillColorCriticalBrush";
- if (TryFindResource(brushKey) is Brush brush)
- TaskStateBadge.Background = brush;
}
}
diff --git a/optimizerDuck/UI/Pages/BloatwarePage.xaml b/optimizerDuck/UI/Pages/BloatwarePage.xaml
index c25e661..c45a580 100644
--- a/optimizerDuck/UI/Pages/BloatwarePage.xaml
+++ b/optimizerDuck/UI/Pages/BloatwarePage.xaml
@@ -1,9 +1,9 @@
-<Page
+<Page
x:Class="optimizerDuck.UI.Pages.BloatwarePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:bloatware1="clr-namespace:optimizerDuck.Domain.Optimizations.Models.Bloatware"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:local="clr-namespace:optimizerDuck.UI.Pages"
@@ -17,17 +17,6 @@
ui:Design.Foreground="White"
Style="{StaticResource PageRootStyle}"
mc:Ignorable="d">
- <Page.Resources>
- <converters:NumericComparisonToVisibilityConverter
- x:Key="GreaterThanZeroToVisibilityConverter"
- ComparisonType="GreaterThan"
- Threshold="0" />
- <converters:NumericComparisonToVisibilityConverter
- x:Key="ZeroToVisibilityConverter"
- ComparisonType="Equal"
- Threshold="0" />
- <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
- </Page.Resources>
<Grid RowDefinitions="Auto *">
<StackPanel Style="{StaticResource PageHeaderStyle}">
@@ -36,9 +25,15 @@
</StackPanel>
<!-- Empty (truly no packages installed) -->
- <Border Grid.Row="1">
- <Border.Style>
- <Style TargetType="Border">
+ <controls:EmptyStateView
+ Grid.Row="1"
+ ActionButtonText="{ext:Loc Bloatware.Menu.Refresh}"
+ ActionCommand="{Binding ViewModel.RefreshCommand}"
+ Description="{ext:Loc Bloatware.Empty.Description}"
+ Symbol="DeleteOff24"
+ Title="{ext:Loc Bloatware.Empty.Title}">
+ <controls:EmptyStateView.Style>
+ <Style TargetType="controls:EmptyStateView">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<MultiDataTrigger>
@@ -50,51 +45,15 @@
</MultiDataTrigger>
</Style.Triggers>
</Style>
- </Border.Style>
-
- <StackPanel Style="{StaticResource EmptyStatePanelStyle}">
- <ui:SymbolIcon Style="{StaticResource EmptyStateIconStyle}" Symbol="DeleteOff24" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="Subtitle"
- Text="{ext:Loc Bloatware.Empty.Title}" />
- <ui:TextBlock
- Margin="0,4,0,16"
- HorizontalAlignment="Center"
- Style="{StaticResource SecondaryTextStyle}"
- Text="{ext:Loc Bloatware.Empty.Description}" />
- <ui:Button
- HorizontalAlignment="Center"
- Appearance="Primary"
- Command="{Binding ViewModel.RefreshCommand}"
- Content="{ext:Loc Bloatware.Menu.Refresh}"
- Icon="{ui:SymbolIcon ArrowClockwise24,
- FontSize=18}" />
- </StackPanel>
- </Border>
+ </controls:EmptyStateView.Style>
+ </controls:EmptyStateView>
<!-- Loading -->
- <Border Grid.Row="1" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Width="48"
- Height="48"
- Margin="0,0,0,16"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsIndeterminate="True" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc Bloatware.Loading}" />
- <ui:TextBlock
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{ext:Loc Bloatware.Loading.Hint}" />
- </StackPanel>
- </Border>
+ <controls:LoadingStateOverlay
+ Grid.Row="1"
+ IsLoading="{Binding ViewModel.IsLoading}"
+ Subtitle="{ext:Loc Bloatware.Loading.Hint}"
+ Title="{ext:Loc Bloatware.Loading}" />
<Border Grid.Row="1" Visibility="{Binding ViewModel.HasData, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid RowDefinitions="Auto,Auto,*">
@@ -249,17 +208,11 @@
</StackPanel>
<!-- No search results -->
- <StackPanel
+ <controls:EmptyStateView
Grid.Row="2"
- Style="{StaticResource EmptyStatePanelStyle}"
- Visibility="{Binding ViewModel.AppxPackages.Count, Converter={StaticResource ZeroToVisibilityConverter}}">
- <ui:SymbolIcon Style="{StaticResource EmptyStateIconStyle}" Symbol="SearchInfo24" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="Body"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{ext:Loc Bloatware.Search.NoResults}" />
- </StackPanel>
+ Description="{ext:Loc Bloatware.Search.NoResults}"
+ Symbol="SearchInfo24"
+ Visibility="{Binding ViewModel.AppxPackages.Count, Converter={StaticResource ZeroToVisibilityConverter}}" />
<ItemsControl
Grid.Row="2"
@@ -318,8 +271,7 @@
Padding="4,1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="{StaticResource CornerRadiusSmall}">
+ Style="{StaticResource SubtlePillStyle}">
<!-- Version -->
<ui:TextBlock
VerticalAlignment="Center"
@@ -328,37 +280,11 @@
Text="{Binding Version}" />
</Border>
- <Border
+ <controls:RiskBadge
Margin="8,0,0,0"
- Padding="6,2"
- HorizontalAlignment="Left"
- CornerRadius="{StaticResource CornerRadiusSmall}"
- Visibility="{Binding ShouldVisibleRisk, Converter={StaticResource BooleanToVisibilityConverter}}">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding Risk}" Value="Caution">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,8,0"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Symbol="{Binding RiskVisual.Icon}" />
-
- <ui:TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text="{Binding RiskVisual.Display}"
- TextWrapping="Wrap" />
- </StackPanel>
- </Border>
+ Risk="{Binding Risk}"
+ RiskVisual="{Binding RiskVisual}"
+ Visibility="{Binding ShouldVisibleRisk, Converter={StaticResource BooleanToVisibilityConverter}}" />
</DockPanel>
<!-- Publisher -->
diff --git a/optimizerDuck/UI/Pages/Customize/Categories/CustomizeCategoryPage.xaml b/optimizerDuck/UI/Pages/Customize/Categories/CustomizeCategoryPage.xaml
index 0938485..f1a6c4a 100644
--- a/optimizerDuck/UI/Pages/Customize/Categories/CustomizeCategoryPage.xaml
+++ b/optimizerDuck/UI/Pages/Customize/Categories/CustomizeCategoryPage.xaml
@@ -2,6 +2,7 @@
x:Class="optimizerDuck.UI.Pages.Customize.CustomizeCategoryPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
@@ -18,7 +19,6 @@
Style="{StaticResource PageRootStyle}"
mc:Ignorable="d">
<Page.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<converters:EqualityToVisibilityConverter x:Key="EqualityToVisibilityConverter" />
<converters:RecommendationForegroundConverter x:Key="RecommendationForegroundConverter" />
<converters:ObjectToNullableDoubleConverter x:Key="ObjectToNullableDoubleConverter" />
@@ -68,7 +68,7 @@
ToolTipService.HasDropShadow="True"
ToolTipService.InitialShowDelay="50"
ToolTipService.Placement="Top"
- Visibility="{Binding HasRecommendation, Converter={StaticResource BoolToVisibilityConverter}}">
+ Visibility="{Binding HasRecommendation, Converter={StaticResource BooleanToVisibilityConverter}}">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
@@ -123,7 +123,7 @@
<StackPanel
Margin="0,4,0,0"
Orientation="Horizontal"
- Visibility="{Binding IsUnsupported, Converter={StaticResource BoolToVisibilityConverter}}">
+ Visibility="{Binding IsUnsupported, Converter={StaticResource BooleanToVisibilityConverter}}">
<ui:SymbolIcon
Margin="0,0,6,0"
VerticalAlignment="Center"
@@ -195,12 +195,11 @@
<ui:Button
Margin="8,0,0,0"
VerticalAlignment="Center"
- Background="Transparent"
- BorderBrush="Transparent"
Command="{Binding DataContext.ViewModel.ViewSourceOnGitHubCommand, RelativeSource={RelativeSource AncestorType=Page}}"
CommandParameter="{Binding}"
Cursor="Hand"
Icon="{ui:SymbolIcon Code24}"
+ Style="{StaticResource TransparentButtonStyle}"
ToolTip="{ext:Loc Optimizer.Menu.ViewSource}" />
</StackPanel>
</ui:CardControl>
@@ -304,7 +303,7 @@
</ui:VirtualizingItemsControl>
<!-- Unsupported Settings expander -->
- <ui:CardExpander Margin="0,0,0,20" Visibility="{Binding ViewModel.HasUnsupportedSettings, Converter={StaticResource BoolToVisibilityConverter}}">
+ <ui:CardExpander Margin="0,0,0,20" Visibility="{Binding ViewModel.HasUnsupportedSettings, Converter={StaticResource BooleanToVisibilityConverter}}">
<ui:CardExpander.Header>
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon
@@ -344,20 +343,9 @@
</StackPanel>
</ScrollViewer>
- <Border Grid.Row="2" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BoolToVisibilityConverter}}">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Width="48"
- Height="48"
- Margin="0,0,0,16"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsIndeterminate="True" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc Customize.Loading}" />
- </StackPanel>
- </Border>
+ <controls:LoadingStateOverlay
+ Grid.Row="2"
+ IsLoading="{Binding ViewModel.IsLoading}"
+ Title="{ext:Loc Customize.Loading}" />
</Grid>
</Page>
diff --git a/optimizerDuck/UI/Pages/Customize/CustomizePage.xaml b/optimizerDuck/UI/Pages/Customize/CustomizePage.xaml
index deab262..d29cf88 100644
--- a/optimizerDuck/UI/Pages/Customize/CustomizePage.xaml
+++ b/optimizerDuck/UI/Pages/Customize/CustomizePage.xaml
@@ -1,8 +1,8 @@
-<Page
+<Page
x:Class="optimizerDuck.UI.Pages.CustomizePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -17,10 +17,6 @@
ui:Design.Foreground="White"
Style="{StaticResource PageRootStyle}"
mc:Ignorable="d">
- <Page.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
- <converters:WidthToColumnConverter x:Key="WidthToColumnConverter" />
- </Page.Resources>
<Grid>
<Grid.RowDefinitions>
@@ -92,20 +88,9 @@
</ui:VirtualizingItemsControl.ItemTemplate>
</ui:VirtualizingItemsControl>
- <Border Grid.Row="1" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BoolToVisibilityConverter}}">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Width="48"
- Height="48"
- Margin="0,0,0,16"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsIndeterminate="True" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc Customize.Loading}" />
- </StackPanel>
- </Border>
+ <controls:LoadingStateOverlay
+ Grid.Row="1"
+ IsLoading="{Binding ViewModel.IsLoading}"
+ Title="{ext:Loc Customize.Loading}" />
</Grid>
</Page>
diff --git a/optimizerDuck/UI/Pages/DashboardPage.xaml b/optimizerDuck/UI/Pages/DashboardPage.xaml
index c4f86ec..da9b641 100644
--- a/optimizerDuck/UI/Pages/DashboardPage.xaml
+++ b/optimizerDuck/UI/Pages/DashboardPage.xaml
@@ -1,8 +1,8 @@
-<Page
+<Page
x:Class="optimizerDuck.UI.Pages.DashboardPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -16,43 +16,15 @@
ui:Design.Foreground="White"
Style="{StaticResource PageRootStyle}"
mc:Ignorable="d">
- <Page.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
- <converters:MBToGBConverter x:Key="MBToGBConverter" />
- <converters:ProgressBarValueToBrushConverter x:Key="ProgressBarValueToBrushConverter" />
- <converters:NumericComparisonToVisibilityConverter
- x:Key="GreaterThanOneToVisibilityConverter"
- ComparisonType="GreaterThan"
- Threshold="1" />
- <converters:MinusNumberConverter x:Key="MinusOneConverter" NumberToMinus="1" />
- <converters:ThemeToGitHubIconConverter x:Key="ThemeToGitHubIconConverter" />
- <converters:ValueConditionToVisibilityConverter
- x:Key="NullToVisibilityConverter"
- ConditionType="IsNull"
- False="Visible"
- True="Collapsed" />
- </Page.Resources>
<Grid RowDefinitions="Auto,Auto,*">
<!-- Loading Overlay -->
- <Grid
+ <controls:LoadingStateOverlay
Grid.RowSpan="3"
Panel.ZIndex="1000"
- Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BoolToVisibilityConverter}}">
- <Border Background="{DynamicResource ApplicationBackgroundBrush}" Opacity="0.8" />
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Width="60"
- Height="60"
- IsIndeterminate="True" />
- <ui:TextBlock
- Margin="0,16,0,0"
- HorizontalAlignment="Center"
- FontTypography="Subtitle"
- Text="{ext:Loc Dashboard.SystemInfo.Loading}"
- TextWrapping="Wrap" />
- </StackPanel>
- </Grid>
+ DimBackground="True"
+ IsLoading="{Binding ViewModel.IsLoading}"
+ Title="{ext:Loc Dashboard.SystemInfo.Loading}" />
<!-- Header -->
<StackPanel Style="{StaticResource PageHeaderStyle}">
@@ -460,10 +432,10 @@
VerticalAlignment="Center"
Background="{DynamicResource SystemFillColorAttentionBrush}"
CornerRadius="{StaticResource CornerRadiusSmall}"
- Visibility="{Binding IsSystemDrive, Converter={StaticResource BoolToVisibilityConverter}}">
+ Visibility="{Binding IsSystemDrive, Converter={StaticResource BooleanToVisibilityConverter}}">
<ui:TextBlock
FontTypography="Caption"
- Foreground="Black"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
Text="{ext:Loc Dashboard.SystemInfo.Storage.System}" />
</Border>
diff --git a/optimizerDuck/UI/Pages/DiskCleanupPage.xaml b/optimizerDuck/UI/Pages/DiskCleanupPage.xaml
index ae5490c..e5f98f3 100644
--- a/optimizerDuck/UI/Pages/DiskCleanupPage.xaml
+++ b/optimizerDuck/UI/Pages/DiskCleanupPage.xaml
@@ -3,7 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cleanup1="clr-namespace:optimizerDuck.Domain.Optimizations.Models.Cleanup"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:local="clr-namespace:optimizerDuck.UI.Pages"
@@ -19,13 +19,6 @@
Style="{StaticResource PageRootStyle}"
mc:Ignorable="d">
<Page.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
- <converters:BooleanToVisibilityConverter
- x:Key="InverseBooleanToVisibilityConverter"
- False="Visible"
- True="Collapsed" />
- <converters:SizeToBrushConverter x:Key="SizeToBrushConverter" />
-
<!-- Clickable Name Style -->
<Style
x:Key="ClickableNameStyle"
@@ -57,25 +50,11 @@
</StackPanel>
<!-- Loading State -->
- <Border Grid.Row="1" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Width="48"
- Height="48"
- Margin="0,0,0,16"
- IsIndeterminate="True" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc DiskCleanup.Loading}" />
- <ui:TextBlock
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{ext:Loc DiskCleanup.Header.Description}" />
- </StackPanel>
- </Border>
+ <controls:LoadingStateOverlay
+ Grid.Row="1"
+ IsLoading="{Binding ViewModel.IsLoading}"
+ Subtitle="{ext:Loc DiskCleanup.Header.Description}"
+ Title="{ext:Loc DiskCleanup.Loading}" />
<!-- Main Content -->
<Grid
diff --git a/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml b/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml
index 2509946..1ab6f7e 100644
--- a/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml
+++ b/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml
@@ -1,8 +1,8 @@
-<Page
+<Page
x:Class="optimizerDuck.UI.Pages.Optimizations.OptimizationPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -17,28 +17,6 @@
ui:Design.Foreground="White"
Style="{StaticResource PageRootStyle}"
mc:Ignorable="d">
- <Page.Resources>
- <converters:WidthToColumnConverter x:Key="WidthToColumnConverter" />
- <converters:NumericComparisonToVisibilityConverter
- x:Key="ZeroToVisibilityConverter"
- ComparisonType="Equal"
- Threshold="0" />
- <converters:NumericComparisonToVisibilityConverter
- x:Key="GreaterThanZeroToVisibilityConverter"
- ComparisonType="GreaterThan"
- Threshold="0" />
- <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
- <converters:InverseBooleanConverter x:Key="InverseBooleanConverter" />
- <converters:BooleanToVisibilityConverter
- x:Key="InverseBooleanToVisibilityConverter"
- False="Visible"
- True="Collapsed" />
- <converters:ValueConditionToVisibilityConverter
- x:Key="NullToVisibilityConverter"
- ConditionType="IsNull"
- False="Visible"
- True="Collapsed" />
- </Page.Resources>
<Grid>
<!-- Main Content -->
@@ -170,23 +148,11 @@
</Border>
<!-- No search results -->
- <StackPanel
+ <controls:EmptyStateView
Grid.Row="1"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Visibility="{Binding ViewModel.Optimizations.Count, Converter={StaticResource ZeroToVisibilityConverter}}">
- <ui:SymbolIcon
- Margin="0,0,0,10"
- HorizontalAlignment="Center"
- FontSize="36"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Symbol="SearchInfo24" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="Body"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{ext:Loc Bloatware.Search.NoResults}" />
- </StackPanel>
+ Description="{ext:Loc Bloatware.Search.NoResults}"
+ Symbol="SearchInfo24"
+ Visibility="{Binding ViewModel.Optimizations.Count, Converter={StaticResource ZeroToVisibilityConverter}}" />
<!-- Optimization Cards -->
<ui:VirtualizingItemsControl
@@ -382,38 +348,7 @@
VerticalAlignment="Bottom"
ColumnDefinitions="*,Auto">
<Grid RowDefinitions="Auto,Auto">
- <Border
- Padding="6,2"
- HorizontalAlignment="Left"
- CornerRadius="{StaticResource CornerRadiusSmall}">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding Risk}" Value="Moderate">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding Risk}" Value="Risky">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Symbol="{Binding RiskVisual.Icon}" />
-
- <ui:TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text="{Binding RiskVisual.Display}"
- TextWrapping="Wrap" />
- </StackPanel>
- </Border>
+ <controls:RiskBadge HorizontalAlignment="Left" Risk="{Binding Risk}" RiskVisual="{Binding RiskVisual}" />
<Border
Grid.Row="1"
@@ -453,23 +388,20 @@
<ui:Button
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
- Background="Transparent"
- BorderBrush="Transparent"
Command="{Binding DataContext.ViewModel.ViewSourceOnGitHubCommand, RelativeSource={RelativeSource AncestorType=Page}}"
CommandParameter="{Binding}"
Cursor="Hand"
Icon="{ui:SymbolIcon Code24}"
+ Style="{StaticResource TransparentButtonStyle}"
ToolTip="{ext:Loc Optimizer.Menu.ViewSource}" />
<ui:Button
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
- Appearance="Transparent"
- Background="Transparent"
- BorderBrush="Transparent"
Command="{Binding DataContext.ViewModel.ShowDetailsCommand, RelativeSource={RelativeSource AncestorType=Page}}"
CommandParameter="{Binding}"
Cursor="Hand"
- Icon="{ui:SymbolIcon MoreVertical24}" />
+ Icon="{ui:SymbolIcon MoreVertical24}"
+ Style="{StaticResource TransparentButtonStyle}" />
</StackPanel>
</Grid>
</Grid>
@@ -481,26 +413,9 @@
</Grid>
<!-- Loading Indicator -->
- <Border Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Width="48"
- Height="48"
- Margin="0,0,0,16"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsIndeterminate="True" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc Optimizations.Loading}" />
- <ui:TextBlock
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{ext:Loc Optimizations.Loading.Hint}" />
- </StackPanel>
- </Border>
+ <controls:LoadingStateOverlay
+ IsLoading="{Binding ViewModel.IsLoading}"
+ Subtitle="{ext:Loc Optimizations.Loading.Hint}"
+ Title="{ext:Loc Optimizations.Loading}" />
</Grid>
</Page>
diff --git a/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml b/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml
index 7254ec3..d2103f1 100644
--- a/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml
+++ b/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml
@@ -1,8 +1,8 @@
-<Page
+<Page
x:Class="optimizerDuck.UI.Pages.ScheduledTasksPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:local="clr-namespace:optimizerDuck.UI.Pages"
@@ -17,18 +17,6 @@
ui:Design.Foreground="White"
Style="{StaticResource PageRootStyle}"
mc:Ignorable="d">
- <Page.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
- <BooleanToVisibilityConverter x:Key="WpfBoolToVis" />
- <converters:NumericComparisonToVisibilityConverter
- x:Key="ZeroToVisibilityConverter"
- ComparisonType="Equal"
- Threshold="0" />
- <converters:NumericComparisonToVisibilityConverter
- x:Key="GreaterThanZeroToVisibilityConverter"
- ComparisonType="GreaterThan"
- Threshold="0" />
- </Page.Resources>
<Grid RowDefinitions="Auto, *">
<!-- Header -->
@@ -67,27 +55,11 @@
</StackPanel>
<!-- Loading Indicator -->
- <Border Grid.Row="1" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Width="48"
- Height="48"
- Margin="0,0,0,16"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsIndeterminate="True" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc ScheduledTasks.Loading}" />
- <ui:TextBlock
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{ext:Loc ScheduledTasks.Loading.Hint}" />
- </StackPanel>
- </Border>
+ <controls:LoadingStateOverlay
+ Grid.Row="1"
+ IsLoading="{Binding ViewModel.IsLoading}"
+ Subtitle="{ext:Loc ScheduledTasks.Loading.Hint}"
+ Title="{ext:Loc ScheduledTasks.Loading}" />
<!-- Main Content -->
<Grid Grid.Row="1">
@@ -180,16 +152,11 @@
</Border>
<!-- No search results -->
- <StackPanel
+ <controls:EmptyStateView
Grid.Row="1"
- Style="{StaticResource EmptyStatePanelStyle}"
- Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource ZeroToVisibilityConverter}}">
- <ui:SymbolIcon Style="{StaticResource EmptyStateIconStyle}" Symbol="SearchInfo24" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- Style="{StaticResource SecondaryTextStyle}"
- Text="{ext:Loc Bloatware.Search.NoResults}" />
- </StackPanel>
+ Description="{ext:Loc Bloatware.Search.NoResults}"
+ Symbol="SearchInfo24"
+ Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource ZeroToVisibilityConverter}}" />
<!-- Task List -->
<ItemsControl
@@ -231,60 +198,12 @@
<!-- Row 1: Name + State badge -->
<DockPanel LastChildFill="False">
<ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />
- <Border
+ <controls:TaskStateBadge
Margin="8,0,0,0"
- Padding="6,1"
- VerticalAlignment="Center"
- CornerRadius="4">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Background" Value="{DynamicResource CardBackgroundFillColorSecondaryBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsReady}" Value="True">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsRunning}" Value="True">
- <Setter Property="Background" Value="{DynamicResource AccentButtonBackground}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsDisabledState}" Value="True">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- x:Name="StateIcon"
- Margin="0,0,4,0"
- FontSize="14">
- <ui:SymbolIcon.Style>
- <Style TargetType="ui:SymbolIcon">
- <Setter Property="Symbol" Value="Circle24" />
- <Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsReady}" Value="True">
- <Setter Property="Symbol" Value="CheckmarkCircle24" />
- <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsRunning}" Value="True">
- <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
- <Setter Property="Symbol" Value="Play24" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsDisabledState}" Value="True">
- <Setter Property="Symbol" Value="Dismiss24" />
- <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ui:SymbolIcon.Style>
- </ui:SymbolIcon>
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{Binding ElementName=StateIcon, Path=Foreground}"
- Text="{Binding State}" />
- </StackPanel>
- </Border>
+ IsDisabledState="{Binding IsDisabledState}"
+ IsReady="{Binding IsReady}"
+ IsRunning="{Binding IsRunning}"
+ State="{Binding State}" />
</DockPanel>
<!-- Row 2: Description -->
@@ -303,34 +222,7 @@
Text="{Binding FullPath}" />
<!-- Row 4: Trigger badges -->
- <ItemsControl Margin="0,4,0,0" ItemsSource="{Binding TriggerTypes}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border
- Margin="0,0,4,2"
- Padding="6,2"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,4,0"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Symbol="Timer24" />
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{Binding}" />
- </StackPanel>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
+ <controls:TriggerBadgeList Margin="0,4,0,0" ItemsSource="{Binding TriggerTypes}" />
<!-- Row 5: Action summary -->
<ui:TextBlock
@@ -397,7 +289,7 @@
Icon="{ui:SymbolIcon Stop24,
FontSize=16}"
ToolTip="{ext:Loc ScheduledTasks.Action.Stop}"
- Visibility="{Binding IsRunning, Converter={StaticResource WpfBoolToVis}}" />
+ Visibility="{Binding IsRunning, Converter={StaticResource BooleanToVisibilityConverter}}" />
<ui:Button
Margin="0,0,8,0"
Padding="8"
diff --git a/optimizerDuck/UI/Pages/StartupManagerPage.xaml b/optimizerDuck/UI/Pages/StartupManagerPage.xaml
index 7c54d0a..e0253ca 100644
--- a/optimizerDuck/UI/Pages/StartupManagerPage.xaml
+++ b/optimizerDuck/UI/Pages/StartupManagerPage.xaml
@@ -1,8 +1,8 @@
-<Page
+<Page
x:Class="optimizerDuck.UI.Pages.StartupManagerPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
xmlns:local="clr-namespace:optimizerDuck.UI.Pages"
@@ -17,14 +17,6 @@
ui:Design.Foreground="White"
Style="{StaticResource PageRootStyle}"
mc:Ignorable="d">
- <Page.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
- <converters:NumericComparisonToVisibilityConverter
- x:Key="GreaterThanZeroToVisibilityConverter"
- ComparisonType="GreaterThan"
- Threshold="0" />
- <converters:EmptyWhileNotLoadingConverter x:Key="EmptyWhileNotLoadingConverter" />
- </Page.Resources>
<Grid RowDefinitions="Auto, *">
<!-- Header -->
@@ -55,32 +47,22 @@
</StackPanel>
<!-- Loading Indicator -->
- <Border Grid.Row="1" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Width="48"
- Height="48"
- Margin="0,0,0,16"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsIndeterminate="True" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc StartupManager.Loading}" />
- <ui:TextBlock
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{ext:Loc StartupManager.Loading.Hint}" />
- </StackPanel>
- </Border>
+ <controls:LoadingStateOverlay
+ Grid.Row="1"
+ IsLoading="{Binding ViewModel.IsLoading}"
+ Subtitle="{ext:Loc StartupManager.Loading.Hint}"
+ Title="{ext:Loc StartupManager.Loading}" />
<!-- Empty State (no data at all) -->
- <Border Grid.Row="1">
- <Border.Style>
- <Style TargetType="Border">
+ <controls:EmptyStateView
+ Grid.Row="1"
+ ActionButtonText="{ext:Loc StartupManager.Menu.Refresh}"
+ ActionCommand="{Binding ViewModel.RefreshCommand}"
+ Description="{ext:Loc StartupManager.Empty.Description}"
+ Symbol="AppGeneric24"
+ Title="{ext:Loc StartupManager.Empty.Title}">
+ <controls:EmptyStateView.Style>
+ <Style TargetType="controls:EmptyStateView">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<MultiDataTrigger>
@@ -92,34 +74,8 @@
</MultiDataTrigger>
</Style.Triggers>
</Style>
- </Border.Style>
-
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:SymbolIcon
- Margin="0,0,0,16"
- HorizontalAlignment="Center"
- FontSize="46"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Symbol="AppGeneric24" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="Subtitle"
- Text="{ext:Loc StartupManager.Empty.Title}" />
- <ui:TextBlock
- Margin="0,0,0,10"
- HorizontalAlignment="Center"
- FontTypography="Body"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{ext:Loc StartupManager.Empty.Description}" />
- <ui:Button
- HorizontalAlignment="Center"
- Appearance="Primary"
- Command="{Binding ViewModel.RefreshCommand}"
- Content="{ext:Loc StartupManager.Menu.Refresh}"
- Icon="{ui:SymbolIcon ArrowClockwise24,
- FontSize=18}" />
- </StackPanel>
- </Border>
+ </controls:EmptyStateView.Style>
+ </controls:EmptyStateView>
<!-- Main Content -->
<Border Grid.Row="1" Visibility="{Binding ViewModel.HasData, Converter={StaticResource BooleanToVisibilityConverter}}">
@@ -221,25 +177,14 @@
</Border>
<!-- No search results (Apps) -->
- <StackPanel Style="{StaticResource EmptyStatePanelStyle}">
- <StackPanel.Visibility>
+ <controls:EmptyStateView Description="{ext:Loc Bloatware.Search.NoResults}" Symbol="SearchInfo24">
+ <controls:EmptyStateView.Visibility>
<MultiBinding Converter="{StaticResource EmptyWhileNotLoadingConverter}">
<Binding Path="ViewModel.Apps.Count" />
<Binding Path="ViewModel.IsLoading" />
</MultiBinding>
- </StackPanel.Visibility>
- <ui:SymbolIcon
- Margin="0,0,0,10"
- HorizontalAlignment="Center"
- FontSize="36"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Symbol="SearchInfo24" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="Body"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{ext:Loc Bloatware.Search.NoResults}" />
- </StackPanel>
+ </controls:EmptyStateView.Visibility>
+ </controls:EmptyStateView>
<!-- Apps List -->
<ui:VirtualizingItemsControl ItemsSource="{Binding ViewModel.Apps}" Visibility="{Binding ViewModel.Apps.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">
@@ -279,8 +224,7 @@
Margin="8,0,0,0"
Padding="6,1"
VerticalAlignment="Center"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4">
+ Style="{StaticResource SubtlePillStyle}">
<ui:TextBlock
VerticalAlignment="Center"
Appearance="Tertiary"
@@ -333,8 +277,7 @@
Margin="8,0,0,0"
Padding="8,2"
VerticalAlignment="Center"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="10">
+ Style="{StaticResource SubtlePillStyle}">
<ui:TextBlock
VerticalAlignment="Center"
Appearance="Tertiary"
@@ -416,25 +359,14 @@
</Border>
<!-- No search results (Tasks) -->
- <StackPanel Style="{StaticResource EmptyStatePanelStyle}">
- <StackPanel.Visibility>
+ <controls:EmptyStateView Description="{ext:Loc Bloatware.Search.NoResults}" Symbol="SearchInfo24">
+ <controls:EmptyStateView.Visibility>
<MultiBinding Converter="{StaticResource EmptyWhileNotLoadingConverter}">
<Binding Path="ViewModel.Tasks.Count" />
<Binding Path="ViewModel.IsLoading" />
</MultiBinding>
- </StackPanel.Visibility>
- <ui:SymbolIcon
- Margin="0,0,0,10"
- HorizontalAlignment="Center"
- FontSize="36"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Symbol="SearchInfo24" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="Body"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{ext:Loc Bloatware.Search.NoResults}" />
- </StackPanel>
+ </controls:EmptyStateView.Visibility>
+ </controls:EmptyStateView>
<!-- Tasks List -->
<ui:VirtualizingItemsControl ItemsSource="{Binding ViewModel.Tasks}" Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">
@@ -478,35 +410,7 @@
FontTypography="Caption"
Foreground="{DynamicResource TextFillColorDisabledBrush}"
Text="{Binding TaskPath}" />
- <ItemsControl Margin="0,4,0,0" ItemsSource="{Binding TriggerTypes}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border
- Margin="0,0,4,2"
- Padding="6,2"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,4,0"
- FontSize="15"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Symbol="Timer24" />
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{Binding}" />
- </StackPanel>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
+ <controls:TriggerBadgeList Margin="0,4,0,0" ItemsSource="{Binding TriggerTypes}" />
<ui:TextBlock
Margin="0,2,0,0"
FontTypography="Caption"
diff --git a/optimizerDuck/UI/Styles/Converters.xaml b/optimizerDuck/UI/Styles/Converters.xaml
new file mode 100644
index 0000000..d251c93
--- /dev/null
+++ b/optimizerDuck/UI/Styles/Converters.xaml
@@ -0,0 +1,50 @@
+<ResourceDictionary
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters">
+
+ <!-- Boolean to Visibility Converters -->
+ <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
+ <converters:BooleanToVisibilityConverter x:Key="BoolToVis" />
+ <converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
+ <converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter" />
+ <converters:InverseBooleanToVisibilityConverter x:Key="InverseBoolToVis" />
+ <converters:InverseBooleanToVisibilityConverter x:Key="InverseBoolToVisibilityConverter" />
+ <converters:InverseBooleanConverter x:Key="InverseBooleanConverter" />
+
+ <!-- Numeric & Condition to Visibility Converters -->
+ <converters:NumericComparisonToVisibilityConverter
+ x:Key="GreaterThanZeroToVisibilityConverter"
+ ComparisonType="GreaterThan"
+ Threshold="0" />
+ <converters:NumericComparisonToVisibilityConverter
+ x:Key="GreaterThanOneToVisibilityConverter"
+ ComparisonType="GreaterThan"
+ Threshold="1" />
+ <converters:NumericComparisonToVisibilityConverter
+ x:Key="ZeroToVisibilityConverter"
+ ComparisonType="Equal"
+ Threshold="0" />
+ <converters:ValueConditionToVisibilityConverter x:Key="NotNullToVisibilityConverter" ConditionType="IsNotNull" />
+ <!-- Legacy key: existing consumers (AppliedAt, Error, Model) expect visible-when-non-null -->
+ <converters:ValueConditionToVisibilityConverter x:Key="NullToVisibilityConverter" ConditionType="IsNotNull" />
+ <converters:EmptyWhileNotLoadingConverter x:Key="EmptyWhileNotLoadingConverter" />
+
+ <!-- Progress & Size Converters -->
+ <converters:ProgressBarVisibilityConverter x:Key="ProgressBarVisibilityConverter" />
+ <converters:ProgressBarValueToBrushConverter x:Key="ProgressBarValueToBrushConverter" />
+ <converters:SizeToBrushConverter x:Key="SizeToBrushConverter" />
+
+ <!-- Type & Layout Converters -->
+ <converters:ObjectToNullableDoubleConverter x:Key="ObjectToNullableDoubleConverter" />
+ <converters:WidthToColumnConverter x:Key="WidthToColumnConverter" />
+ <converters:MBToGBConverter x:Key="MBToGBConverter" />
+ <converters:MinusNumberConverter x:Key="MinusNumberConverter" />
+ <converters:MinusNumberConverter x:Key="MinusOneConverter" NumberToMinus="1" />
+
+ <!-- Theme & Recommendation Converters -->
+ <converters:ThemeToGitHubIconConverter x:Key="ThemeToGitHubIconConverter" />
+ <converters:ThemeToIndexConverter x:Key="ThemeToIndexConverter" />
+ <converters:RecommendationForegroundConverter x:Key="RecommendationForegroundConverter" />
+
+</ResourceDictionary>
diff --git a/optimizerDuck/UI/Styles/FluentDesign.xaml b/optimizerDuck/UI/Styles/FluentDesign.xaml
index 5361147..e465e92 100644
--- a/optimizerDuck/UI/Styles/FluentDesign.xaml
+++ b/optimizerDuck/UI/Styles/FluentDesign.xaml
@@ -1,4 +1,4 @@
-<ResourceDictionary
+<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behaviors="clr-namespace:optimizerDuck.UI.Behaviors"
@@ -78,20 +78,6 @@
<Setter Property="BorderBrush" Value="{DynamicResource CardStrokeColorDefaultBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="{StaticResource CornerRadiusMedium}" />
- <Setter Property="Opacity" Value="1" />
- <Style.Triggers>
- <EventTrigger RoutedEvent="Loaded">
- <BeginStoryboard>
- <Storyboard>
- <DoubleAnimation
- Storyboard.TargetProperty="Opacity"
- From="0"
- To="1"
- Duration="0:0:0.16" />
- </Storyboard>
- </BeginStoryboard>
- </EventTrigger>
- </Style.Triggers>
</Style>
<Style x:Key="ListRowStyle" TargetType="Border">
@@ -110,6 +96,23 @@
<Setter Property="CornerRadius" Value="{StaticResource CornerRadiusSmall}" />
</Style>
+ <Style x:Key="IndexBadgeStyle" TargetType="Border">
+ <Setter Property="MinWidth" Value="34" />
+ <Setter Property="Margin" Value="0,0,12,0" />
+ <Setter Property="Padding" Value="6,2" />
+ <Setter Property="VerticalAlignment" Value="Top" />
+ <Setter Property="Background" Value="{DynamicResource CardBackgroundFillColorSecondaryBrush}" />
+ <Setter Property="CornerRadius" Value="{StaticResource CornerRadiusSmall}" />
+ </Style>
+
+ <Style
+ x:Key="TransparentButtonStyle"
+ BasedOn="{StaticResource DefaultUiButtonStyle}"
+ TargetType="ui:Button">
+ <Setter Property="Background" Value="Transparent" />
+ <Setter Property="BorderBrush" Value="Transparent" />
+ </Style>
+
<Style x:Key="RoundIconSurfaceStyle" TargetType="Border">
<Setter Property="Width" Value="40" />
<Setter Property="Height" Value="40" />
diff --git a/optimizerDuck/UI/ViewModels/Customize/CustomizeItemViewModel.cs b/optimizerDuck/UI/ViewModels/Customize/CustomizeItemViewModel.cs
index 90767c4..be7eb14 100644
--- a/optimizerDuck/UI/ViewModels/Customize/CustomizeItemViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Customize/CustomizeItemViewModel.cs
@@ -2,9 +2,9 @@ using System.Windows;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.Logging;
+using optimizerDuck.Common.Helpers;
using optimizerDuck.Domain.Abstractions;
using optimizerDuck.Domain.Conditions;
-using optimizerDuck.Common.Helpers;
using optimizerDuck.Domain.Customize.Models;
using optimizerDuck.Domain.Execution;
using optimizerDuck.Services.Configuration;
@@ -210,8 +210,8 @@ public partial class CustomizeItemViewModel(
}
// Only the refresh bookkeeping runs on the UI thread; the reads stay off it.
- IsEnabled = await Task.Run(
- () => setting.GetStateWithRetryAsync(maxRetries: 4, delayMs: 80)
+ IsEnabled = await Task.Run(() =>
+ setting.GetStateWithRetryAsync(maxRetries: 4, delayMs: 80)
);
var options = await Task.Run(() => setting.Options);
UpdateOptions(options);
@@ -332,8 +332,8 @@ public partial class CustomizeItemViewModel(
if (ControlType != CustomizeControlType.Toggle)
{
- var (options, current) = await Task.Run(
- () => (setting.Options, setting.CurrentValue)
+ var (options, current) = await Task.Run(() =>
+ (setting.Options, setting.CurrentValue)
);
UpdateOptions(options);
CurrentValue = current;
diff --git a/optimizerDuck/UI/ViewModels/Dialogs/DiskCleanupConfirmationDialogViewModel.cs b/optimizerDuck/UI/ViewModels/Dialogs/DiskCleanupConfirmationDialogViewModel.cs
index 38857cf..c24cc98 100644
--- a/optimizerDuck/UI/ViewModels/Dialogs/DiskCleanupConfirmationDialogViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Dialogs/DiskCleanupConfirmationDialogViewModel.cs
@@ -1,4 +1,4 @@
- using optimizerDuck.Domain.Optimizations.Models.Cleanup;
+using optimizerDuck.Domain.Optimizations.Models.Cleanup;
namespace optimizerDuck.UI.ViewModels.Dialogs;
diff --git a/optimizerDuck/UI/ViewModels/Pages/CustomizeCategoryViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/CustomizeCategoryViewModel.cs
index dcdcc8a..6d71158 100644
--- a/optimizerDuck/UI/ViewModels/Pages/CustomizeCategoryViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/CustomizeCategoryViewModel.cs
@@ -162,7 +162,9 @@ public partial class CustomizeCategoryViewModel : ViewModel
{
return new ObservableCollection<CustomizeSection>(
settings
- .GroupBy(f => string.IsNullOrEmpty(f.Section) ? Translations.Common_Other : f.Section)
+ .GroupBy(f =>
+ string.IsNullOrEmpty(f.Section) ? Translations.Common_Other : f.Section
+ )
.OrderBy(g => g.Key == Translations.Common_Other ? 1 : 0)
.ThenBy(g => g.Key)
.Select(g => new CustomizeSection
diff --git a/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
index 9d65ce1..6ae8a63 100644
--- a/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
@@ -68,7 +68,7 @@ public partial class SettingsViewModel(
new() { DisplayName = "Türkçe", Culture = new CultureInfo("tr-TR") },
new() { DisplayName = "עברית", Culture = new CultureInfo("he-IL") },
new() { DisplayName = "العربية", Culture = new CultureInfo("ar-SA") },
- new() { DisplayName = "Italiano", Culture = new CultureInfo("it-IT") },
+ new() { DisplayName = "Italiano", Culture = new CultureInfo("it-IT") },
new() { DisplayName = "Bahasa Indonesia", Culture = new CultureInfo("id-ID") },
];