Free, open-source Windows optimization tool for performance, privacy, and simplicity.
C# csharpdebloatdotnetgamingopen-sourceoptimizationoptimizeroptimizerduckperformanceprivacytweakertweakswindowswinui
docs + perf: add XML docs, inline comments, UI virtualization, and margin fixes
fatDuckfec2a86d1d5e
diff --git a/optimizerDuck/Domain/Execution/ExecutionScope.cs b/optimizerDuck/Domain/Execution/ExecutionScope.csindex 3492085..554b83d 100644--- a/optimizerDuck/Domain/Execution/ExecutionScope.cs+++ b/optimizerDuck/Domain/Execution/ExecutionScope.cs@@ -18,28 +18,49 @@ public sealed class ExecutionScope : IDisposableprivate bool _disposed;private int _stepIndex;+ /// <summary>Gets the current <see cref="ExecutionScope"/> for the ambient async context.</summary>+ /// <remarks>+ /// Backed by <see cref="AsyncLocal{T}"/>, this flows across async calls without requiring+ /// dependency injection. Provider services read <see cref="Current"/> to record revert steps.+ /// </remarks>public static ExecutionScope? Current => _current.Value;+ /// <summary>Gets the identifier of the optimization being executed.</summary>public Guid? OptimizationId { get; private init; }+ /// <summary>Gets the unique key of the optimization being executed.</summary>public string? OptimizationKey { get; private init; }+ /// <summary>Gets the display name of the optimization being executed.</summary>public string? OptimizationName { get; init; }+ /// <summary>Gets the logger instance for the current execution scope.</summary>public required ILogger Logger { get; init; }+ /// <summary>Gets all recorded execution steps in the order they were executed.</summary>+ /// <value>An <see cref="IReadOnlyList{T}"/> of <see cref="ExecutedStep"/> instances.</value>public IReadOnlyList<ExecutedStep> ExecutedSteps => _executedSteps.AsReadOnly();+ /// <summary>Gets the subset of steps that completed successfully.</summary>+ /// <value>An array of <see cref="ExecutedStep"/> instances where <see cref="ExecutedStep.Success"/> is <see langword="true"/>.</value>public IReadOnlyList<ExecutedStep> SuccessfulSteps =>_executedSteps.Where(s => s.Success).ToArray();+ /// <summary>Gets the subset of steps that failed.</summary>+ /// <value>An array of <see cref="ExecutedStep"/> instances where <see cref="ExecutedStep.Success"/> is <see langword="false"/>.</value>public IReadOnlyList<ExecutedStep> FailedSteps =>_executedSteps.Where(s => !s.Success).ToArray();+ /// <summary>Gets a value that indicates whether at least one step succeeded.</summary>+ /// <value><see langword="true"/> if any recorded step completed successfully; otherwise, <see langword="false"/>.</value>public bool HasSuccessfulSteps => _executedSteps.Any(s => s.Success);private bool LoggingOnly { get; init; }+ /// <summary>+ /// Releases the execution scope, logs execution statistics, and persists revert data+ /// if the scope is associated with an optimization that has successful steps.+ /// </summary>public void Dispose(){if (_disposed)@@ -80,6 +101,11 @@ public sealed class ExecutionScope : IDisposable_current.Value = null;}+ /// <summary>Creates a new execution scope for an optimization and sets it as the ambient scope.</summary>+ /// <param name="optimization">The optimization to execute.</param>+ /// <param name="logger">The logger instance for the scope.</param>+ /// <returns>A new <see cref="ExecutionScope"/> instance.</returns>+ /// <exception cref="InvalidOperationException">An execution scope is already active in the current async context.</exception>public static ExecutionScope Begin(IOptimization optimization, ILogger logger){if (_current.Value != null)@@ -103,6 +129,10 @@ public sealed class ExecutionScope : IDisposablereturn scope;}+ /// <summary>Creates a logging-only scope that records steps but does not persist revert data.</summary>+ /// <param name="logger">The logger instance for the scope.</param>+ /// <returns>A new <see cref="ExecutionScope"/> instance with <see cref="LoggingOnly"/> set to <see langword="true"/>.</returns>+ /// <exception cref="InvalidOperationException">An execution scope is already active in the current async context.</exception>public static ExecutionScope BeginForLogging(ILogger logger){if (_current.Value != null)@@ -123,6 +153,12 @@ public sealed class ExecutionScope : IDisposablereturn scope;}+ /// <summary>Creates a logging-only scope scoped to a specific optimization for diagnostic purposes.</summary>+ /// <param name="optimizationId">The identifier of the optimization.</param>+ /// <param name="optimizationKey">The unique key of the optimization.</param>+ /// <param name="logger">The logger instance for the scope.</param>+ /// <returns>A new <see cref="ExecutionScope"/> instance with <see cref="LoggingOnly"/> set to <see langword="true"/>.</returns>+ /// <exception cref="InvalidOperationException">An execution scope is already active in the current async context.</exception>public static ExecutionScope BeginForLogging(Guid optimizationId,string optimizationKey,@@ -147,6 +183,15 @@ public sealed class ExecutionScope : IDisposablereturn scope;}+ /// <summary>Creates a temporary scope used to re-capture revert steps during retry execution.</summary>+ /// <remarks>+ /// During retry, the original optimization context is not available, so+ /// <see cref="OptimizationId"/> is set to <see cref="Guid.Empty"/>. Captured steps are later+ /// re-assigned to the real scope via <see cref="RecordStepAtIndex"/>.+ /// </remarks>+ /// <param name="logger">The logger instance for the scope.</param>+ /// <returns>A new <see cref="ExecutionScope"/> instance with an empty optimization context.</returns>+ /// <exception cref="InvalidOperationException">An execution scope is already active in the current async context.</exception>public static ExecutionScope BeginForCapture(ILogger logger){if (_current.Value != null)@@ -166,6 +211,15 @@ public sealed class ExecutionScope : IDisposablereturn scope;}+ /// <summary>Records an execution step onto the ambient scope with auto-incremented index.</summary>+ /// <param name="name">The category name of the step (for example, "Registry", "Shell").</param>+ /// <param name="description">A human-readable description of what the step does.</param>+ /// <param name="success"><see langword="true"/> if the step completed successfully; otherwise, <see langword="false"/>.</param>+ /// <param name="revertStep">An optional <see cref="IRevertStep"/> that can undo this operation.</param>+ /// <param name="error">An optional error message that describes the failure.</param>+ /// <param name="retryAction">An optional asynchronous action that retries the failed step.</param>+ /// <param name="errorDetail">An optional detailed error string (for example, exception details).</param>+ /// <returns>The recorded <see cref="ExecutedStep"/>, or <see langword="null"/> if no ambient scope exists or the scope is logging-only.</returns>public static ExecutedStep? RecordStep(string name,string description,@@ -189,6 +243,16 @@ public sealed class ExecutionScope : IDisposable);}+ /// <summary>Records an execution step at a specific index, used during retry to preserve the original index layout.</summary>+ /// <param name="index">The explicit 1-based index for the step.</param>+ /// <param name="name">The category name of the step (for example, "Registry", "Shell").</param>+ /// <param name="description">A human-readable description of what the step does.</param>+ /// <param name="success"><see langword="true"/> if the step completed successfully; otherwise, <see langword="false"/>.</param>+ /// <param name="revertStep">An optional <see cref="IRevertStep"/> that can undo this operation.</param>+ /// <param name="error">An optional error message that describes the failure.</param>+ /// <param name="retryAction">An optional asynchronous action that retries the failed step.</param>+ /// <param name="errorDetail">An optional detailed error string (for example, exception details).</param>+ /// <returns>The recorded <see cref="ExecutedStep"/>, or <see langword="null"/> if no ambient scope exists or the scope is logging-only.</returns>public static ExecutedStep? RecordStepAtIndex(int index,string name,@@ -214,6 +278,9 @@ public sealed class ExecutionScope : IDisposable);}+ /// <summary>Records a service invocation in the execution statistics.</summary>+ /// <param name="serviceName">The name of the service that was invoked.</param>+ /// <param name="success"><see langword="true"/> if the service call succeeded; otherwise, <see langword="false"/>.</param>public static void Track(string serviceName, bool success){var scope = Current;@@ -232,14 +299,15 @@ public sealed class ExecutionScope : IDisposable);}+ /// <summary>Returns the list of step results for display in the UI.</summary>+ /// <returns>A <see cref="List{T}"/> of <see cref="OperationStepResult"/> instances.</returns>public List<OperationStepResult> GetStepResults(){return _executedSteps.Select(ToOperationStepResult).ToList();}- /// <summary>- /// Maps tracked execution steps to an <see cref="ApplyResult" /> for optimization handlers.- /// </summary>+ /// <summary>Maps the execution scope to a result for optimization apply handlers.</summary>+ /// <returns>An <see cref="ApplyResult"/> with <see cref="ApplyResult.Success"/> set to <see langword="true"/> if every step succeeded; otherwise, <see langword="false"/> with a failure message.</returns>public ApplyResult ToApplyResult(){var result = ToResult();@@ -248,6 +316,11 @@ public sealed class ExecutionScope : IDisposable: ApplyResult.False(result.Message);}+ /// <summary>Builds an <see cref="OptimizationResult"/> from the recorded steps.</summary>+ /// <returns>+ /// An <see cref="OptimizationResult"/> whose <see cref="OptimizationResult.Status"/> reflects whether+ /// all steps succeeded, some failed (partial), or all failed.+ /// </returns>public OptimizationResult ToResult(){var status = ResolveStatus();@@ -294,6 +367,8 @@ public sealed class ExecutionScope : IDisposableif (LoggingOnly)return null;+ // explicitIndex is used during retry to re-record a step at its original position+ // so the gap-and-index layout in the revert file stays consistentvar stepIndex = explicitIndex ?? ++_stepIndex;var step = new ExecutedStep(@@ -348,31 +423,51 @@ public sealed class ExecutionScope : IDisposable#region Logging+ /// <summary>Logs a message at the specified level through the ambient scope's logger.</summary>+ /// <param name="level">The log level.</param>+ /// <param name="message">The message template.</param>+ /// <param name="args">Optional format arguments.</param>public static void Log(LogLevel level, string message, params object[] args){Current?.Logger.Log(level, message, args);}+ /// <summary>Logs a debug-level message.</summary>+ /// <param name="message">The message template.</param>+ /// <param name="args">Optional format arguments.</param>public static void LogDebug(string message, params object[] args){Log(LogLevel.Debug, message, args);}+ /// <summary>Logs a trace-level message.</summary>+ /// <param name="message">The message template.</param>+ /// <param name="args">Optional format arguments.</param>public static void LogTrace(string message, params object[] args){Log(LogLevel.Trace, message, args);}+ /// <summary>Logs an informational message.</summary>+ /// <param name="message">The message template.</param>+ /// <param name="args">Optional format arguments.</param>public static void LogInfo(string message, params object[] args){Log(LogLevel.Information, message, args);}+ /// <summary>Logs a warning message.</summary>+ /// <param name="message">The message template.</param>+ /// <param name="args">Optional format arguments.</param>public static void LogWarning(string message, params object[] args){Log(LogLevel.Warning, message, args);}+ /// <summary>Logs an error message with an optional exception.</summary>+ /// <param name="ex">An optional exception that caused the error.</param>+ /// <param name="message">The message template.</param>+ /// <param name="args">Optional format arguments.</param>public static void LogError(Exception? ex, string message, params object[] args){Current?.Logger.LogError(ex, message, args);@@ -381,14 +476,18 @@ public sealed class ExecutionScope : IDisposable#endregion Logging}-/// <summary>-/// Represents a single step recorded during optimization execution.-/// </summary>+/// <summary>Represents a single step recorded during optimization execution.</summary>public sealed record ExecutedStep{- /// <summary>- /// Initializes a new instance of the <see cref="ExecutedStep" /> class.- /// </summary>+ /// <summary>Initializes a new instance of the <see cref="ExecutedStep"/> class.</summary>+ /// <param name="index">The 1-based index of the step in the execution sequence.</param>+ /// <param name="name">The category name of the step (for example, "Registry", "Shell").</param>+ /// <param name="description">A human-readable description of what the step did.</param>+ /// <param name="success"><see langword="true"/> if the step completed successfully; otherwise, <see langword="false"/>.</param>+ /// <param name="revertStep">An <see cref="IRevertStep"/> that can undo this operation, if applicable.</param>+ /// <param name="error">An error message if the step failed, or <see langword="null"/>.</param>+ /// <param name="retryAction">An optional asynchronous action to retry the step on failure.</param>+ /// <param name="errorDetail">An optional detailed error string (for example, exception details).</param>public ExecutedStep(int index,string name,diff --git a/optimizerDuck/Services/Optimization/OptimizationService.cs b/optimizerDuck/Services/Optimization/OptimizationService.csindex 4a6686c..88fe6c9 100644--- a/optimizerDuck/Services/Optimization/OptimizationService.cs+++ b/optimizerDuck/Services/Optimization/OptimizationService.cs@@ -251,6 +251,8 @@ public class OptimizationService(if (optimizations.Length == 0)return;+ // scan revert directory for which optimizations are currently applied+ // we infer applied state from file presence, not a databasevar revertFiles = await Task.Run(() =>{if (!Directory.Exists(Shared.RevertDirectory))@@ -390,7 +392,7 @@ public class OptimizationService(// Auto-persist recovered revert step if revertManager is availableif (- retriedStep?.RevertStep != null+ recoveredStep.RevertStep != null&& revertManager != null&& optimizationId.HasValue)@@ -401,7 +403,7 @@ public class OptimizationService(optimizationId.Value,optimizationKey ?? string.Empty,step.Index, // Use original failed step's index- retriedStep.RevertStep+ recoveredStep.RevertStep);}catch (Exception ex)diff --git a/optimizerDuck/Services/Optimization/Providers/RegistryService.cs b/optimizerDuck/Services/Optimization/Providers/RegistryService.csindex e1a1093..f21f02a 100644--- a/optimizerDuck/Services/Optimization/Providers/RegistryService.cs+++ b/optimizerDuck/Services/Optimization/Providers/RegistryService.cs@@ -696,6 +696,8 @@ public static class RegistryServicereturn (steps, !truncated);}+ // walks the full subkey tree to snapshot every value before deletion+ // depth and count limits prevent runaway recursion on massive hivesprivate static void BackupRegistryTreeRecursive(RegistryKey key,string keyPath,@@ -845,7 +847,8 @@ public static class RegistryServiceExecutionScope.RecordStep(Translations.Service_Registry_Name, path, false, null, uiReason);}- /// <summary>Creates registry subkeys and tracks which ones were newly created for revert cleanup.</summary>+ // walks each segment of the subkey path, creating missing segments one by one+ // only tracks the keys it actually creates so revert cleanup knows what to deleteprivate static RegistryKey CreateSubKeyTrack(RegistryKey root,string subPath,@@ -899,8 +902,8 @@ public static class RegistryService}}- /// <summary>Cleans up empty registry keys that were created during the apply operation.</summary>- /// <remarks>Only deletes keys that were created during apply (tracked in <paramref name="createdSubKeys" />) and are now completely empty — no values and no subkeys.</remarks>+ /// <summary>Removes empty registry keys that were created during an apply operation.</summary>+ /// <remarks>Only deletes keys that were created during apply (tracked in <paramref name="createdSubKeys"/>) and are now completely empty — no values and no subkeys. Sorts by path depth descending so child keys are deleted before parents.</remarks>/// <param name="createdSubKeys">The list of registry key paths that were created.</param>public static void CleanupEmptyKeys(IEnumerable<string> createdSubKeys){diff --git a/optimizerDuck/Services/Optimization/Providers/ShellService.cs b/optimizerDuck/Services/Optimization/Providers/ShellService.csindex 24138a1..aa51399 100644--- a/optimizerDuck/Services/Optimization/Providers/ShellService.cs+++ b/optimizerDuck/Services/Optimization/Providers/ShellService.cs@@ -63,8 +63,8 @@ public sealed class ShellPolicypublic static class ShellService{- private const int DefaultShellTimeoutMs = 120000; // 2 minutes- private const int ProcessGraceDrainMs = 2000; // 2 seconds+ private const int DefaultShellTimeoutMs = 120000;+ private const int ProcessGraceDrainMs = 2000;private static IOptionsMonitor<AppSettings>? _options;@@ -252,6 +252,7 @@ public static class ShellServicesuccess? null: () =>+ // wrapping sync Run in Task.Run because retry expects a Task<bool>Task.Run(() =>policy.IsSuccess(Run(fileName, arguments, command, serviceName, revertStep, policy)@@ -288,6 +289,7 @@ public static class ShellServicerevertStep,ex.Message,() =>+ // wrapping sync Run in Task.Run because retry expects a Task<bool>Task.Run(() =>policy.IsSuccess(Run(fileName, arguments, command, serviceName, revertStep, policy)@@ -691,6 +693,8 @@ public static class ShellServiceShellPolicy? policy = null){+ // -EncodedCommand avoids quoting/escaping issues+ // prefix forces UTF-8 output and silences progress stream clutter in stderrcommand ="$ProgressPreference='SilentlyContinue'; "+ "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; "diff --git a/optimizerDuck/Services/Revert/RevertManager.cs b/optimizerDuck/Services/Revert/RevertManager.csindex 5c5857c..5202b38 100644--- a/optimizerDuck/Services/Revert/RevertManager.cs+++ b/optimizerDuck/Services/Revert/RevertManager.cs@@ -34,6 +34,8 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _loggeif (successfulSteps.Count == 0)return;+ // rebuild the gap-and-index array from the 1-based step indexes+ // ExecutionScope uses 1-based indexes, but the array is 0-basedvar maxIndex = successfulSteps.Max(s => s.Index);var steps = new RevertStepData?[maxIndex];@@ -83,6 +85,7 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _loggeMessage = string.Format(Translations.Revert_Error_NoDataFound, optimization.Name),};+ // revert in reverse order (LIFO) so later steps don't depend on earlier onesvar failedSteps = new List<OperationStepResult>();var sortedSteps = steps.OrderByDescending(s => s.Index).ToList();var total = sortedSteps.Count;@@ -134,6 +137,8 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _logge}}+ // if at least one step reverted, remove the revert file so the optimization shows as not-applied+ // if all steps failed, leave the file in place for another attemptif (failedSteps.Count < total)RemoveRevertData(optimization.Id, optimization.OptimizationKey);@@ -185,6 +190,8 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _loggeSteps = Array.Empty<RevertStepData?>(),};+ // grow the array if needed so the index slot exists+ // gaps before this index remain nullif (data.Steps.Length < stepIndex){var newSteps = new RevertStepData?[stepIndex];@@ -292,6 +299,8 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _logge}}+ // write to .tmp then replace atomically so a crash mid-write doesn't corrupt the revert file+ // File.Replace is the .NET atomic swap for existing filesprivate static async Task WriteJsonAtomicAsync(string path, RevertData data){Directory.CreateDirectory(Path.GetDirectoryName(path)!);@@ -388,6 +397,8 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _logge}}+ // discover all IRevertStep implementations via reflection and map their Type string to a factory+ // each step type must expose a static FromData(JObject) method for deserializationprivate static Dictionary<string, Func<JObject, IRevertStep>> BuildStepRegistry(){var dict = new Dictionary<string, Func<JObject, IRevertStep>>();diff --git a/optimizerDuck/UI/Pages/DashboardPage.xaml b/optimizerDuck/UI/Pages/DashboardPage.xamlindex 797b3fe..11bbf5e 100644--- a/optimizerDuck/UI/Pages/DashboardPage.xaml+++ b/optimizerDuck/UI/Pages/DashboardPage.xaml@@ -160,7 +160,7 @@Padding="0"HorizontalScrollBarVisibility="Disabled"VerticalScrollBarVisibility="Auto">- <StackPanel Margin="0,0,12,0">+ <StackPanel Margin="0,0,0,0"><!-- System Info Cards --><UniformGrid Columns="2" Rows="2"><!-- Operating System -->diff --git a/optimizerDuck/UI/Pages/DiskCleanupPage.xaml b/optimizerDuck/UI/Pages/DiskCleanupPage.xamlindex a6f4fa7..0b60b0b 100644--- a/optimizerDuck/UI/Pages/DiskCleanupPage.xaml+++ b/optimizerDuck/UI/Pages/DiskCleanupPage.xaml@@ -164,22 +164,21 @@</Border><!-- Items List -->- <ItemsControl Grid.Row="1" ItemsSource="{Binding ViewModel.CleanupItems}">- <ItemsControl.Template>+ <ui:VirtualizingItemsControl Grid.Row="1" ItemsSource="{Binding ViewModel.CleanupItems}">+ <ui:VirtualizingItemsControl.Template><ControlTemplate TargetType="ItemsControl">- <ScrollViewer HorizontalScrollBarVisibility="Disabled">- <ItemsPresenter Margin="0,0,12,0" />+ <ScrollViewer CanContentScroll="True" HorizontalScrollBarVisibility="Disabled">+ <ItemsPresenter /></ScrollViewer></ControlTemplate>- </ItemsControl.Template>-- <ItemsControl.ItemsPanel>+ </ui:VirtualizingItemsControl.Template>+ <ui:VirtualizingItemsControl.ItemsPanel><ItemsPanelTemplate>- <VirtualizingStackPanel VirtualizingStackPanel.VirtualizationMode="Recycling" />+ <VirtualizingStackPanel IsVirtualizing="True" VirtualizationMode="Recycling" /></ItemsPanelTemplate>- </ItemsControl.ItemsPanel>+ </ui:VirtualizingItemsControl.ItemsPanel>- <ItemsControl.ItemTemplate>+ <ui:VirtualizingItemsControl.ItemTemplate><DataTemplate DataType="{x:Type cleanup1:CleanupItem}"><Border Style="{StaticResource ListRowStyle}"><Grid>@@ -218,7 +217,7 @@<StackPanel Grid.Column="2" VerticalAlignment="Center"><!-- Clickable Name --><ui:HyperlinkButton- Command="{Binding DataContext.ViewModel.OpenFolderCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"+ Command="{Binding DataContext.ViewModel.OpenFolderCommand, RelativeSource={RelativeSource AncestorType=ui:VirtualizingItemsControl}}"CommandParameter="{Binding}"IsEnabled="{Binding CanOpenFolder}"Style="{StaticResource ClickableNameStyle}">@@ -342,8 +341,8 @@</Grid></Border></DataTemplate>- </ItemsControl.ItemTemplate>- </ItemsControl>+ </ui:VirtualizingItemsControl.ItemTemplate>+ </ui:VirtualizingItemsControl></Grid></Grid></Page>diff --git a/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPage.xaml b/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPage.xamlindex e5a632b..97ece14 100644--- a/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPage.xaml+++ b/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPage.xaml@@ -122,11 +122,14 @@HorizontalScrollBarVisibility="Disabled"VerticalScrollBarVisibility="Auto"><!-- Sections -->- <ItemsControl- Margin="0,0,12,0"- ItemsSource="{Binding ViewModel.Sections}"- Style="{x:Null}">- <ItemsControl.ItemTemplate>+ <ui:VirtualizingItemsControl ItemsSource="{Binding ViewModel.Sections}" Style="{x:Null}">+ <ItemsControl.ItemsPanel>+ <ItemsPanelTemplate>+ <VirtualizingStackPanel IsVirtualizing="True" VirtualizationMode="Recycling" />+ </ItemsPanelTemplate>+ </ItemsControl.ItemsPanel>++ <ui:VirtualizingItemsControl.ItemTemplate><DataTemplate><StackPanel Margin="0,0,0,20"><ui:TextBlock Style="{StaticResource SectionHeaderStyle}" Text="{Binding Name}" />@@ -236,8 +239,8 @@</ItemsControl></StackPanel></DataTemplate>- </ItemsControl.ItemTemplate>- </ItemsControl>+ </ui:VirtualizingItemsControl.ItemTemplate>+ </ui:VirtualizingItemsControl></ScrollViewer><Border Grid.Row="2" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BoolToVisibilityConverter}}">diff --git a/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml b/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xamlindex 8a1f10c..b8d4bed 100644--- a/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml+++ b/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml@@ -202,7 +202,8 @@<ui:VirtualizingItemsControl.Template><ControlTemplate TargetType="ItemsControl"><ScrollViewer CanContentScroll="True" HorizontalScrollBarVisibility="Disabled">- <ItemsPresenter />+ <!--yeah -12 because <Setter Property="Margin" Value="0,0,12,12" /> -->+ <ItemsPresenter Margin="0,0,-12,0" /></ScrollViewer></ControlTemplate></ui:VirtualizingItemsControl.Template>diff --git a/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml b/optimizerDuck/UI/Pages/ScheduledTasksPage.xamlindex eb86751..f7e3586 100644--- a/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml+++ b/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml@@ -193,217 +193,227 @@</StackPanel><!-- Task List -->- <ScrollViewer Grid.Row="1" Margin="0,0,0,0">- <ItemsControl ItemsSource="{Binding ViewModel.Tasks}" Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">- <ItemsControl.ItemTemplate>- <DataTemplate DataType="{x:Type scheduledTask:ScheduledTaskModel}">- <Border Style="{StaticResource ListRowStyle}">- <Grid>- <Grid.ColumnDefinitions>- <ColumnDefinition Width="Auto" />- <ColumnDefinition Width="*" />- <ColumnDefinition Width="Auto" />- </Grid.ColumnDefinitions>+ <ui:VirtualizingItemsControl Grid.Row="1" ItemsSource="{Binding ViewModel.Tasks}" Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">+ <ui:VirtualizingItemsControl.Template>+ <ControlTemplate TargetType="ItemsControl">+ <ScrollViewer CanContentScroll="True" HorizontalScrollBarVisibility="Disabled">+ <ItemsPresenter />+ </ScrollViewer>+ </ControlTemplate>+ </ui:VirtualizingItemsControl.Template>+ <ui:VirtualizingItemsControl.ItemsPanel>+ <ItemsPanelTemplate>+ <VirtualizingStackPanel IsVirtualizing="True" VirtualizationMode="Recycling" />+ </ItemsPanelTemplate>+ </ui:VirtualizingItemsControl.ItemsPanel>+ <ui:VirtualizingItemsControl.ItemTemplate>+ <DataTemplate DataType="{x:Type scheduledTask:ScheduledTaskModel}">+ <Border Style="{StaticResource ListRowStyle}">+ <Grid>+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ <ColumnDefinition Width="Auto" />+ </Grid.ColumnDefinitions>- <!-- Task Logo -->- <Image- Grid.Column="0"- Width="36"- Height="36"- Margin="0,0,12,0"- VerticalAlignment="Center"- Source="{Binding LogoImage}"- Stretch="UniformToFill" />+ <!-- Task Logo -->+ <Image+ Grid.Column="0"+ Width="36"+ Height="36"+ Margin="0,0,12,0"+ VerticalAlignment="Center"+ Source="{Binding LogoImage}"+ Stretch="UniformToFill" />- <!-- Task info -->- <StackPanel- Grid.Column="1"- Margin="0,0,12,0"- VerticalAlignment="Center">- <!-- Row 1: Name + State badge -->- <DockPanel LastChildFill="False">- <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />- <Border- 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- VerticalAlignment="Center"- FontTypography="Caption"- Foreground="{Binding ElementName=StateIcon, Path=Foreground}"- Text="{Binding State}" />- </StackPanel>- </Border>- </DockPanel>-- <!-- Row 2: Description -->- <ui:TextBlock- Margin="0,4,0,0"- FontTypography="Caption"- Foreground="{DynamicResource TextFillColorSecondaryBrush}"- Text="{Binding Description}"- TextWrapping="Wrap" />-- <!-- Row 3: Path -->- <ui:TextBlock- Margin="0,2,0,0"- FontTypography="Caption"- Foreground="{DynamicResource TextFillColorDisabledBrush}"- 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>-- <!-- Row 5: Action summary -->- <ui:TextBlock- Margin="0,2,0,0"- FontTypography="Caption"- Foreground="{DynamicResource TextFillColorDisabledBrush}"- Text="{Binding ActionSummary}"- TextTrimming="CharacterEllipsis" />- </StackPanel>-- <!-- Actions -->- <StackPanel- Grid.Column="2"- VerticalAlignment="Center"- Orientation="Horizontal">- <ui:Button- Margin="0,0,4,0"- Padding="8"- Appearance="Transparent"- Command="{Binding DataContext.ViewModel.ViewDetailsCommand, RelativeSource={RelativeSource AncestorType=Page}}"- CommandParameter="{Binding}"- Cursor="Hand"- Icon="{ui:SymbolIcon Info24,- FontSize=16}"- ToolTip="{ext:Loc ScheduledTasks.Action.Details}" />- <!-- Run: visible only when not running -->- <ui:Button- Margin="0,0,4,0"- Padding="8"- Appearance="Transparent"- Command="{Binding DataContext.ViewModel.RunTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"- CommandParameter="{Binding}"- Cursor="Hand"- Icon="{ui:SymbolIcon Play24,- FontSize=16}"- ToolTip="{ext:Loc ScheduledTasks.Action.Run}">- <ui:Button.Style>- <Style BasedOn="{StaticResource {x:Type ui:Button}}" TargetType="ui:Button">- <Setter Property="Visibility" Value="Visible" />+ <!-- Task info -->+ <StackPanel+ Grid.Column="1"+ Margin="0,0,12,0"+ VerticalAlignment="Center">+ <!-- Row 1: Name + State badge -->+ <DockPanel LastChildFill="False">+ <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />+ <Border+ 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="Visibility" Value="Collapsed" />+ <Setter Property="Background" Value="{DynamicResource AccentButtonBackground}" />+ </DataTrigger>+ <DataTrigger Binding="{Binding IsDisabledState}" Value="True">+ <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" /></DataTrigger></Style.Triggers></Style>- </ui:Button.Style>- </ui:Button>- <!-- Stop: visible only when running -->- <ui:Button- Margin="0,0,4,0"- Padding="8"- Appearance="Transparent"- Command="{Binding DataContext.ViewModel.StopTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"- CommandParameter="{Binding}"- Cursor="Hand"- Icon="{ui:SymbolIcon Stop24,- FontSize=16}"- ToolTip="{ext:Loc ScheduledTasks.Action.Stop}"- Visibility="{Binding IsRunning, Converter={StaticResource WpfBoolToVis}}" />- <ui:Button- Margin="0,0,8,0"- Padding="8"- Appearance="Transparent"- Command="{Binding DataContext.ViewModel.DeleteTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"- CommandParameter="{Binding}"- Cursor="Hand"- Icon="{ui:SymbolIcon Delete24,- FontSize=16}"- ToolTip="{ext:Loc ScheduledTasks.Action.Delete}" />- <ui:ToggleSwitch- IsChecked="{Binding IsEnabled, Mode=TwoWay}"- OffContent="{ext:Loc Common.Toggle.Off}"- OnContent="{ext:Loc Common.Toggle.On}"- Style="{StaticResource ToggleSwitchStyle}" />- </StackPanel>- </Grid>- </Border>- </DataTemplate>- </ItemsControl.ItemTemplate>- </ItemsControl>- </ScrollViewer>+ </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+ VerticalAlignment="Center"+ FontTypography="Caption"+ Foreground="{Binding ElementName=StateIcon, Path=Foreground}"+ Text="{Binding State}" />+ </StackPanel>+ </Border>+ </DockPanel>++ <!-- Row 2: Description -->+ <ui:TextBlock+ Margin="0,4,0,0"+ FontTypography="Caption"+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"+ Text="{Binding Description}"+ TextWrapping="Wrap" />++ <!-- Row 3: Path -->+ <ui:TextBlock+ Margin="0,2,0,0"+ FontTypography="Caption"+ Foreground="{DynamicResource TextFillColorDisabledBrush}"+ 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>++ <!-- Row 5: Action summary -->+ <ui:TextBlock+ Margin="0,2,0,0"+ FontTypography="Caption"+ Foreground="{DynamicResource TextFillColorDisabledBrush}"+ Text="{Binding ActionSummary}"+ TextTrimming="CharacterEllipsis" />+ </StackPanel>++ <!-- Actions -->+ <StackPanel+ Grid.Column="2"+ VerticalAlignment="Center"+ Orientation="Horizontal">+ <ui:Button+ Margin="0,0,4,0"+ Padding="8"+ Appearance="Transparent"+ Command="{Binding DataContext.ViewModel.ViewDetailsCommand, RelativeSource={RelativeSource AncestorType=Page}}"+ CommandParameter="{Binding}"+ Cursor="Hand"+ Icon="{ui:SymbolIcon Info24,+ FontSize=16}"+ ToolTip="{ext:Loc ScheduledTasks.Action.Details}" />+ <!-- Run: visible only when not running -->+ <ui:Button+ Margin="0,0,4,0"+ Padding="8"+ Appearance="Transparent"+ Command="{Binding DataContext.ViewModel.RunTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"+ CommandParameter="{Binding}"+ Cursor="Hand"+ Icon="{ui:SymbolIcon Play24,+ FontSize=16}"+ ToolTip="{ext:Loc ScheduledTasks.Action.Run}">+ <ui:Button.Style>+ <Style BasedOn="{StaticResource {x:Type ui:Button}}" TargetType="ui:Button">+ <Setter Property="Visibility" Value="Visible" />+ <Style.Triggers>+ <DataTrigger Binding="{Binding IsRunning}" Value="True">+ <Setter Property="Visibility" Value="Collapsed" />+ </DataTrigger>+ </Style.Triggers>+ </Style>+ </ui:Button.Style>+ </ui:Button>+ <!-- Stop: visible only when running -->+ <ui:Button+ Margin="0,0,4,0"+ Padding="8"+ Appearance="Transparent"+ Command="{Binding DataContext.ViewModel.StopTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"+ CommandParameter="{Binding}"+ Cursor="Hand"+ Icon="{ui:SymbolIcon Stop24,+ FontSize=16}"+ ToolTip="{ext:Loc ScheduledTasks.Action.Stop}"+ Visibility="{Binding IsRunning, Converter={StaticResource WpfBoolToVis}}" />+ <ui:Button+ Margin="0,0,8,0"+ Padding="8"+ Appearance="Transparent"+ Command="{Binding DataContext.ViewModel.DeleteTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"+ CommandParameter="{Binding}"+ Cursor="Hand"+ Icon="{ui:SymbolIcon Delete24,+ FontSize=16}"+ ToolTip="{ext:Loc ScheduledTasks.Action.Delete}" />+ <ui:ToggleSwitch+ IsChecked="{Binding IsEnabled, Mode=TwoWay}"+ OffContent="{ext:Loc Common.Toggle.Off}"+ OnContent="{ext:Loc Common.Toggle.On}"+ Style="{StaticResource ToggleSwitchStyle}" />+ </StackPanel>+ </Grid>+ </Border>+ </DataTemplate>+ </ui:VirtualizingItemsControl.ItemTemplate>+ </ui:VirtualizingItemsControl></Grid></Grid></Page>diff --git a/optimizerDuck/UI/Pages/SettingsPage.xaml b/optimizerDuck/UI/Pages/SettingsPage.xamlindex 7569867..dc9ce76 100644--- a/optimizerDuck/UI/Pages/SettingsPage.xaml+++ b/optimizerDuck/UI/Pages/SettingsPage.xaml@@ -23,7 +23,7 @@</Page.Resources><ScrollViewer>- <StackPanel Margin="0,0,12,0">+ <StackPanel><ui:TextBlock Style="{StaticResource PageTitleStyle}" Text="{ext:Loc Settings.Header.Title}" /><StackPanel Style="{StaticResource SettingsSectionStyle}">diff --git a/optimizerDuck/UI/Pages/StartupManagerPage.xaml b/optimizerDuck/UI/Pages/StartupManagerPage.xamlindex 6cb1aad..6485618 100644--- a/optimizerDuck/UI/Pages/StartupManagerPage.xaml+++ b/optimizerDuck/UI/Pages/StartupManagerPage.xaml@@ -123,7 +123,7 @@<!-- Main Content --><Border Grid.Row="1" Visibility="{Binding ViewModel.HasData, Converter={StaticResource BooleanToVisibilityConverter}}"><ScrollViewer>- <StackPanel Margin="0,0,16,0">+ <StackPanel><!-- ═══════════ Startup Apps Section ═══════════ --><ui:CardExpanderMargin="0,0,0,12"@@ -242,8 +242,13 @@</StackPanel><!-- Apps List -->- <ItemsControl ItemsSource="{Binding ViewModel.Apps}" Visibility="{Binding ViewModel.Apps.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">- <ItemsControl.ItemTemplate>+ <ui:VirtualizingItemsControl ItemsSource="{Binding ViewModel.Apps}" Visibility="{Binding ViewModel.Apps.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">+ <ui:VirtualizingItemsControl.ItemsPanel>+ <ItemsPanelTemplate>+ <VirtualizingStackPanel IsVirtualizing="True" VirtualizationMode="Recycling" />+ </ItemsPanelTemplate>+ </ui:VirtualizingItemsControl.ItemsPanel>+ <ui:VirtualizingItemsControl.ItemTemplate><DataTemplate DataType="{x:Type startupManager:StartupApp}"><Grid><ui:CardAction@@ -307,8 +312,8 @@</ui:CardAction></Grid></DataTemplate>- </ItemsControl.ItemTemplate>- </ItemsControl>+ </ui:VirtualizingItemsControl.ItemTemplate>+ </ui:VirtualizingItemsControl></StackPanel></ui:CardExpander>@@ -435,8 +440,13 @@</StackPanel><!-- Tasks List -->- <ItemsControl ItemsSource="{Binding ViewModel.Tasks}" Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">- <ItemsControl.ItemTemplate>+ <ui:VirtualizingItemsControl ItemsSource="{Binding ViewModel.Tasks}" Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">+ <ui:VirtualizingItemsControl.ItemsPanel>+ <ItemsPanelTemplate>+ <VirtualizingStackPanel IsVirtualizing="True" VirtualizationMode="Recycling" />+ </ItemsPanelTemplate>+ </ui:VirtualizingItemsControl.ItemsPanel>+ <ui:VirtualizingItemsControl.ItemTemplate><DataTemplate DataType="{x:Type startupManager:StartupTask}"><Border Style="{StaticResource ListRowStyle}"><Grid>@@ -530,8 +540,8 @@</Grid></Border></DataTemplate>- </ItemsControl.ItemTemplate>- </ItemsControl>+ </ui:VirtualizingItemsControl.ItemTemplate>+ </ui:VirtualizingItemsControl></StackPanel></ui:CardExpander></StackPanel>