Skip to content

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

feat: add Customize settings, refactor GitHub source link, clean up orphans and fix tag/risk accuracy

fatDuckb8882b69a276
diff --git a/.codegraph/daemon.pid b/.codegraph/daemon.pid
index d17cb87..5ed8ad5 100644
--- a/.codegraph/daemon.pid
+++ b/.codegraph/daemon.pid
@@ -1,6 +1,6 @@
{
- "pid": 17880,
+ "pid": 6084,
"version": "0.9.9",
"socketPath": "\\\\.\\pipe\\codegraph-2ee028a0b3d441bd",
- "startedAt": 1781273598902
+ "startedAt": 1782132149215
}
diff --git a/.devin/workflows/generatechangelog.md b/.devin/workflows/generatechangelog.md
deleted file mode 100644
index 39201f6..0000000
--- a/.devin/workflows/generatechangelog.md
+++ /dev/null
@@ -1,101 +0,0 @@
-You are writing release notes for a real software product used by real people.
-
-Your job is to explain what actually changed for users, not summarize commits.
-
-Before writing:
-
-* inspect git diff, commits, changed files, tags, and recent releases
-* identify the theme of the update
-* understand what users will notice
-* ignore low-value technical noise and internal-only refactors
-
-Write like the developer of the product, not generated patch notes.
-
-The changelog should feel:
-
-* natural
-* concise
-* intentional
-* polished
-* human
-
-Focus on:
-
-* user-visible changes
-* UI/UX polish
-* smoother interactions
-* reliability improvements
-* clearer behavior
-* meaningful fixes
-
-Use sections only when relevant:
-
-## New
-## Changes
-## Improvements
-## Fixes
-
-Bullet structure:
-
-* every bullet should start with a short bold title
-* the title should summarize the improvement in a human way
-* after the title, explain what feels different now
-* keep descriptions concise but meaningful
-* avoid one-line vague bullets
-
-Preferred format:
-
-- **Improved Navigation.**
- The sidebar now adapts better to longer text and page transitions feel smoother when moving between sections.
-
-- **Better translation support.**
- The UI responds more cleanly to longer localized text and missing translation values have been filled in across the app.
-
-Writing style:
-
-* describe changes from the user's perspective
-* explain what feels better now
-* vary sentence structure naturally
-* keep wording simple and direct
-* avoid repetitive bullet openings
-* avoid em dashes
-
-Prefer wording like:
-
-* "can now"
-* "feels smoother"
-* "works more reliably"
-* "adapts better"
-* "is easier to use"
-
-Avoid wording like:
-
-* "implemented"
-* "utilized"
-* "enhanced stability"
-* "various fixes and improvements"
-
-Bad examples:
-
-- Improved performance.
-- Fixed bugs.
-- Enhanced UI responsiveness.
-
-Good examples:
-
-- **Smoother scrolling.**
- Large optimization lists now scroll much more fluidly across the app.
-
-- **Clearer apply errors.**
- Error messages now better explain which optimization failed and why.
-
-- **More responsive localization.**
- Layouts adapt better to longer translated text without breaking navigation or spacing.
-
-When mentioning contributors:
-
-* mention them naturally
-* sound appreciative, not corporate
-* keep acknowledgements short and human
-
-The final result should feel like authentic release notes from a polished indie software update.
\ No newline at end of file
diff --git a/.gitattributes b/.gitattributes
index 94f480d..d0c5506 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1 +1,2 @@
-* text=auto eol=lf
\ No newline at end of file
+* text=auto eol=lf
+Translations.Designer.cs linguist-generated=true
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 220391f..2a337f3 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -58,3 +58,67 @@ jobs:
files: ./optimizerDuck-Windows-x64-${{ steps.get_version.outputs.version }}.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Wait for asset to be ready
+ id: verify_asset
+ shell: pwsh
+ run: |
+ $releaseId = "${{ github.event.release.id }}"
+ $owner = "${{ github.repository_owner }}"
+ $repo = "optimizerDuck"
+ $targetAsset = "optimizerDuck-Windows-x64-${{ steps.get_version.outputs.version }}.exe"
+
+ $maxRetries = 60
+ $retryDelay = 2
+
+ for ($i = 0; $i -lt $maxRetries; $i++) {
+ try {
+ $response = Invoke-RestMethod -Uri "https://api.github.com/repos/$owner/$repo/releases/$releaseId" `
+ -Headers @{
+ "Authorization" = "Bearer $env:GITHUB_TOKEN"
+ "Accept" = "application/vnd.github+json"
+ }
+
+ $asset = $response.assets | Where-Object {
+ $_.name -eq $targetAsset -and $_.name -like "*.exe"
+ }
+
+ if ($asset) {
+ Write-Host "::notice::Asset '$targetAsset' found and ready!"
+ Write-Host "verified=true" >> $env:GITHUB_OUTPUT
+ exit 0
+ }
+ } catch {
+ Write-Host "API call failed (attempt $($i+1)): $_"
+ }
+
+ Write-Host "Waiting for asset... attempt $($i+1)/$maxRetries"
+ Start-Sleep -Seconds $retryDelay
+ }
+
+ Write-Host "::error::Asset verification failed after $maxRetries attempts"
+ exit 1
+
+ - name: Send webhook notify
+ if: steps.verify_asset.outputs.verified == 'true'
+ shell: pwsh
+ run: |
+ $webhookUrl = "https://api.botghost.com/webhook/1124234779194298438/${{ secrets.BOTGHOST_WEBHOOK_RELEASE_EVENT_ID }}"
+ $body = @{
+ variables = @(
+ @{ name = "Release Tag"; variable = "{release_tag}"; value = "${{ github.event.release.tag_name }}" }
+ @{ name = "Release Owner"; variable = "{release_owner}"; value = "${{ github.repository_owner }}" }
+ @{ name = "Release Repo"; variable = "{release_repo}"; value = "optimizerDuck" }
+ )
+ } | ConvertTo-Json
+
+ Write-Host "Sending webhook to BotGhost..."
+ Invoke-RestMethod -Uri $webhookUrl `
+ -Method POST `
+ -Headers @{
+ "Authorization" = "${{ secrets.BOTGHOST_WEBHOOK_API_KEY }}"
+ "Content-Type" = "application/json"
+ } `
+ -Body $body
+
+ Write-Host "::notice::Webhook sent successfully!"
diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md
index da29628..14adc21 100644
--- a/THIRD-PARTY-NOTICES.md
+++ b/THIRD-PARTY-NOTICES.md
@@ -8,13 +8,17 @@
> [!TIP]
> **Help me stay transparent!**
-> If you notice a missing attribution or an incorrect license credit, please let me know. I’ll fix it as soon as possible.
+> If you notice a missing attribution or an incorrect license credit, please let me know. I'll fix it as soon as possible.
>
> 📬 **Get in touch:** Open an [Issue](https://github.com/itsfatduck/optimizerDuck/issues) or reach me at: [[email protected]](mailto:[email protected])
---
-## License notice for [WPF UI](https://github.com/lepoco/wpfui)
+## Runtime Dependencies
+
+---
+
+## License notice for [WPF UI](https://github.com/lepoco/wpfui) and [WPF-UI.DependencyInjection](https://github.com/lepoco/wpfui)
```text
MIT License
@@ -45,24 +49,45 @@ SOFTWARE.
## License notice for [.NET Community Toolkit](https://github.com/CommunityToolkit/dotnet)
```text
-Copyright © .NET Foundation and Contributors
+Copyright (c) .NET Foundation and Contributors
+
All rights reserved.
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+MIT License (MIT)
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
-THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
```
---
## License notice for [Microsoft.Extensions.*](https://github.com/dotnet/extensions)
+This covers the following packages:
+- `Microsoft.Extensions.DependencyInjection`
+- `Microsoft.Extensions.Hosting`
+- `Microsoft.Extensions.Hosting.Abstractions`
+- `Microsoft.Extensions.Logging.Abstractions`
+
```text
The MIT License (MIT)
-Copyright (c) .NET Foundation. All rights reserved.
+Copyright (c) .NET Foundation and Contributors
All rights reserved.
@@ -114,7 +139,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---
-## License notice for [Serilog](https://github.com/serilog/serilog)
+## License notice for [Serilog](https://github.com/serilog/serilog), [Serilog.Extensions.Hosting](https://github.com/serilog/serilog-extensions-hosting), and [Serilog.Sinks.File](https://github.com/serilog/serilog-sinks-file)
```text
Apache License
@@ -311,3 +336,141 @@ third-party archives.
```
---
+
+## License notice for [TaskScheduler](https://github.com/dahall/TaskScheduler)
+
+```text
+MIT
+Copyright (c) 2003-2010 David Hall
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+```
+
+---
+
+## License notice for [System.Management.Automation](https://github.com/PowerShell/PowerShell)
+
+```text
+Copyright (c) Microsoft Corporation.
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+```
+
+---
+
+## Development & Testing Dependencies
+
+---
+
+## License notice for [xUnit.net](https://github.com/xunit/xunit) and [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit)
+
+```text
+Unless otherwise noted, the source code here is covered by the following license:
+
+ Copyright (c) .NET Foundation and Contributors
+ All Rights Reserved
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+```
+
+---
+
+## License notice for [coverlet.collector](https://github.com/coverlet-coverage/coverlet)
+
+```text
+The MIT License (MIT)
+
+Copyright (c) 2018 Toni Solarin-Sodara
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+```
+
+---
+
+## License notice for [Microsoft.NET.Test.Sdk](https://github.com/dotnet/sdk)
+
+```text
+The MIT License (MIT)
+
+Copyright (c) .NET Foundation and Contributors
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+```
diff --git a/opencode.jsonc b/opencode.jsonc
index fdd351b..2c2509a 100644
--- a/opencode.jsonc
+++ b/opencode.jsonc
@@ -10,8 +10,5 @@
],
"enabled": true
}
- },
- "commit_message": {
- "prompt": "# Commit Message Instructions\n\n## Format\n\n```\n<type>: <short description>\n\n[optional body]\n\n[optional footer(s)]\n```\n\n## Allowed Types\n\n| Type | Usage |\n|------------|--------------------------------------------|\n| `feat:` | New feature |\n| `fix:` | Bug fix |\n| `refactor:`| Code change that neither fixes nor adds |\n| `docs:` | Documentation only |\n| `test:` | Adding or fixing tests |\n| `i18n:` | Translations / localization |\n| `chore:` | Build, tooling, deps, CI |\n\n## Rules\n\n- Use **lowercase** for type, short description, and scope.\n- Short description: imperative mood, no period, max ~72 chars.\n- Scope: optional noun in parentheses, e.g. `feat(startup): add virtualization`.\n- Body: wrap at 72 chars, explain *what* and *why*, not *how*.\n- Footer: `Closes #123`, `BREAKING CHANGE: <desc>`.\n- Branch naming: `feature/<name>` or `fix/<issue-id>` branching from `master`.\n- PRs: clear description, linked issue, passing `dotnet build` + `dotnet test`.\n- Never commit secrets or machine-specific paths.\n\n## Examples\n\n```\nfeat(startup): add VirtualizingStackPanel with Recycling mode\n\nEnables container reuse when scrolling the startup apps list,\nreducing GC pressure and improving scroll smoothness.\n\nCloses #42\n```\n\n```\nfix(startup): remove CanContentScroll from outer ScrollViewer\n\nStackPanel children don't implement IScrollInfo so logical scrolling\nsilently drops mouse-wheel events, making the page appear stuck.\n```\n\n```\ni18n: add Vietnamese translations for StartupManager page\n```\n\n```\nchore: update WPF UI package to 3.0.4\n```\n"
}
}
diff --git a/optimizerDuck/Common/Helpers/GitHubSourceHelper.cs b/optimizerDuck/Common/Helpers/GitHubSourceHelper.cs
new file mode 100644
index 0000000..3e71783
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/GitHubSourceHelper.cs
@@ -0,0 +1,105 @@
+using System.Collections.Concurrent;
+using System.Diagnostics;
+using System.Net.Http;
+using System.Text.RegularExpressions;
+using Microsoft.Extensions.Logging;
+using Wpf.Ui;
+using Wpf.Ui.Controls;
+using optimizerDuck.Resources.Languages;
+
+namespace optimizerDuck.Common.Helpers;
+
+/// <summary>
+/// Provides shared logic for opening source files on GitHub, with built-in caching
+/// of raw content to avoid repeated network requests.
+/// </summary>
+public static class GitHubSourceHelper
+{
+ private static readonly HttpClient HttpClient = new() { Timeout = TimeSpan.FromSeconds(5) };
+ private static readonly ConcurrentDictionary<string, Lazy<Task<(string Content, DateTime FetchedAt)>>> SourceCache = new();
+ private static readonly TimeSpan SourceCacheTtl = TimeSpan.FromMinutes(5);
+
+ /// <summary>
+ /// Opens the GitHub source file for the given type at the class definition line.
+ /// </summary>
+ /// <param name="ownerType">The type that owns the source file (e.g., the category class).</param>
+ /// <param name="className">The class name to find within the source file.</param>
+ /// <param name="baseClassPattern">Optional base class pattern to search for (e.g., "BaseCustomizeSetting").</param>
+ /// <param name="logger">Optional logger for diagnostic output.</param>
+ /// <param name="snackbarService">Optional snackbar service for user-facing error notifications.</param>
+ public static async Task OpenSourceOnGitHubAsync(
+ Type ownerType,
+ string className,
+ string? baseClassPattern = null,
+ ILogger? logger = null,
+ ISnackbarService? snackbarService = null)
+ {
+ var fileName = ownerType.Name;
+ var namespacePath = (ownerType.Namespace ?? string.Empty).Replace('.', '/');
+ var relativePath = $"{namespacePath}/{fileName}.cs";
+ var url = $"{Shared.GitHubRepoURL}/blob/master/{relativePath}";
+
+ // Fetch source from GitHub raw content to find the class line number
+ try
+ {
+ var rawUrl = $"https://raw.githubusercontent.com/itsfatduck/optimizerDuck/master/{relativePath}";
+
+ var cached = SourceCache.GetOrAdd(rawUrl, CreateSourceCacheEntry);
+ var cachedSource = await cached.Value;
+
+ if (DateTime.UtcNow - cachedSource.FetchedAt >= SourceCacheTtl)
+ {
+ var refreshed = CreateSourceCacheEntry(rawUrl);
+ SourceCache[rawUrl] = refreshed;
+ cachedSource = await refreshed.Value;
+ }
+
+ var source = cachedSource.Content;
+
+ // Use regex with word boundaries to avoid false-positive substring matches
+ var classNameEscaped = Regex.Escape(className);
+ var pattern = baseClassPattern != null
+ ? $@"class\s+{classNameEscaped}\s*:\s*{Regex.Escape(baseClassPattern)}\b"
+ : $@"class\s+{classNameEscaped}\b";
+
+ var lineIndex = -1;
+ var lines = source.Split('\n');
+ for (var i = 0; i < lines.Length; i++)
+ {
+ if (Regex.IsMatch(lines[i], pattern, RegexOptions.IgnoreCase))
+ {
+ lineIndex = i;
+ break;
+ }
+ }
+
+ if (lineIndex >= 0)
+ url += $"#L{lineIndex + 1}";
+ }
+ catch (Exception ex)
+ {
+ logger?.LogWarning(ex, "Could not fetch source to find line number for {Class}", className);
+ }
+
+ try
+ {
+ Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true });
+ }
+ catch (Exception ex)
+ {
+ logger?.LogError(ex, "Failed to open GitHub URL: {Url}", url);
+ snackbarService?.Show(
+ Translations.Snackbar_OpenLinkFailed_Title,
+ Translations.Snackbar_OpenLinkFailed_Message,
+ ControlAppearance.Danger,
+ new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
+ TimeSpan.FromSeconds(5));
+ }
+ }
+
+ private static Lazy<Task<(string Content, DateTime FetchedAt)>> CreateSourceCacheEntry(string rawUrl)
+ {
+ return new Lazy<Task<(string Content, DateTime FetchedAt)>>(async () =>
+ (await HttpClient.GetStringAsync(rawUrl), DateTime.UtcNow));
+ }
+}
diff --git a/optimizerDuck/Common/Helpers/Shared.cs b/optimizerDuck/Common/Helpers/Shared.cs
index 45120e9..fc83611 100644
--- a/optimizerDuck/Common/Helpers/Shared.cs
+++ b/optimizerDuck/Common/Helpers/Shared.cs
@@ -161,4 +161,7 @@ public static class Shared
public static string DownloadsDirectory => Path.Combine(ResourcesDirectory, "Downloads");
public static string AssetsDirectory => Path.Combine(ResourcesDirectory, "Assets");
public static string RevertDirectory => Path.Combine(RootDirectory, "Revert");
+
+ public static bool IsWindows11OrGreater =>
+ OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000);
}
diff --git a/optimizerDuck/Domain/Customize/Categories/Desktop.cs b/optimizerDuck/Domain/Customize/Categories/Desktop.cs
index 0163c46..800bb3f 100644
--- a/optimizerDuck/Domain/Customize/Categories/Desktop.cs
+++ b/optimizerDuck/Domain/Customize/Categories/Desktop.cs
@@ -133,7 +133,7 @@ public class Desktop : ICustomizeCategory
new()
{
Path =
- @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
Name = "HideIcons",
OnValue = 0,
OffValue = 1,
diff --git a/optimizerDuck/Domain/Customize/Categories/Gaming.cs b/optimizerDuck/Domain/Customize/Categories/Gaming.cs
index 4be497c..a391d7c 100644
--- a/optimizerDuck/Domain/Customize/Categories/Gaming.cs
+++ b/optimizerDuck/Domain/Customize/Categories/Gaming.cs
@@ -277,4 +277,5 @@ public class Gaming : ICustomizeCategory
},
];
}
+
}
diff --git a/optimizerDuck/Domain/Customize/Categories/Preferences.cs b/optimizerDuck/Domain/Customize/Categories/Preferences.cs
index fa84c0d..9d175fb 100644
--- a/optimizerDuck/Domain/Customize/Categories/Preferences.cs
+++ b/optimizerDuck/Domain/Customize/Categories/Preferences.cs
@@ -1,4 +1,5 @@
using System.Collections.ObjectModel;
+using optimizerDuck.Common.Helpers;
using optimizerDuck.Domain.Abstractions;
using optimizerDuck.Domain.Attributes;
using optimizerDuck.Domain.Customize.Models;
@@ -474,4 +475,72 @@ public class Preferences : ICustomizeCategory
await ExecutePostActionAsync();
}
}
+
+ [CustomizeSetting(Section = nameof(Sections.Taskbar), Icon = SymbolRegular.Search24)]
+ public class SearchBoxTaskbarMode : BaseCustomizeSetting
+ {
+ private const string RegPath = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Search";
+ private const string RegName = "SearchboxTaskbarMode";
+
+ public override CustomizeControlType ControlType => CustomizeControlType.Dropdown;
+
+ public override IReadOnlyList<SettingOption>? Options
+ {
+ get
+ {
+ if (Shared.IsWindows11OrGreater)
+ return
+ [
+ Option("Hidden", 0),
+ Option("Icon", 1),
+ Option("IconAndLabel", 2),
+ Option("SearchBox", 3),
+ ];
+ return
+ [
+ Option("Hidden", 0),
+ Option("Icon", 1),
+ Option("SearchBox", 2),
+ ];
+ }
+ }
+
+ public override object? CurrentValue =>
+ RegistryService.Read<object>(new RegistryItem(RegPath, RegName));
+
+ public override async Task ApplyAsync(object? value)
+ {
+ RegistryService.Write(new RegistryItem(RegPath, RegName, value ?? 0));
+ await ExecutePostActionAsync();
+ }
+
+ protected override CustomizeRefreshScope RefreshScope =>
+ CustomizeRefreshScope.TaskbarSettings;
+
+ protected override IReadOnlyList<string> GetWatchedRegistryPaths() => [RegPath];
+ }
+
+ [CustomizeSetting(Section = nameof(Sections.Taskbar), Icon = SymbolRegular.CursorClick24)]
+ public class TaskbarLastActiveClick : BaseCustomizeSetting
+ {
+ private const string RegPath =
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced";
+ private const string RegName = "LastActiveClick";
+
+ protected override CustomizeRefreshScope RefreshScope =>
+ CustomizeRefreshScope.TaskbarSettings;
+
+ protected override IEnumerable<RegistryToggle> RegistryToggles =>
+ [
+ new()
+ {
+ Path = RegPath,
+ Name = RegName,
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 0,
+ },
+ ];
+ }
+
}
diff --git a/optimizerDuck/Domain/Customize/Categories/SystemFeatures.cs b/optimizerDuck/Domain/Customize/Categories/SystemFeatures.cs
index 8a872fd..cf1875d 100644
--- a/optimizerDuck/Domain/Customize/Categories/SystemFeatures.cs
+++ b/optimizerDuck/Domain/Customize/Categories/SystemFeatures.cs
@@ -2,8 +2,10 @@ using System.Collections.ObjectModel;
using optimizerDuck.Domain.Abstractions;
using optimizerDuck.Domain.Attributes;
using optimizerDuck.Domain.Customize.Models;
+using optimizerDuck.Domain.Optimizations.Models.Services;
using optimizerDuck.Domain.UI;
using optimizerDuck.Services.Managers;
+using optimizerDuck.Services.Optimization.Providers;
using optimizerDuck.UI.Pages.Customize;
using Wpf.Ui.Controls;
@@ -15,8 +17,8 @@ public class SystemFeatures : ICustomizeCategory
private enum Sections
{
Input,
- Services,
Power,
+ Developer,
}
public string Name => Loc.Instance[$"Customize.{nameof(SystemFeatures)}.Name"];
@@ -52,4 +54,100 @@ public class SystemFeatures : ICustomizeCategory
},
];
}
+
+
+
+ #region Developer
+
+ [CustomizeSetting(
+ Section = nameof(Sections.Developer),
+ Icon = SymbolRegular.DeveloperBoard24,
+ Recommendation = RecommendationState.Depends
+ )]
+ public class DeveloperMode : BaseCustomizeSetting
+ {
+ protected override CustomizeRefreshScope RefreshScope => CustomizeRefreshScope.Settings;
+
+ protected override IEnumerable<RegistryToggle> RegistryToggles =>
+ [
+ new()
+ {
+ Path = @"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock",
+ Name = "AllowDevelopmentWithoutDevLicense",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 0,
+ },
+ ];
+ }
+
+ [CustomizeSetting(
+ Section = nameof(Sections.Developer),
+ Icon = SymbolRegular.Shield24,
+ Recommendation = RecommendationState.Depends
+ )]
+ public class AllowAllTrustedApps : BaseCustomizeSetting
+ {
+ protected override CustomizeRefreshScope RefreshScope => CustomizeRefreshScope.Settings;
+
+ protected override IEnumerable<RegistryToggle> RegistryToggles =>
+ [
+ new()
+ {
+ Path = @"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock",
+ Name = "AllowAllTrustedApps",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 0,
+ },
+ ];
+ }
+
+ [CustomizeSetting(
+ Section = nameof(Sections.Developer),
+ Icon = SymbolRegular.Folder24,
+ Recommendation = RecommendationState.On
+ )]
+ public class LongPathsEnabled : BaseCustomizeSetting
+ {
+ private const string Path = @"HKLM\SYSTEM\CurrentControlSet\Control\FileSystem";
+
+ protected override CustomizeRefreshScope RefreshScope => CustomizeRefreshScope.Settings;
+
+ protected override IEnumerable<RegistryToggle> RegistryToggles =>
+ [
+ new()
+ {
+ Path = Path,
+ Name = "LongPathsEnabled",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 0,
+ },
+ ];
+ }
+
+ #endregion
+
+[CustomizeSetting(Section = nameof(Sections.Power), Icon = SymbolRegular.BatteryCharge24)]
+ public class ShowBatteryPercentage : BaseCustomizeSetting
+ {
+ private const string RegPath =
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced";
+ private const string RegName = "IsBatteryPercentageEnabled";
+
+ protected override CustomizeRefreshScope RefreshScope => CustomizeRefreshScope.Settings;
+
+ protected override IEnumerable<RegistryToggle> RegistryToggles =>
+ [
+ new()
+ {
+ Path = RegPath,
+ Name = RegName,
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 0,
+ },
+ ];
+ }
}
diff --git a/optimizerDuck/Domain/Optimizations/Categories/Performance.cs b/optimizerDuck/Domain/Optimizations/Categories/Performance.cs
index 5c072ac..e52fb4d 100644
--- a/optimizerDuck/Domain/Optimizations/Categories/Performance.cs
+++ b/optimizerDuck/Domain/Optimizations/Categories/Performance.cs
@@ -51,7 +51,7 @@ public class Performance : IOptimizationCategory
[Optimization(
Id = "CD436A05-51F1-46E9-B4DE-5262EE7F812A",
Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.System | OptimizationTags.Performance
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Ram
)]
public class SvcHostSplit : BaseOptimization
{
@@ -95,7 +95,7 @@ public class Performance : IOptimizationCategory
[Optimization(
Id = "C51E4187-BE49-4376-A97D-46C967A033B5",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Power
+ Tags = OptimizationTags.System | OptimizationTags.Performance
)]
public class ProcessPriority : BaseOptimization
{
@@ -143,7 +143,7 @@ public class Performance : IOptimizationCategory
[Optimization(
Id = "FFB49D94-CCA9-4591-B329-6FDA3A2758F9",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Latency
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Latency | OptimizationTags.Audio | OptimizationTags.Display
)]
public class OptimizeMultimediaScheduler : BaseOptimization
{
@@ -191,7 +191,7 @@ public class Performance : IOptimizationCategory
[Optimization(
Id = "613FE85C-770D-441C-B97A-147B89B99028",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Latency
+ Tags = OptimizationTags.Latency | OptimizationTags.System | OptimizationTags.Performance
)]
public class KeyboardLatencyOptimization : BaseOptimization
{
@@ -226,17 +226,17 @@ public class Performance : IOptimizationCategory
new RegistryItem(
@"HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys",
"Flags",
- "510"
+ "508"
),
new RegistryItem(
@"HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response",
"Flags",
- "122"
+ "120"
),
new RegistryItem(
@"HKEY_CURRENT_USER\Control Panel\Accessibility\ToggleKeys",
"Flags",
- "58"
+ "56"
)
);
diff --git a/optimizerDuck/Domain/Optimizations/Categories/SecurityAndPrivacy.cs b/optimizerDuck/Domain/Optimizations/Categories/SecurityAndPrivacy.cs
index f6c4010..3349db5 100644
--- a/optimizerDuck/Domain/Optimizations/Categories/SecurityAndPrivacy.cs
+++ b/optimizerDuck/Domain/Optimizations/Categories/SecurityAndPrivacy.cs
@@ -22,7 +22,7 @@ public class SecurityAndPrivacy : IOptimizationCategory
[Optimization(
Id = "74DC8DAC-1F90-4BBD-ACF7-7E626749D71C",
Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.Security | OptimizationTags.Privacy
+ Tags = OptimizationTags.Security | OptimizationTags.Privacy | OptimizationTags.System
)]
public class DisableTelemetry : BaseOptimization
{
@@ -165,7 +165,7 @@ public class SecurityAndPrivacy : IOptimizationCategory
[Optimization(
Id = "097B1C61-F372-4B9E-A1C9-D5E6F7A8B9C0",
- Risk = OptimizationRisk.Safe,
+ Risk = OptimizationRisk.Moderate,
Tags = OptimizationTags.System | OptimizationTags.Privacy
)]
public class DisableErrorReporting : BaseOptimization
@@ -223,7 +223,7 @@ public class SecurityAndPrivacy : IOptimizationCategory
[Optimization(
Id = "B1C2D3E4-F5A6-4B7C-8D9E-0F1A2B3C4D5E",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Privacy
+ Tags = OptimizationTags.Privacy | OptimizationTags.Windows10Only | OptimizationTags.System
)]
public class DisableAdvertisingAndSuggestions : BaseOptimization
{
@@ -332,7 +332,7 @@ public class SecurityAndPrivacy : IOptimizationCategory
[Optimization(
Id = "A1B2C3D4-E5F6-4A7B-8C9D-0E1F2A3B4C5D",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Privacy
+ Tags = OptimizationTags.Privacy | OptimizationTags.System
)]
public class DisableActivityHistory : BaseOptimization
{
@@ -372,7 +372,7 @@ public class SecurityAndPrivacy : IOptimizationCategory
[Optimization(
Id = "C1D2E3F4-A5B6-4C7D-8E9F-0A1B2C3D4E5F",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Privacy
+ Tags = OptimizationTags.Privacy | OptimizationTags.System
)]
public class DisableLocationAndSensors : BaseOptimization
{
@@ -450,7 +450,7 @@ public class SecurityAndPrivacy : IOptimizationCategory
[Optimization(
Id = "4107430C-0074-4380-90E7-3662572E4720",
Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.Privacy
+ Tags = OptimizationTags.Privacy | OptimizationTags.System | OptimizationTags.Performance
)]
public class DisableAutoLogger : BaseOptimization
{
@@ -578,7 +578,7 @@ public class SecurityAndPrivacy : IOptimizationCategory
[Optimization(
Id = "64C6BEC3-B58C-4E57-830A-1DE1F4650542",
Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.Privacy | OptimizationTags.System
+ Tags = OptimizationTags.Privacy | OptimizationTags.System | OptimizationTags.Windows11Only | OptimizationTags.Visual
)]
public class DisableCopilot : BaseOptimization
{
@@ -638,7 +638,7 @@ public class SecurityAndPrivacy : IOptimizationCategory
[Optimization(
Id = "00C997FE-1CB7-41BD-B473-65A81333AEE9",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.System | OptimizationTags.Latency | OptimizationTags.Privacy
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Privacy
)]
public class DisableContentDeliveryManager : BaseOptimization
{
diff --git a/optimizerDuck/Domain/Optimizations/Categories/UserExperience.cs b/optimizerDuck/Domain/Optimizations/Categories/UserExperience.cs
index 71caf54..02a4573 100644
--- a/optimizerDuck/Domain/Optimizations/Categories/UserExperience.cs
+++ b/optimizerDuck/Domain/Optimizations/Categories/UserExperience.cs
@@ -47,7 +47,7 @@ public class UserExperience : IOptimizationCategory
[Optimization(
Id = "A3D1E8F2-7B4C-4A5D-9E62-8F3A1B7C4D59",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Performance | OptimizationTags.Visual
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Visual
)]
public sealed class DisableVisualEffects : BaseOptimization
{
diff --git a/optimizerDuck/Domain/UI/OptimizationTags.cs b/optimizerDuck/Domain/UI/OptimizationTags.cs
index 83063d6..cfba43d 100644
--- a/optimizerDuck/Domain/UI/OptimizationTags.cs
+++ b/optimizerDuck/Domain/UI/OptimizationTags.cs
@@ -11,35 +11,39 @@ public enum OptimizationTags
{
None = 0,
+ // System & Security (highest priority)
+ Security = 1 << 6,
+ Privacy = 1 << 5,
+ System = 1 << 7,
+
+ // Performance
+ Performance = 1 << 14,
+ Latency = 1 << 15,
+
// Hardware
+ Disk = 1 << 2,
Ram = 1 << 0,
Display = 1 << 1,
- Disk = 1 << 2,
+
+ // Power
+ Power = 1 << 13,
// Network
Network = 1 << 3,
NetworkRequired = 1 << 4,
- // System & Security
- Privacy = 1 << 5,
- Security = 1 << 6,
- System = 1 << 7,
-
- // User Experience
- Audio = 1 << 8,
- Visual = 1 << 9,
-
// GPU Vendors
Nvidia = 1 << 10,
Amd = 1 << 11,
Intel = 1 << 12,
- // Power
- Power = 1 << 13,
+ // User Experience
+ Audio = 1 << 8,
+ Visual = 1 << 9,
- // Performance
- Performance = 1 << 14,
- Latency = 1 << 15,
+ // Platform (lowest priority)
+ Windows10Only = 1 << 16,
+ Windows11Only = 1 << 17,
}
/// <summary>
@@ -72,70 +76,64 @@ public static class OptimizationTagsToDisplay
{
return tags switch
{
- OptimizationTags.Ram => new OptimizationTagDisplay
- {
- Icon = SymbolRegular.Memory16,
- Display = Translations.Optimizer_UI_Tags_Ram,
- },
-
- OptimizationTags.Disk => new OptimizationTagDisplay
+ OptimizationTags.Security => new OptimizationTagDisplay
{
- Icon = SymbolRegular.HardDrive20,
- Display = Translations.Optimizer_UI_Tags_Disk,
+ Icon = SymbolRegular.LockClosed24,
+ Display = Translations.Optimizer_UI_Tags_Security,
},
- OptimizationTags.Latency => new OptimizationTagDisplay
+ OptimizationTags.Privacy => new OptimizationTagDisplay
{
- Icon = SymbolRegular.Clock24,
- Display = Translations.Optimizer_UI_Tags_Latency,
+ Icon = SymbolRegular.LockOpen24,
+ Display = Translations.Optimizer_UI_Tags_Privacy,
},
- OptimizationTags.Visual => new OptimizationTagDisplay
+ OptimizationTags.System => new OptimizationTagDisplay
{
- Icon = SymbolRegular.VideoClip24,
- Display = Translations.Optimizer_UI_Tags_Visual,
+ Icon = SymbolRegular.Desktop24,
+ Display = Translations.Optimizer_UI_Tags_System,
},
- OptimizationTags.Display => new OptimizationTagDisplay
+ OptimizationTags.Performance => new OptimizationTagDisplay
{
- Icon = SymbolRegular.VideoClip24,
- Display = Translations.Optimizer_UI_Tags_Display,
+ Icon = SymbolRegular.Gauge24,
+ Display = Translations.Optimizer_UI_Tags_Performance,
},
- OptimizationTags.Network => new OptimizationTagDisplay
+ OptimizationTags.Latency => new OptimizationTagDisplay
{
- Icon = SymbolRegular.NetworkAdapter16,
- Display = Translations.Optimizer_UI_Tags_Network,
+ Icon = SymbolRegular.Clock24,
+ Display = Translations.Optimizer_UI_Tags_Latency,
},
- OptimizationTags.Performance => new OptimizationTagDisplay
+ OptimizationTags.Disk => new OptimizationTagDisplay
{
- Icon = SymbolRegular.Gauge24,
- Display = Translations.Optimizer_UI_Tags_Performance,
+ Icon = SymbolRegular.HardDrive20,
+ Display = Translations.Optimizer_UI_Tags_Disk,
},
- OptimizationTags.Privacy => new OptimizationTagDisplay
+ OptimizationTags.Ram => new OptimizationTagDisplay
{
- Icon = SymbolRegular.LockOpen24,
- Display = Translations.Optimizer_UI_Tags_Privacy,
+ Icon = SymbolRegular.Memory16,
+ Display = Translations.Optimizer_UI_Tags_Ram,
},
- OptimizationTags.Audio => new OptimizationTagDisplay
+ OptimizationTags.Display => new OptimizationTagDisplay
{
- Icon = SymbolRegular.Headphones24,
- Display = Translations.Optimizer_UI_Tags_Audio,
+ Icon = SymbolRegular.VideoClip24,
+ Display = Translations.Optimizer_UI_Tags_Display,
},
- OptimizationTags.System => new OptimizationTagDisplay
+ OptimizationTags.Power => new OptimizationTagDisplay
{
- Icon = SymbolRegular.Desktop24,
- Display = Translations.Optimizer_UI_Tags_System,
+ Icon = SymbolRegular.BatteryCharge24,
+ Display = Translations.Optimizer_UI_Tags_Power,
},
- OptimizationTags.Security => new OptimizationTagDisplay
+ OptimizationTags.Network => new OptimizationTagDisplay
{
- Icon = SymbolRegular.LockClosed24,
- Display = Translations.Optimizer_UI_Tags_Security,
+ Icon = SymbolRegular.NetworkAdapter16,
+ Display = Translations.Optimizer_UI_Tags_Network,
},
OptimizationTags.NetworkRequired => new OptimizationTagDisplay
@@ -162,10 +160,28 @@ public static class OptimizationTagsToDisplay
Display = Translations.Optimizer_UI_Tags_Intel,
},
- OptimizationTags.Power => new OptimizationTagDisplay
+ OptimizationTags.Audio => new OptimizationTagDisplay
{
- Icon = SymbolRegular.BatteryCharge24,
- Display = Translations.Optimizer_UI_Tags_Power,
+ Icon = SymbolRegular.Headphones24,
+ Display = Translations.Optimizer_UI_Tags_Audio,
+ },
+
+ OptimizationTags.Visual => new OptimizationTagDisplay
+ {
+ Icon = SymbolRegular.VideoClip24,
+ Display = Translations.Optimizer_UI_Tags_Visual,
+ },
+
+ OptimizationTags.Windows10Only => new OptimizationTagDisplay
+ {
+ Icon = SymbolRegular.Window16,
+ Display = Translations.Optimizer_UI_Tags_Windows10Only,
+ },
+
+ OptimizationTags.Windows11Only => new OptimizationTagDisplay
+ {
+ Icon = SymbolRegular.Window16,
+ Display = Translations.Optimizer_UI_Tags_Windows11Only,
},
_ => throw new ArgumentOutOfRangeException(nameof(tags)),
diff --git a/optimizerDuck/Resources/Languages/Translations.Designer.cs b/optimizerDuck/Resources/Languages/Translations.Designer.cs
index b921e1c..4ecd9f4 100644
--- a/optimizerDuck/Resources/Languages/Translations.Designer.cs
+++ b/optimizerDuck/Resources/Languages/Translations.Designer.cs
@@ -3501,6 +3501,24 @@ namespace optimizerDuck.Resources.Languages {
}
}
+ /// <summary>
+ /// Looks up a localized string similar to Windows 10 only.
+ /// </summary>
+ internal static string Optimizer_UI_Tags_Windows10Only {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Windows10Only", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Windows 11 only.
+ /// </summary>
+ internal static string Optimizer_UI_Tags_Windows11Only {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Windows11Only", resourceCulture);
+ }
+ }
+
/// <summary>
/// Looks up a localized string similar to User Experience.
/// </summary>
diff --git a/optimizerDuck/Resources/Languages/Translations.resx b/optimizerDuck/Resources/Languages/Translations.resx
index 146f61c..59cde47 100644
--- a/optimizerDuck/Resources/Languages/Translations.resx
+++ b/optimizerDuck/Resources/Languages/Translations.resx
@@ -754,6 +754,12 @@
<data name="Optimizer.UI.Tags.Visual" xml:space="preserve">
<value>Visual</value>
</data>
+ <data name="Optimizer.UI.Tags.Windows10Only" xml:space="preserve">
+ <value>Windows 10 only</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Windows11Only" xml:space="preserve">
+ <value>Windows 11 only</value>
+ </data>
<data name="Optimizer.Gpu" xml:space="preserve">
<value>GPU</value>
</data>
@@ -829,24 +835,6 @@
<data name="Customize.Preferences.Section.Explorer" xml:space="preserve">
<value>Explorer</value>
</data>
- <data name="Customize.Preferences.TaskbarNewsAndInterests.Name" xml:space="preserve">
- <value>Taskbar News &amp; Interests</value>
- </data>
- <data name="Customize.Preferences.TaskbarNewsAndInterests.Description" xml:space="preserve">
- <value>Controls the News and Interests widget on the taskbar and MSN feed background updates.</value>
- </data>
- <data name="Customize.Preferences.TaskbarSearchBox.Name" xml:space="preserve">
- <value>Taskbar Search Box</value>
- </data>
- <data name="Customize.Preferences.TaskbarSearchBox.Description" xml:space="preserve">
- <value>Controls visibility of the search box on the taskbar.</value>
- </data>
- <data name="Customize.Preferences.TaskbarChatButton.Name" xml:space="preserve">
- <value>Taskbar Chat Button</value>
- </data>
- <data name="Customize.Preferences.TaskbarChatButton.Description" xml:space="preserve">
- <value>Controls visibility of the Chat (Teams) button on the taskbar.</value>
- </data>
<data name="Customize.Preferences.TaskbarWidgets.Name" xml:space="preserve">
<value>Taskbar Widgets</value>
</data>
@@ -892,18 +880,6 @@
<data name="Customize.Preferences.TaskbarTaskViewButton.Description" xml:space="preserve">
<value>Controls visibility of the Task View button on the taskbar.</value>
</data>
- <data name="Customize.Preferences.MeetNow.Name" xml:space="preserve">
- <value>Meet Now</value>
- </data>
- <data name="Customize.Preferences.MeetNow.Description" xml:space="preserve">
- <value>Controls the Meet Now (Skype) icon in the taskbar notification area.</value>
- </data>
- <data name="Customize.Preferences.TaskbarPeople.Name" xml:space="preserve">
- <value>Taskbar People</value>
- </data>
- <data name="Customize.Preferences.TaskbarPeople.Description" xml:space="preserve">
- <value>Controls the People icon on the taskbar for quick contacts access.</value>
- </data>
<data name="Customize.Preferences.TaskbarEndTask.Name" xml:space="preserve">
<value>Taskbar End Task</value>
</data>
@@ -1656,9 +1632,6 @@ Update now to enjoy the latest features, improvements, and bug fixes.</value>
<data name="Customize.SystemFeatures.Description" xml:space="preserve">
<value>Core system features and behaviors</value>
</data>
- <data name="Customize.SystemFeatures.Section.Boot" xml:space="preserve">
- <value>Boot Operations</value>
- </data>
<data name="Customize.SystemFeatures.Section.Input" xml:space="preserve">
<value>Input Settings</value>
</data>
@@ -1671,9 +1644,6 @@ Update now to enjoy the latest features, improvements, and bug fixes.</value>
<data name="Customize.SystemFeatures.NumLockOnBoot.Recommendation.Reason" xml:space="preserve">
<value>Enabling NumLock at boot ensures the numpad is ready immediately after login, avoiding manual toggling each time.</value>
</data>
- <data name="Customize.SystemFeatures.Section.Services" xml:space="preserve">
- <value>Services</value>
- </data>
<data name="Customize.SystemFeatures.Section.Power" xml:space="preserve">
<value>Power Settings</value>
</data>
@@ -1803,4 +1773,72 @@ Update now to enjoy the latest features, improvements, and bug fixes.</value>
<data name="TitleBar.Discord" xml:space="preserve">
<value>Join the Discord community</value>
</data>
+
+ <data name="Customize.SystemFeatures.Section.Developer" xml:space="preserve">
+ <value>Developer</value>
+ </data>
+
+
+ <!-- Developer Mode -->
+ <data name="Customize.SystemFeatures.DeveloperMode.Name" xml:space="preserve">
+ <value>Developer Mode</value>
+ </data>
+ <data name="Customize.SystemFeatures.DeveloperMode.Description" xml:space="preserve">
+ <value>Enables Windows Developer Mode for sideloading apps, device portal, SSH server, and development features.</value>
+ </data>
+ <data name="Customize.SystemFeatures.DeveloperMode.Recommendation.Reason" xml:space="preserve">
+ <value>Developer Mode enables sideloading and diagnostic features essential for app development and debugging.</value>
+ </data>
+
+ <!-- Allow All Trusted Apps -->
+ <data name="Customize.SystemFeatures.AllowAllTrustedApps.Name" xml:space="preserve">
+ <value>Allow All Trusted Apps</value>
+ </data>
+ <data name="Customize.SystemFeatures.AllowAllTrustedApps.Description" xml:space="preserve">
+ <value>Allows all trusted Windows Store apps to be installed without requiring Developer Mode to be enabled.</value>
+ </data>
+ <data name="Customize.SystemFeatures.AllowAllTrustedApps.Recommendation.Reason" xml:space="preserve">
+ <value>Allowing all trusted apps enables sideloading without Developer Mode; disabling restricts installations to the Microsoft Store.</value>
+ </data>
+
+ <!-- Long Paths -->
+ <data name="Customize.SystemFeatures.LongPathsEnabled.Name" xml:space="preserve">
+ <value>Long Path Support (&gt;260 chars)</value>
+ </data>
+ <data name="Customize.SystemFeatures.LongPathsEnabled.Description" xml:space="preserve">
+ <value>Enables Win32 long path support in File Explorer, allowing file paths longer than the traditional 260-character limit.</value>
+ </data>
+ <data name="Customize.SystemFeatures.LongPathsEnabled.Recommendation.Reason" xml:space="preserve">
+ <value>Long path support prevents file-access errors when working with deeply nested directories or projects with long names.</value>
+ </data>
+ <data name="Customize.Preferences.SearchBoxTaskbarMode.Name" xml:space="preserve">
+ <value>Search Box Display</value>
+ </data>
+ <data name="Customize.Preferences.SearchBoxTaskbarMode.Description" xml:space="preserve">
+ <value>Controls how the search button and box are displayed on the taskbar.</value>
+ </data>
+ <data name="Customize.Preferences.SearchBoxTaskbarMode.Options.Hidden" xml:space="preserve">
+ <value>Hidden</value>
+ </data>
+ <data name="Customize.Preferences.SearchBoxTaskbarMode.Options.Icon" xml:space="preserve">
+ <value>Icon Only</value>
+ </data>
+ <data name="Customize.Preferences.SearchBoxTaskbarMode.Options.IconAndLabel" xml:space="preserve">
+ <value>Icon + Label</value>
+ </data>
+ <data name="Customize.Preferences.SearchBoxTaskbarMode.Options.SearchBox" xml:space="preserve">
+ <value>Search Box</value>
+ </data>
+ <data name="Customize.Preferences.TaskbarLastActiveClick.Name" xml:space="preserve">
+ <value>Last Active Click</value>
+ </data>
+ <data name="Customize.Preferences.TaskbarLastActiveClick.Description" xml:space="preserve">
+ <value>Clicking a taskbar icon opens the most recently active window of that app instantly.</value>
+ </data>
+<data name="Customize.SystemFeatures.ShowBatteryPercentage.Name" xml:space="preserve">
+ <value>Show Battery Percentage</value>
+ </data>
+ <data name="Customize.SystemFeatures.ShowBatteryPercentage.Description" xml:space="preserve">
+ <value>Shows the battery percentage next to the battery icon in the system tray.</value>
+ </data>
</root>
\ No newline at end of file
diff --git a/optimizerDuck/Services/UI/BloatwareService.cs b/optimizerDuck/Services/UI/BloatwareService.cs
index 31148e4..3f90555 100644
--- a/optimizerDuck/Services/UI/BloatwareService.cs
+++ b/optimizerDuck/Services/UI/BloatwareService.cs
@@ -34,7 +34,7 @@ public class BloatwareService(
@"(?:^|[._])targetsize-(\d+)",
RegexOptions.IgnoreCase | RegexOptions.Compiled
);
- private static readonly string[] SupportedImageExtensions = [".png", ".jpg", ".jpeg"];
+ private static readonly string[] SupportedImageExtensions = [".png", ".jpg", ".jpeg", ".ico"];
/// <summary>
/// Gets all removable AppX packages on the system.
@@ -232,30 +232,66 @@ public class BloatwareService(
}
var assetsDir = Path.Combine(installLocation, "Assets");
- if (!Directory.Exists(assetsDir))
- return null;
-
- // Per Microsoft guidance, AppList/Square44x44 assets are a better primary app icon source than StoreLogo.
- var fallbackCandidates = new[]
+ if (Directory.Exists(assetsDir))
{
- @"Assets\AppList.png",
- @"Assets\Square44x44Logo.png",
- @"Assets\SmallTile.png",
- @"Assets\MedTile.png",
- @"Assets\Square150x150Logo.png",
- @"Assets\Logo.png",
- @"Assets\StoreLogo.png",
- };
+ // Per Microsoft guidance, AppList/Square44x44 assets are a better primary app icon source than StoreLogo.
+ var fallbackCandidates = new[]
+ {
+ @"Assets\AppList.png",
+ @"Assets\Square44x44Logo.png",
+ @"Assets\SmallTile.png",
+ @"Assets\MedTile.png",
+ @"Assets\Square150x150Logo.png",
+ @"Assets\Logo.png",
+ @"Assets\StoreLogo.png",
+ };
+
+ foreach (var fallbackCandidate in fallbackCandidates)
+ {
+ var bestFallback = ResolveBestQualifiedVariant(
+ installLocation,
+ fallbackCandidate,
+ includeThemeSpecific: true
+ );
+ if (!string.IsNullOrWhiteSpace(bestFallback))
+ return bestFallback;
+ }
- foreach (var fallbackCandidate in fallbackCandidates)
- {
- var bestFallback = ResolveBestQualifiedVariant(
- installLocation,
- fallbackCandidate,
- includeThemeSpecific: true
- );
- if (!string.IsNullOrWhiteSpace(bestFallback))
- return bestFallback;
+ var allImageFiles = Directory
+ .EnumerateFiles(assetsDir, "*.*", SearchOption.AllDirectories)
+ .Where(path =>
+ SupportedImageExtensions.Contains(
+ Path.GetExtension(path),
+ StringComparer.OrdinalIgnoreCase
+ )
+ )
+ .ToList();
+
+ if (allImageFiles.Count != 0)
+ {
+ var groups = allImageFiles
+ .GroupBy(path =>
+ {
+ var name = Path.GetFileNameWithoutExtension(path);
+ return StripKnownQualifiers(name);
+ }, StringComparer.OrdinalIgnoreCase)
+ .OrderByDescending(g => g.Key.Contains("applist", StringComparison.OrdinalIgnoreCase) ? 2
+ : g.Key.Contains("square44x44", StringComparison.OrdinalIgnoreCase) ? 2
+ : g.Key.Contains("square150x150", StringComparison.OrdinalIgnoreCase) ? 1
+ : g.Key.Contains("storelogo", StringComparison.OrdinalIgnoreCase) ? -1
+ : 0)
+ .ThenByDescending(g => g.Count());
+
+ foreach (var group in groups)
+ {
+ var preferredSize = GuessLogicalBaseSize(group.Key);
+ var best = group
+ .Select(path => new LogoVariant(path, preferredSize, true))
+ .MaxBy(v => v.SortScore);
+ if (best != null)
+ return best.Path;
+ }
+ }
}
}
catch
@@ -341,7 +377,7 @@ public class BloatwareService(
var baseNameWithoutQualifiers = StripKnownQualifiers(baseResourceName);
var preferredLogicalSize = GuessLogicalBaseSize(baseNameWithoutQualifiers);
- return Directory
+ var best = Directory
.EnumerateFiles(candidateDirectory, "*.*", SearchOption.TopDirectoryOnly)
.Where(path =>
SupportedImageExtensions.Contains(
@@ -359,6 +395,29 @@ public class BloatwareService(
);
})
.Select(path => new LogoVariant(path, preferredLogicalSize, includeThemeSpecific))
+ .MaxBy(v => v.SortScore);
+
+ if (best != null)
+ return best.Path;
+
+ return Directory
+ .EnumerateFiles(candidateDirectory, "*.*", SearchOption.AllDirectories)
+ .Where(path =>
+ SupportedImageExtensions.Contains(
+ Path.GetExtension(path),
+ StringComparer.OrdinalIgnoreCase
+ )
+ )
+ .Where(path =>
+ {
+ var fileName = Path.GetFileNameWithoutExtension(path);
+ var stripped = StripKnownQualifiers(fileName);
+ return stripped.Equals(
+ baseNameWithoutQualifiers,
+ StringComparison.OrdinalIgnoreCase
+ );
+ })
+ .Select(path => new LogoVariant(path, preferredLogicalSize, includeThemeSpecific))
.MaxBy(v => v.SortScore)
?.Path;
}
@@ -423,16 +482,19 @@ public class BloatwareService(
?? (scale.HasValue ? logicalBaseSize * scale.Value / 100 : logicalBaseSize);
var score = 0;
- score += resolvedPixelSize >= 48 ? 600 : 0;
- score += resolvedPixelSize >= 64 ? 350 : 0;
- score += resolvedPixelSize >= 96 ? 100 : 0;
- score -= Math.Abs(64 - resolvedPixelSize);
+
+ score += Math.Min(resolvedPixelSize * 5, 1500);
+
+ if (resolvedPixelSize >= 256) score += 600;
+ else if (resolvedPixelSize >= 96) score += 400;
+ else if (resolvedPixelSize >= 64) score += 200;
+ else if (resolvedPixelSize >= 48) score += 100;
if (targetSize.HasValue)
- score += 220;
+ score += Math.Min(targetSize.Value * 3, 800);
if (scale.HasValue)
- score += Math.Min(scale.Value, 400);
+ score += Math.Min(scale.Value * 2, 800);
if (includeThemeSpecific)
{
@@ -442,18 +504,18 @@ public class BloatwareService(
StringComparison.OrdinalIgnoreCase
)
)
- score += 120;
+ score += 200;
if (
fileNameWithoutExtension.Contains(
"_altform-lightunplated",
StringComparison.OrdinalIgnoreCase
)
)
- score += 110;
+ score += 180;
}
if (fileNameWithoutExtension.Contains("storelogo", StringComparison.OrdinalIgnoreCase))
- score -= 300;
+ score -= 500;
SortScore = score;
}
diff --git a/optimizerDuck/Services/UI/DiskCleanupService.cs b/optimizerDuck/Services/UI/DiskCleanupService.cs
index e0f231a..fb95783 100644
--- a/optimizerDuck/Services/UI/DiskCleanupService.cs
+++ b/optimizerDuck/Services/UI/DiskCleanupService.cs
@@ -12,6 +12,9 @@ namespace optimizerDuck.Services.UI;
/// </summary>
public class DiskCleanupService(ILogger<DiskCleanupService> logger)
{
+ private static readonly string DotNetTempPath =
+ Path.GetFullPath(Path.Combine(Path.GetTempPath(), ".net"))
+ .TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;
/// <summary>
/// Gets the available cleanup items.
/// </summary>
@@ -244,9 +247,6 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
};
var dirInfo = new DirectoryInfo(path);
- var dotNetTempPath =
- Path.GetFullPath(Path.Combine(Path.GetTempPath(), ".net"))
- .TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;
foreach (var fileInfo in dirInfo.EnumerateFiles(searchPattern, options))
try
@@ -261,7 +261,7 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
if (
fullDirPath.StartsWith(
- dotNetTempPath,
+ DotNetTempPath,
StringComparison.OrdinalIgnoreCase
)
)
@@ -291,9 +291,6 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
return 0;
long freed = 0;
- var dotNetTempPath =
- Path.GetFullPath(Path.Combine(Path.GetTempPath(), ".net"))
- .TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;
var searchPattern = itemId == "Thumbnails" ? "thumbcache_*" : "*";
var options = new EnumerationOptions
{
@@ -315,7 +312,7 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
fullDirPath.TrimEnd(Path.DirectorySeparatorChar)
+ Path.DirectorySeparatorChar;
- if (fullDirPath.StartsWith(dotNetTempPath, StringComparison.OrdinalIgnoreCase))
+ if (fullDirPath.StartsWith(DotNetTempPath, StringComparison.OrdinalIgnoreCase))
continue;
}
@@ -350,7 +347,7 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
var fullDir =
dir.FullName.TrimEnd(Path.DirectorySeparatorChar)
+ Path.DirectorySeparatorChar;
- if (fullDir.StartsWith(dotNetTempPath, StringComparison.OrdinalIgnoreCase))
+ if (fullDir.StartsWith(DotNetTempPath, StringComparison.OrdinalIgnoreCase))
continue;
dir.Delete(false); // Only delete if empty
diff --git a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml
index f69e14a..51a0936 100644
--- a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml
@@ -9,22 +9,21 @@
d:DesignHeight="700"
d:DesignWidth="760"
mc:Ignorable="d">
- <ScrollViewer VerticalScrollBarVisibility="Auto">
- <StackPanel x:Name="RootPanel" MinWidth="620">
- <Border
+ <StackPanel >
+ <Border
Margin="0,0,0,12"
Padding="{StaticResource CardPadding}"
Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="{StaticResource CornerRadiusMedium}">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
- <Image
+ <Image
x:Name="TaskLogoImage"
Grid.Column="0"
Width="40"
@@ -33,55 +32,55 @@
VerticalAlignment="Center"
Stretch="UniformToFill" />
- <StackPanel Grid.Column="1" VerticalAlignment="Center">
- <DockPanel LastChildFill="False">
- <ui:TextBlock
+ <StackPanel Grid.Column="1" VerticalAlignment="Center">
+ <DockPanel LastChildFill="False">
+ <ui:TextBlock
x:Name="TaskNameText"
FontTypography="BodyStrong"
Text=""
TextWrapping="Wrap" />
- <Border
+ <Border
Margin="8,0,0,0"
Padding="6,1"
VerticalAlignment="Center"
Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
CornerRadius="4">
- <ui:TextBlock
+ <ui:TextBlock
VerticalAlignment="Center"
Appearance="Tertiary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Header.Title}" />
- </Border>
- <Border
+ </Border>
+ <Border
x:Name="StateBorder"
Margin="8,0,0,0"
Padding="6,1"
VerticalAlignment="Center"
CornerRadius="4">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
x:Name="StateIcon"
Margin="0,0,4,0"
FontSize="10"
Symbol="Circle24" />
- <ui:TextBlock
+ <ui:TextBlock
x:Name="StateText"
VerticalAlignment="Center"
FontTypography="Caption"
Foreground="{Binding ElementName=StateIcon, Path=Foreground}"
Text="" />
- </StackPanel>
- </Border>
- </DockPanel>
+ </StackPanel>
+ </Border>
+ </DockPanel>
- <ui:TextBlock
+ <ui:TextBlock
x:Name="DescriptionText"
Margin="0,4,0,0"
Appearance="Secondary"
FontTypography="Caption"
Text=""
TextWrapping="Wrap" />
- <ui:TextBlock
+ <ui:TextBlock
x:Name="PathText"
Margin="0,2,0,0"
Appearance="Disabled"
@@ -89,201 +88,200 @@
Text=""
TextTrimming="CharacterEllipsis" />
- <ItemsControl x:Name="TriggerBadgesItems" Margin="0,6,0,0">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border
+ <ItemsControl x:Name="TriggerBadgesItems" Margin="0,6,0,0">
+ <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
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
Margin="0,0,4,0"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Symbol="Timer24" />
- <ui:TextBlock
+ <ui:TextBlock
VerticalAlignment="Center"
FontTypography="Caption"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Text="{Binding}" />
- </StackPanel>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </StackPanel>
- </Grid>
- </Border>
+ </StackPanel>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+ </Grid>
+ </Border>
- <Border
+ <Border
Margin="0,0,0,12"
Padding="0"
Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="{StaticResource CornerRadiusMedium}">
- <StackPanel>
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
+ <StackPanel>
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
Margin="0,0,10,0"
VerticalAlignment="Top"
FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Symbol="Person24" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
Appearance="Secondary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Author}" />
- <ui:TextBlock
+ <ui:TextBlock
x:Name="AuthorText"
Margin="0,2,0,0"
FontTypography="Body"
Text="" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
Margin="0,0,10,0"
VerticalAlignment="Top"
FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Symbol="Timer24" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
Appearance="Secondary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Triggers}" />
- <ui:TextBlock
+ <ui:TextBlock
x:Name="TriggersText"
Margin="0,2,0,0"
FontTypography="Body"
Text=""
TextWrapping="Wrap" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
Margin="0,0,10,0"
VerticalAlignment="Top"
FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Symbol="Play24" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
Appearance="Secondary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Action}" />
- <ui:TextBlock
+ <ui:TextBlock
x:Name="ActionText"
Margin="0,2,0,0"
FontFamily="Consolas"
FontTypography="Body"
Text=""
TextWrapping="Wrap" />
- </StackPanel>
- </Grid>
- </StackPanel>
- </Border>
+ </StackPanel>
+ </Grid>
+ </StackPanel>
+ </Border>
- <Border
+ <Border
Padding="0"
Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="{StaticResource CornerRadiusMedium}">
- <StackPanel>
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
+ <StackPanel>
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
Margin="0,0,10,0"
VerticalAlignment="Top"
FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Symbol="History24" />
- <StackPanel Grid.Column="1" Margin="0,0,16,0">
- <ui:TextBlock
+ <StackPanel Grid.Column="1" Margin="0,0,16,0">
+ <ui:TextBlock
Appearance="Secondary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.LastRun}" />
- <ui:TextBlock
+ <ui:TextBlock
x:Name="LastRunText"
Margin="0,2,0,0"
FontTypography="Body"
Text="" />
- </StackPanel>
- <ui:SymbolIcon
+ </StackPanel>
+ <ui:SymbolIcon
Grid.Column="2"
Margin="0,0,10,0"
VerticalAlignment="Top"
FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Symbol="CalendarArrowRight24" />
- <StackPanel Grid.Column="3">
- <ui:TextBlock
+ <StackPanel Grid.Column="3">
+ <ui:TextBlock
Appearance="Secondary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.NextRun}" />
- <ui:TextBlock
+ <ui:TextBlock
x:Name="NextRunText"
Margin="0,2,0,0"
FontTypography="Body"
Text="" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
Margin="0,0,10,0"
VerticalAlignment="Top"
FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Symbol="CheckmarkCircle24" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
Appearance="Secondary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.LastResult}" />
- <ui:TextBlock
+ <ui:TextBlock
x:Name="LastResultText"
Margin="0,2,0,0"
FontTypography="Body"
Text="" />
- </StackPanel>
- </Grid>
- </StackPanel>
- </Border>
- </StackPanel>
- </ScrollViewer>
+ </StackPanel>
+ </Grid>
+ </StackPanel>
+ </Border>
+ </StackPanel>
</UserControl>
diff --git a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml
index 0e4f464..7d00db6 100644
--- a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml
+++ b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml
@@ -9,22 +9,21 @@
d:DesignHeight="520"
d:DesignWidth="620"
mc:Ignorable="d">
- <ScrollViewer VerticalScrollBarVisibility="Auto">
- <StackPanel MinWidth="540">
- <Border
+ <StackPanel MinWidth="540">
+ <Border
Margin="0,0,0,12"
Padding="{StaticResource CardPadding}"
Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="{StaticResource CornerRadiusMedium}">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
- <Image
+ <Image
x:Name="LogoImageControl"
Grid.Column="0"
Width="40"
@@ -34,226 +33,225 @@
Source="{x:Null}"
Stretch="UniformToFill" />
- <StackPanel Grid.Column="1" VerticalAlignment="Center">
- <DockPanel LastChildFill="False">
- <ui:TextBlock
+ <StackPanel Grid.Column="1" VerticalAlignment="Center">
+ <DockPanel LastChildFill="False">
+ <ui:TextBlock
FontTypography="BodyStrong"
Text="{Binding Text, ElementName=NameText}"
TextWrapping="Wrap" />
- <Border
+ <Border
x:Name="TaskKindBadge"
Margin="8,0,0,0"
Padding="6,1"
VerticalAlignment="Center"
Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
CornerRadius="4">
- <ui:TextBlock
+ <ui:TextBlock
VerticalAlignment="Center"
Appearance="Tertiary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Header.Title}" />
- </Border>
- <Border
+ </Border>
+ <Border
x:Name="TaskStateBadge"
Margin="8,0,0,0"
Padding="6,1"
VerticalAlignment="Center"
CornerRadius="4">
- <ui:TextBlock
+ <ui:TextBlock
x:Name="TaskStateText"
VerticalAlignment="Center"
FontTypography="Caption"
Foreground="{DynamicResource TextFillColorInverseBrush}"
Text="" />
- </Border>
- </DockPanel>
+ </Border>
+ </DockPanel>
- <ui:TextBlock
+ <ui:TextBlock
Margin="0,4,0,0"
Appearance="Secondary"
FontTypography="Caption"
Text="{Binding Text, ElementName=DescriptionText}"
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap" />
- <ui:TextBlock
+ <ui:TextBlock
Margin="0,2,0,0"
Appearance="Disabled"
FontTypography="Caption"
Text="{Binding Text, ElementName=PathText}"
TextTrimming="CharacterEllipsis" />
- <ItemsControl x:Name="TriggerBadgesItems" Margin="0,6,0,0">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border
+ <ItemsControl x:Name="TriggerBadgesItems" Margin="0,6,0,0">
+ <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
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
Margin="0,0,4,0"
FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Symbol="Timer24" />
- <ui:TextBlock
+ <ui:TextBlock
VerticalAlignment="Center"
FontTypography="Caption"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Text="{Binding}" />
- </StackPanel>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </StackPanel>
- </Grid>
- </Border>
+ </StackPanel>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+ </Grid>
+ </Border>
- <Border
+ <Border
Padding="0"
Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="{StaticResource CornerRadiusMedium}">
- <StackPanel>
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
+ <StackPanel>
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
Margin="0,0,10,0"
VerticalAlignment="Top"
FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Symbol="AppGeneric24" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
Appearance="Secondary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Name}" />
- <ui:TextBlock
+ <ui:TextBlock
x:Name="NameText"
Margin="0,2,0,0"
FontTypography="Body"
Text=""
TextWrapping="Wrap" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
Margin="0,0,10,0"
VerticalAlignment="Top"
FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Symbol="TextDescription24" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
Appearance="Secondary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Description}" />
- <ui:TextBlock
+ <ui:TextBlock
x:Name="DescriptionText"
Margin="0,2,0,0"
FontTypography="Body"
Text=""
TextWrapping="Wrap" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
Margin="0,0,10,0"
VerticalAlignment="Top"
FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Symbol="Folder24" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
Appearance="Secondary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Path}" />
- <ui:TextBlock
+ <ui:TextBlock
x:Name="PathText"
Margin="0,2,0,0"
FontFamily="Consolas"
FontTypography="Body"
Text=""
TextWrapping="Wrap" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
Margin="0,0,10,0"
VerticalAlignment="Top"
FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Symbol="Timer24" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
Appearance="Secondary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Triggers}" />
- <ui:TextBlock
+ <ui:TextBlock
x:Name="TriggersText"
Margin="0,2,0,0"
FontTypography="Body"
Text=""
TextWrapping="Wrap" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
Margin="0,0,10,0"
VerticalAlignment="Top"
FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Symbol="Play24" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
Appearance="Secondary"
FontTypography="Caption"
Text="{ext:Loc ScheduledTasks.Details.Action}" />
- <ui:TextBlock
+ <ui:TextBlock
x:Name="ActionText"
Margin="0,2,0,0"
FontFamily="Consolas"
FontTypography="Body"
Text=""
TextWrapping="Wrap" />
- </StackPanel>
- </Grid>
- </StackPanel>
- </Border>
- </StackPanel>
- </ScrollViewer>
+ </StackPanel>
+ </Grid>
+ </StackPanel>
+ </Border>
+ </StackPanel>
</UserControl>
diff --git a/optimizerDuck/UI/Pages/Customize/Categories/CustomizeCategoryPage.xaml b/optimizerDuck/UI/Pages/Customize/Categories/CustomizeCategoryPage.xaml
index 03a52e3..8224925 100644
--- a/optimizerDuck/UI/Pages/Customize/Categories/CustomizeCategoryPage.xaml
+++ b/optimizerDuck/UI/Pages/Customize/Categories/CustomizeCategoryPage.xaml
@@ -120,7 +120,9 @@
<ui:VirtualizingItemsControl ItemsSource="{Binding ViewModel.Sections}" Style="{x:Null}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
- <VirtualizingStackPanel IsVirtualizing="True" VirtualizationMode="Recycling" />
+ <VirtualizingStackPanel
+ Margin="0,0,0,-20"
+ IsVirtualizing="True" VirtualizationMode="Recycling" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
diff --git a/optimizerDuck/UI/Pages/Customize/Categories/CustomizeCategoryPages.cs b/optimizerDuck/UI/Pages/Customize/Categories/CustomizeCategoryPages.cs
index fe5d3b2..8a09764 100644
--- a/optimizerDuck/UI/Pages/Customize/Categories/CustomizeCategoryPages.cs
+++ b/optimizerDuck/UI/Pages/Customize/Categories/CustomizeCategoryPages.cs
@@ -37,3 +37,4 @@ public sealed class DesktopFeatureCategory : CustomizeCategoryPage
InitializeComponent();
}
}
+
diff --git a/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml b/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml
index 5de188a..fa0f727 100644
--- a/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml
+++ b/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml
@@ -346,6 +346,10 @@
Grid.Column="2"
VerticalAlignment="Center"
Orientation="Horizontal">
+ <ui:ToggleSwitch
+ IsChecked="{Binding IsEnabled, Mode=TwoWay}"
+ OffContent="{ext:Loc Common.Toggle.Off}"
+ OnContent="{ext:Loc Common.Toggle.On}" />
<ui:Button
Margin="0,0,4,0"
Padding="8"
@@ -374,11 +378,15 @@
<DataTrigger Binding="{Binding IsRunning}" Value="True">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
+ <DataTrigger Binding="{Binding IsEnabled}" Value="False">
+ <Setter Property="IsEnabled" Value="False" />
+ </DataTrigger>
</Style.Triggers>
</Style>
</ui:Button.Style>
</ui:Button>
<!-- Stop: visible only when running -->
+
<ui:Button
Margin="0,0,4,0"
Padding="8"
@@ -400,10 +408,7 @@
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}" />
+
</StackPanel>
</Grid>
</Border>
diff --git a/optimizerDuck/UI/Pages/StartupManagerPage.xaml b/optimizerDuck/UI/Pages/StartupManagerPage.xaml
index 03c99b2..ccc9be0 100644
--- a/optimizerDuck/UI/Pages/StartupManagerPage.xaml
+++ b/optimizerDuck/UI/Pages/StartupManagerPage.xaml
@@ -519,6 +519,10 @@
Grid.Column="2"
VerticalAlignment="Center"
Orientation="Horizontal">
+ <ui:ToggleSwitch
+ IsChecked="{Binding IsEnabled, Mode=TwoWay}"
+ OffContent="{ext:Loc Common.Toggle.Off}"
+ OnContent="{ext:Loc Common.Toggle.On}" />
<ui:Button
Margin="0,0,4,0"
Padding="8"
@@ -529,10 +533,7 @@
Icon="{ui:SymbolIcon Info24,
FontSize=16}"
ToolTip="{ext:Loc ScheduledTasks.Action.Details}" />
- <ui:ToggleSwitch
- IsChecked="{Binding IsEnabled, Mode=TwoWay}"
- OffContent="{ext:Loc Common.Toggle.Off}"
- OnContent="{ext:Loc Common.Toggle.On}" />
+
</StackPanel>
</Grid>
</Border>
diff --git a/optimizerDuck/UI/ViewModels/Dialogs/OptimizationDetailsViewModel.cs b/optimizerDuck/UI/ViewModels/Dialogs/OptimizationDetailsViewModel.cs
index 5378219..5dddc1b 100644
--- a/optimizerDuck/UI/ViewModels/Dialogs/OptimizationDetailsViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Dialogs/OptimizationDetailsViewModel.cs
@@ -1,7 +1,5 @@
-using System.Collections.Concurrent;
-using System.Diagnostics;
+using System.Diagnostics;
using System.IO;
-using System.Net.Http;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.Logging;
@@ -21,13 +19,6 @@ public partial class OptimizationDetailsViewModel(
ILogger logger
) : ObservableObject
{
- private static readonly HttpClient httpClient = new() { Timeout = TimeSpan.FromSeconds(5) };
- private static readonly ConcurrentDictionary<
- string,
- Lazy<Task<(string Content, DateTime FetchedAt)>>
- > _sourceCache = new();
- private static readonly TimeSpan SourceCacheTtl = TimeSpan.FromMinutes(5);
-
public IOptimization Optimization { get; } = optimization;
[RelayCommand]
@@ -72,70 +63,10 @@ public partial class OptimizationDetailsViewModel(
if (Optimization is not BaseOptimization baseOpt || baseOpt.OwnerType == null)
return;
- var fileName = baseOpt.OwnerType.Name;
- var className = Optimization.OptimizationKey;
- var namespacePath = (baseOpt.OwnerType.Namespace ?? string.Empty).Replace('.', '/');
- var relativePath = $"{namespacePath}/{fileName}.cs";
- var url = $"{Shared.GitHubRepoURL}/blob/master/{relativePath}";
-
- // Fetch source from GitHub raw content to find the class line number
- try
- {
- var rawUrl =
- $"https://raw.githubusercontent.com/itsfatduck/optimizerDuck/master/{relativePath}";
-
- var cached = _sourceCache.GetOrAdd(rawUrl, CreateSourceCacheEntry);
-
- var cachedSource = await cached.Value;
- if (DateTime.UtcNow - cachedSource.FetchedAt >= SourceCacheTtl)
- {
- var refreshed = CreateSourceCacheEntry(rawUrl);
- _sourceCache[rawUrl] = refreshed;
- cachedSource = await refreshed.Value;
- }
-
- var source = cachedSource.Content;
-
- var lines = source.Split('\n');
- for (var i = 0; i < lines.Length; i++)
- if (lines[i].Contains($"class {className}", StringComparison.OrdinalIgnoreCase))
- {
- url += $"#L{i + 1}";
- break;
- }
- }
- catch (Exception ex)
- {
- logger.LogWarning(
- ex,
- "Could not fetch source to find line number for {Class}",
- className
- );
- }
-
- try
- {
- Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true });
- }
- catch (Exception ex)
- {
- logger.LogError(ex, "Failed to open GitHub URL: {Url}", url);
- snackbarService.Show(
- Translations.Snackbar_OpenLinkFailed_Title,
- Translations.Snackbar_OpenLinkFailed_Message,
- ControlAppearance.Danger,
- new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
- TimeSpan.FromSeconds(5)
- );
- }
- }
-
- private static Lazy<Task<(string Content, DateTime FetchedAt)>> CreateSourceCacheEntry(
- string rawUrl
- )
- {
- return new Lazy<Task<(string Content, DateTime FetchedAt)>>(async () =>
- (await httpClient.GetStringAsync(rawUrl), DateTime.UtcNow)
- );
+ await GitHubSourceHelper.OpenSourceOnGitHubAsync(
+ baseOpt.OwnerType,
+ Optimization.OptimizationKey,
+ logger: logger,
+ snackbarService: snackbarService);
}
}
diff --git a/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs b/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs
index 71e4c29..1c0cd3e 100644
--- a/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs
@@ -1,7 +1,4 @@
-using System.Collections.Concurrent;
using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Net.Http;
using System.Windows;
using System.Windows.Controls;
using CommunityToolkit.Mvvm.ComponentModel;
@@ -30,12 +27,6 @@ public partial class OptimizationCategoryViewModel : ViewModel
{
#region Cache & Constants
- private static readonly HttpClient httpClient = new() { Timeout = TimeSpan.FromSeconds(5) };
- private static readonly ConcurrentDictionary<
- string,
- Lazy<Task<(string Content, DateTime FetchedAt)>>
- > _sourceCache = new();
- private static readonly TimeSpan SourceCacheTtl = TimeSpan.FromMinutes(5);
private static readonly TimeSpan FilterDebounceDelay = TimeSpan.FromMilliseconds(250);
#endregion
@@ -388,68 +379,12 @@ public partial class OptimizationCategoryViewModel : ViewModel
if (optimization is not BaseOptimization baseOpt || baseOpt.OwnerType == null)
return;
- var fileName = baseOpt.OwnerType.Name;
- var className = optimization.OptimizationKey;
- var namespacePath = (baseOpt.OwnerType.Namespace ?? string.Empty).Replace('.', '/');
- var relativePath = $"{namespacePath}/{fileName}.cs";
- var url = $"{Shared.GitHubRepoURL}/blob/master/{relativePath}";
-
- // Fetch source from GitHub raw content to find the class line number
- try
- {
- var rawUrl =
- $"https://raw.githubusercontent.com/itsfatduck/optimizerDuck/master/{relativePath}";
-
- var cached = _sourceCache.GetOrAdd(rawUrl, CreateSourceCacheEntry);
-
- var cachedSource = await cached.Value;
- if (DateTime.UtcNow - cachedSource.FetchedAt >= SourceCacheTtl)
- {
- var refreshed = CreateSourceCacheEntry(rawUrl);
- _sourceCache[rawUrl] = refreshed;
- cachedSource = await refreshed.Value;
- }
-
- var source = cachedSource.Content;
-
- var lines = source.Split('\n');
- for (var i = 0; i < lines.Length; i++)
- if (
- lines[i]
- .Contains(
- $"class {className} : {nameof(BaseOptimization)}",
- StringComparison.OrdinalIgnoreCase
- )
- )
- {
- url += $"#L{i + 1}";
- break;
- }
- }
- catch (Exception ex)
- {
- _logger.LogWarning(
- ex,
- "Could not fetch source to find line number for {Class}",
- className
- );
- }
-
- try
- {
- Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true });
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Failed to open GitHub URL: {Url}", url);
- _snackbarService.Show(
- Translations.Snackbar_OpenLinkFailed_Title,
- Translations.Snackbar_OpenLinkFailed_Message,
- ControlAppearance.Danger,
- new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
- TimeSpan.FromSeconds(5)
- );
- }
+ await GitHubSourceHelper.OpenSourceOnGitHubAsync(
+ baseOpt.OwnerType,
+ optimization.OptimizationKey,
+ nameof(BaseOptimization),
+ _logger,
+ _snackbarService);
}
#endregion Commands
@@ -482,15 +417,6 @@ public partial class OptimizationCategoryViewModel : ViewModel
}
}
- private static Lazy<Task<(string Content, DateTime FetchedAt)>> CreateSourceCacheEntry(
- string rawUrl
- )
- {
- return new Lazy<Task<(string Content, DateTime FetchedAt)>>(async () =>
- (await httpClient.GetStringAsync(rawUrl), DateTime.UtcNow)
- );
- }
-
/// <summary>
/// Apply current filters to the optimizations.
/// </summary>
diff --git a/optimizerDuck/UI/ViewModels/Pages/BloatwareViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/BloatwareViewModel.cs
index 8c80dcf..1802d04 100644
--- a/optimizerDuck/UI/ViewModels/Pages/BloatwareViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/BloatwareViewModel.cs
@@ -22,7 +22,6 @@ public partial class BloatwareViewModel : ViewModel
private readonly BloatwareService _bloatwareService;
private readonly IContentDialogService _contentDialogService;
private readonly ILogger<BloatwareViewModel> _logger;
- private bool _isInitialized;
// Search, Filter, Sort
[ObservableProperty]
@@ -89,13 +88,8 @@ public partial class BloatwareViewModel : ViewModel
ApplyFilter();
}
- public override async Task OnNavigatedToAsync()
+ protected override async Task InitializeOnceAsync()
{
- if (_isInitialized)
- return;
-
- _isInitialized = true;
-
IsLoading = true;
var appxPackages = await _bloatwareService.GetAppXPackagesAsync();
_allPackages.AddRange(appxPackages);
diff --git a/optimizerDuck/UI/ViewModels/Pages/CustomizeCategoryViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/CustomizeCategoryViewModel.cs
index 4153c86..6231e3d 100644
--- a/optimizerDuck/UI/ViewModels/Pages/CustomizeCategoryViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/CustomizeCategoryViewModel.cs
@@ -1,7 +1,4 @@
-using System.Collections.Concurrent;
using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Net.Http;
using System.Windows;
using System.Windows.Media;
using CommunityToolkit.Mvvm.ComponentModel;
@@ -20,17 +17,6 @@ namespace optimizerDuck.UI.ViewModels.Pages;
public partial class CustomizeCategoryViewModel : ViewModel
{
- #region Cache & Constants
-
- private static readonly HttpClient httpClient = new() { Timeout = TimeSpan.FromSeconds(5) };
- private static readonly ConcurrentDictionary<
- string,
- (string Content, DateTime FetchedAt)
- > _sourceCache = new();
- private static readonly TimeSpan SourceCacheTtl = TimeSpan.FromMinutes(5);
-
- #endregion
-
#region Observable Properties
[ObservableProperty]
@@ -176,63 +162,9 @@ public partial class CustomizeCategoryViewModel : ViewModel
)
return;
- var fileName = baseSetting.OwnerType.Name;
- var className = baseSetting.FeatureKey;
- var namespacePath = (baseSetting.OwnerType.Namespace ?? string.Empty).Replace('.', '/');
- var relativePath = $"{namespacePath}/{fileName}.cs";
- var url = $"{Shared.GitHubRepoURL}/blob/master/{relativePath}";
-
- try
- {
- var rawUrl =
- $"https://raw.githubusercontent.com/itsfatduck/optimizerDuck/master/{relativePath}";
-
- string source;
- if (
- _sourceCache.TryGetValue(rawUrl, out var cached)
- && DateTime.UtcNow - cached.FetchedAt < SourceCacheTtl
- )
- {
- source = cached.Content;
- }
- else
- {
- source = await httpClient.GetStringAsync(rawUrl);
- _sourceCache[rawUrl] = (source, DateTime.UtcNow);
- }
-
- var lines = source.Split('\n');
- for (var i = 0; i < lines.Length; i++)
- {
- if (
- lines[i]
- .Contains(
- $"class {className} : {nameof(BaseCustomizeSetting)}",
- StringComparison.OrdinalIgnoreCase
- )
- )
- {
- url += $"#L{i + 1}";
- break;
- }
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(
- $"Could not fetch source to find line number for {className}: {ex.Message}"
- );
- }
-
- try
- {
- Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true });
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(
- $"Failed to open GitHub URL: {url}. Error: {ex.Message}"
- );
- }
+ await GitHubSourceHelper.OpenSourceOnGitHubAsync(
+ baseSetting.OwnerType,
+ baseSetting.FeatureKey,
+ nameof(BaseCustomizeSetting));
}
}
diff --git a/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs
index ba16cfd..189fcbb 100644
--- a/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs
@@ -26,8 +26,6 @@ public partial class DashboardViewModel : ViewModel
[ObservableProperty]
private ApplicationTheme _currentApplicationTheme = ApplicationTheme.Unknown;
- private bool _isInitialized;
-
[ObservableProperty]
private bool _isLoading;
@@ -84,30 +82,27 @@ public partial class DashboardViewModel : ViewModel
}
}
+ protected override async Task InitializeOnceAsync()
+ {
+ _systemInfoService.LogSummary();
+ var (result, version) = await _updaterService.CheckForUpdatesAsync();
+ if (result)
+ {
+ _updateNotified = true;
+ IsUpdateInfoOpen = true;
+ LatestVersion = version;
+ }
+ ApplicationThemeManager.Changed += OnThemeChanged;
+ }
+
public override async Task OnNavigatedToAsync()
{
+ await base.OnNavigatedToAsync();
+
if (IsLoading)
return;
- // Load system information when user navigates to the page
- // This will also update the runtime RAM info
await LoadSystemInfoAsync();
- if (!_isInitialized)
- {
- _systemInfoService.LogSummary();
- var (result, version) = await _updaterService.CheckForUpdatesAsync();
- if (result)
- {
- _updateNotified = true;
- IsUpdateInfoOpen = true;
- LatestVersion = version;
- }
- ApplicationThemeManager.Changed += OnThemeChanged;
-
- _isInitialized = true;
- }
-
- // Start the timer to update runtime infos
_updateTimer.Start();
}
diff --git a/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs
index 03463cb..6cd06c8 100644
--- a/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs
@@ -20,8 +20,6 @@ public partial class DiskCleanupViewModel(
[ObservableProperty]
private ObservableCollection<CleanupItem> _cleanupItems = [];
- private bool _initialized;
-
[ObservableProperty]
private bool _isCleaning;
@@ -56,12 +54,8 @@ public partial class DiskCleanupViewModel(
ApplySort();
}
- public override async Task OnNavigatedToAsync()
+ protected override async Task InitializeOnceAsync()
{
- if (_initialized)
- return;
- _initialized = true;
-
IsLoading = true;
try
{
@@ -90,6 +84,11 @@ public partial class DiskCleanupViewModel(
IsLoading = false;
UpdateProperties();
}
+ }
+
+ public override async Task OnNavigatedToAsync()
+ {
+ await base.OnNavigatedToAsync();
await ScanAsync();
@@ -97,7 +96,6 @@ public partial class DiskCleanupViewModel(
CleanupItems.OrderByDescending(i => i.SizeBytes).ToArray()
);
- // only select items with size > 0
foreach (var item in CleanupItems)
if (item.SizeBytes == 0)
item.IsSelected = false;
diff --git a/optimizerDuck/UI/ViewModels/Pages/OptimizeViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/OptimizeViewModel.cs
index 09a6c3e..c91e1b0 100644
--- a/optimizerDuck/UI/ViewModels/Pages/OptimizeViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/OptimizeViewModel.cs
@@ -8,17 +8,13 @@ namespace optimizerDuck.UI.ViewModels.Pages;
public class OptimizeViewModel(OptimizationRegistry optimizationService) : ViewModel
{
- private bool _isInitialized;
public ObservableCollection<NavigationViewItem> OptimizationCategories { get; } = [];
public event Action? OptimizationsLoaded;
- public override async Task OnNavigatedToAsync()
+ protected override async Task InitializeOnceAsync()
{
- if (_isInitialized)
- return;
-
await optimizationService.EnsurePreloadedAsync().ConfigureAwait(true);
foreach (var category in optimizationService.OptimizationCategories)
@@ -34,6 +30,5 @@ public class OptimizeViewModel(OptimizationRegistry optimizationService) : ViewM
);
OptimizationsLoaded?.Invoke();
- _isInitialized = true;
}
}
diff --git a/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs
index 4b77dbd..aa4a25e 100644
--- a/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs
@@ -22,7 +22,6 @@ public partial class ScheduledTasksViewModel : ViewModel
[ObservableProperty]
private bool _hideMicrosoftTasks = true;
- private bool _isInitialized;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotLoading))]
@@ -54,12 +53,8 @@ public partial class ScheduledTasksViewModel : ViewModel
public bool HasResults => Tasks.Count > 0;
public bool ShowRefreshButton => IsNotLoading && HasResults;
- public override async Task OnNavigatedToAsync()
+ protected override async Task InitializeOnceAsync()
{
- if (_isInitialized)
- return;
-
- _isInitialized = true;
await LoadDataAsync();
}
diff --git a/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
index 52afbae..b7061fe 100644
--- a/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
@@ -31,7 +31,6 @@ public partial class SettingsViewModel(
{
[ObservableProperty]
private ApplicationTheme _currentApplicationTheme = ApplicationTheme.Unknown;
- private bool _isInitialized;
[ObservableProperty]
private bool _removeProvisioned;
@@ -64,13 +63,7 @@ public partial class SettingsViewModel(
new() { DisplayName = "Português (BR)", Culture = new CultureInfo("pt-BR") },
];
- public override async Task OnNavigatedToAsync()
- {
- if (!_isInitialized)
- await InitializeViewModel();
- }
-
- private Task InitializeViewModel()
+ protected override Task InitializeOnceAsync()
{
SelectedCultureName = appOptionsMonitor.CurrentValue.App.Language;
ShellTimeoutMs = appOptionsMonitor.CurrentValue.Optimize.ShellTimeoutMs;
@@ -85,7 +78,6 @@ public partial class SettingsViewModel(
ApplicationThemeManager.Changed += OnThemeChanged;
- _isInitialized = true;
return Task.CompletedTask;
}
@@ -262,7 +254,7 @@ public partial class SettingsViewModel(
[RelayCommand]
private async Task ToggleRemoveProvisioned()
{
- if (!_isInitialized)
+ if (!IsInitialized)
return;
try
{
@@ -282,7 +274,7 @@ public partial class SettingsViewModel(
[RelayCommand]
private async Task ToggleShowCompletionNotification()
{
- if (!_isInitialized)
+ if (!IsInitialized)
return;
try
{
@@ -308,7 +300,7 @@ public partial class SettingsViewModel(
[RelayCommand]
private async Task ToggleSmoothScrolling()
{
- if (!_isInitialized)
+ if (!IsInitialized)
return;
try
{
@@ -362,7 +354,7 @@ public partial class SettingsViewModel(
partial void OnSelectedCultureNameChanged(string value)
{
- if (!_isInitialized)
+ if (!IsInitialized)
return;
if (string.IsNullOrEmpty(value))
return;
@@ -399,7 +391,7 @@ public partial class SettingsViewModel(
ApplicationTheme newValue
)
{
- if (!_isInitialized)
+ if (!IsInitialized)
return;
ApplicationThemeManager.Apply(newValue, updateAccent: false);
@@ -417,7 +409,7 @@ public partial class SettingsViewModel(
partial void OnShellTimeoutMsChanged(int value)
{
- if (!_isInitialized)
+ if (!IsInitialized)
return;
if (value <= 0)
return;
diff --git a/optimizerDuck/UI/ViewModels/Pages/StartupManagerViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/StartupManagerViewModel.cs
index 9444727..23cd952 100644
--- a/optimizerDuck/UI/ViewModels/Pages/StartupManagerViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/StartupManagerViewModel.cs
@@ -31,7 +31,6 @@ public partial class StartupManagerViewModel : ViewModel
[ObservableProperty]
private bool _hideMicrosoftTasks = true;
- private bool _isInitialized;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsNotLoading))]
@@ -68,12 +67,8 @@ public partial class StartupManagerViewModel : ViewModel
public bool HasResults => Apps.Count > 0 || Tasks.Count > 0;
public bool ShowRefreshButton => IsNotLoading && HasResults;
- public override async Task OnNavigatedToAsync()
+ protected override async Task InitializeOnceAsync()
{
- if (_isInitialized)
- return;
-
- _isInitialized = true;
await LoadDataAsync();
}
diff --git a/optimizerDuck/UI/ViewModels/ViewModel.cs b/optimizerDuck/UI/ViewModels/ViewModel.cs
index 2c02da2..f4a4893 100644
--- a/optimizerDuck/UI/ViewModels/ViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/ViewModel.cs
@@ -14,11 +14,21 @@ namespace optimizerDuck.UI.ViewModels;
/// </remarks>
public abstract class ViewModel : ObservableValidator, INavigationAware
{
- public virtual Task OnNavigatedToAsync()
+ private bool _isInitialized;
+
+ protected bool IsInitialized => _isInitialized;
+
+ protected virtual Task InitializeOnceAsync() => Task.CompletedTask;
+
+ public virtual async Task OnNavigatedToAsync()
{
- OnNavigatedTo();
+ if (!_isInitialized)
+ {
+ await InitializeOnceAsync();
+ _isInitialized = true;
+ }
- return Task.CompletedTask;
+ OnNavigatedTo();
}
public virtual Task OnNavigatedFromAsync()