Skip to content

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

docs(readme): add localization readmes (vi and tw)

fatDuck128ab722980d
diff --git a/README.md b/README.md
index d165d9e..612b091 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
[![.NET Latest](https://img.shields.io/badge/.NET_Runtime-Latest-ef99dd?style=flat-square)](https://dotnet.microsoft.com/en-us/download)
[![Supported OS](https://img.shields.io/badge/Supported-Windows_10%2B_x64-0078d4?style=flat-square)](https://www.microsoft.com/en-us/software-download/)
-[Quick Start](#quick-start) • [Highlights](#highlights) • [Safety](#safety) • [Community](#community) • [License](#license)
+English | [Tiếng Việt](README.vi.md) | [繁體中文](README.zh-TW.md)
<details>
<summary>⭐ Star History</summary>
diff --git a/README.vi.md b/README.vi.md
new file mode 100644
index 0000000..bf7217c
--- /dev/null
+++ b/README.vi.md
@@ -0,0 +1,195 @@
+<div align="center">
+
+<a href="https://optimizerduck.vercel.app/"><img src="./.github/assets/optimizerDuck.png" alt="optimizerDuck Banner" title="optimizerDuck"/></a>
+
+# [optimizerDuck](https://optimizerduck.vercel.app/)
+
+**optimizerDuck là một công cụ tối ưu hóa Windows miễn phí, mã nguồn mở được xây dựng nhằm mục đích hiệu suất, quyền riêng tư và sự đơn giản.**
+
+[![Release](https://img.shields.io/github/release/itsfatduck/optimizerDuck?color=fed114&label=Phi%C3%AAn%20b%E1%BA%A3n&style=flat-square)](https://github.com/itsfatduck/optimizerDuck/releases/latest)
+[![Downloads](https://img.shields.io/github/downloads/itsfatduck/optimizerDuck/total?label=L%C6%B0%E1%BB%A3t%20t%E1%BA%A3i&style=flat-square&color=lightgreen)](https://github.com/itsfatduck/optimizerDuck/releases)
+[![Stars](https://img.shields.io/endpoint?url=https://api.pinstudios.net/api/badges/stars/itsfatduck/optimizerDuck&style=flat-square)](https://github.com/itsfatduck/optimizerDuck/stargazers)
+[![License](https://img.shields.io/badge/Gi%E1%BA%A5y%20ph%C3%A9p-GPL_v3-red?style=flat-square)](./LICENSE)
+[![Discord](https://img.shields.io/discord/1091675679994675240?color=5865f2&label=Discord&style=flat-square)](https://discord.gg/tDUBDCYw9Q)
+<br>
+[![CI](https://github.com/itsfatduck/optimizerDuck/actions/workflows/ci.yml/badge.svg)](https://github.com/itsfatduck/optimizerDuck/actions/workflows/ci.yml)
+[![.NET Latest](https://img.shields.io/badge/.NET_Runtime-M%E1%BB%9Bi%20nh%E1%BA%A5t-ef99dd?style=flat-square)](https://dotnet.microsoft.com/en-us/download)
+[![Supported OS](https://img.shields.io/badge/H%E1%BB%87%20%C4%91i%E1%BB%81u%20h%C3%A0nh-Windows_10%2B_x64-0078d4?style=flat-square)](https://www.microsoft.com/en-us/software-download/)
+
+[English](README.md) | Tiếng Việt | [繁體中文](README.zh-TW.md)
+
+<details>
+<summary>⭐ Lịch sử Star</summary>
+
+Nếu optimizerDuck giúp ích cho PC của bạn, hãy cân nhắc tặng repo một ⭐ và chia sẻ nó với người khác.
+Mỗi ngôi sao giúp tạo động lực cho những cải tiến trong tương lai.
+
+<a href="https://www.star-history.com/#itsfatduck/optimizerDuck&type=timeline&legend=top-left">
+ <picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=itsfatduck/optimizerDuck&type=timeline&theme=dark&legend=top-left" />
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=itsfatduck/optimizerDuck&type=timeline&legend=top-left" />
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=itsfatduck/optimizerDuck&type=timeline&legend=top-left" />
+ </picture>
+</a>
+
+</details>
+
+<img src="./.github/assets/app.png" alt="optimizerDuck Chế độ tối" title="optimizerDuck Chế độ tối" width="800"/>
+
+</div>
+
+---
+
+## Bắt đầu nhanh
+
+1. Tải về từ **GitHub** → https://github.com/itsfatduck/optimizerDuck/releases/latest
+2. Chạy tệp `.exe` (không cần cài đặt)
+3. Khởi động lại PC sau khi áp dụng các thay đổi
+
+> [!TIP]
+> Luôn tạo một **điểm khôi phục (restore point)** trước khi thực hiện các thay đổi hệ thống.
+
+> [!NOTE]
+> Hỗ trợ tiếng Anh, tiếng Việt và tiếng Trung phồn thể (cảm ơn các cộng tác viên của chúng tôi! [@abc0922001](https://github.com/abc0922001)). Bạn muốn thêm ngôn ngữ của mình? [Đóng góp tại đây](./.github/CONTRIBUTING.md).
+
+---
+
+## Điểm nổi bật
+
+Hơn 35 tối ưu hóa trong 6 danh mục, cùng với các công cụ tích hợp để quản lý hệ thống của bạn. Tất cả đều có chỉ báo rủi ro rõ ràng và hoàn tác chỉ với một cú nhấp chuột.
+
+| | Tính năng | Công dụng |
+| :-- | :---------------------- | :------------------------------------------------------------------------ |
+| 🚀 | **Hiệu suất & Nguồn điện** | Tăng tốc hệ thống, vô hiệu hóa các dịch vụ rác, tinh chỉnh cài đặt nguồn điện. |
+| 🛡️ | **Bảo vệ quyền riêng tư** | Tắt đo lường từ xa, Cortana, Copilot, quảng cáo và theo dõi. Lấy lại dữ liệu của bạn. |
+| 🎮 | **Tinh chỉnh GPU** | Các tinh chỉnh dành riêng cho nhà sản xuất. AMD, NVIDIA hoặc Intel. |
+| 🧩 | **Bật/Tắt tính năng** | Dễ dàng bật hoặc tắt các tính năng khác nhau của Windows. |
+| 🧹 | **Dọn dẹp ổ đĩa** | Xóa các tệp tạm thời, bộ nhớ cache, bản cài đặt Windows cũ. Lấy lại dung lượng ổ đĩa. |
+| 🗑️ | **Gỡ bỏ Bloatware** | Loại bỏ các ứng dụng Windows được cài đặt sẵn. Chỉ báo rủi ro giúp bạn quyết định. |
+| ⚡ | **Quản lý khởi động** | Kiểm soát các ứng dụng chạy khi khởi động. Giữ lại những gì bạn cần, tắt phần còn lại. |
+| 📋 | **Tác vụ đã lên lịch** | Xem, chạy, dừng hoặc xóa các tác vụ đã lên lịch của Windows. Kiểm soát hoàn toàn. |
+| 💻 | **Bảng điều khiển hệ thống** | Xem thông tin CPU, RAM, GPU, Lưu trữ và Hệ điều hành của bạn một cách nhanh chóng. |
+| 🔄 | **Hoàn tác thay đổi** | Bạn đã nhầm lẫn? Một cú nhấp chuột để hoàn tác bất kỳ thay đổi nào. |
+| 🎨 | **Giao diện sạch sẽ** | Chủ đề Tối, Sáng hoặc Độ tương phản cao. Thiết kế Fluent hiện đại. |
+| 🌐 | **Đa ngôn ngữ** | Tiếng Anh, tiếng Việt, tiếng Trung phồn thể. |
+| 🔒 | **Chạy ngoại tuyến** | Không đo lường từ xa, không quảng cáo, không thu thập dữ liệu. Mọi thứ chạy cục bộ. |
+
+---
+
+## Danh mục tối ưu hóa
+
+Các tối ưu hóa tích hợp trong 6 danh mục, mỗi danh mục đều có giải thích rõ ràng và mức độ rủi ro:
+
+- **Hiệu suất**: Tinh chỉnh máy chủ dịch vụ, tinh chỉnh mức độ ưu tiên, tốc độ bàn phím, tinh chỉnh chơi game.
+- **Bảo mật & Quyền riêng tư**: Đo lường từ xa, báo cáo lỗi, Cortana, Copilot, quảng cáo, theo dõi vị trí.
+- **GPU**: Các tinh chỉnh dành riêng cho nhà sản xuất cho GPU AMD, NVIDIA hoặc Intel.
+- **Quản lý nguồn điện**: Ngủ đông, khởi động nhanh, tiết kiệm điện USB, gói nguồn điện tùy chỉnh.
+- **Bloatware & Dịch vụ**: Loại bỏ các ứng dụng được cài đặt sẵn. Tinh chỉnh hơn 200 dịch vụ Windows.
+- **Trải nghiệm người dùng**: Tốc độ Explorer, hiệu ứng hình ảnh, độ trễ menu.
+
+---
+
+## Bật/Tắt tính năng
+
+Bạn không chỉ có thể áp dụng các tối ưu hóa hệ thống mà còn có thể dễ dàng bật hoặc tắt các tính năng khác nhau của Windows. Không cần phải lục lọi trong registry hay tìm kiếm vô tận trên Google. Mọi thứ đều có sẵn trong một giao diện sạch sẽ, trực quan và thân thiện với người dùng.
+
+- **Màn hình nền**: Hiển thị/ẩn các biểu tượng (This PC, Thùng rác, Mạng, Tệp người dùng, Bảng điều khiển), xóa mũi tên phím tắt.
+- **Thanh tác vụ**: Căn giữa, widget, nút Task View, nút End Task, hiển thị giây trong đồng hồ, tắt tìm kiếm Bing.
+- **Giao diện**: Chế độ tối cho ứng dụng và hệ thống.
+- **Explorer**: Phần mở rộng tệp, tệp ẩn, lịch sử clipboard, chế độ thu gọn, hỗ trợ snap, hộp kiểm mục, menu chuột phải cổ điển.
+- **Chơi game**: Chế độ Game Mode, Game Bar, quay video nền, tăng tốc chuột, tối ưu hóa toàn màn hình, lập lịch GPU tăng tốc phần cứng.
+- **Hệ thống**: Tự động bật Num Lock khi khởi động.
+
+---
+
+## Các công cụ tích hợp
+
+- **Bảng điều khiển**: Tổng quan về phần cứng theo thời gian thực.
+- **Quản lý khởi động**: Kiểm soát các ứng dụng khởi động. Lọc, tìm kiếm, bật/tắt.
+- **Tác vụ đã lên lịch**: Quản lý tác vụ đầy đủ.
+- **Dọn dẹp ổ đĩa**: Quét, chọn, dọn dẹp. Đơn giản vậy thôi.
+- **Gỡ bỏ Bloatware**: Danh sách với các mức độ rủi ro. Lọc và loại bỏ an toàn.
+
+---
+
+## An toàn
+
+optimizerDuck được thiết kế với sự an toàn được đặt lên hàng đầu. Chúng tôi hiểu rằng việc sửa đổi cài đặt hệ thống có thể rủi ro, vì vậy chúng tôi đã triển khai nhiều biện pháp bảo vệ.
+
+Xem [Chính sách bảo mật](./PRIVACY.md) để biết chi tiết về cam kết của chúng tôi đối với quyền riêng tư và bảo mật dữ liệu của người dùng.
+
+- **Sao lưu mọi thứ**: Mọi thay đổi đều được sao lưu trong một thư mục cục bộ, cho phép bạn khôi phục từng tinh chỉnh hoặc toàn bộ hệ thống.
+- **Hoàn tác bằng một cú nhấp chuột**: Bạn đã nhầm lẫn? Chỉ cần nhấp vào "Hoàn tác" để rút lại thay đổi cuối cùng bạn đã thực hiện.
+- **Mức độ rủi ro**: Xem mức độ rủi ro của từng tinh chỉnh trước khi áp dụng. Chúng tôi phân loại chúng thành Thấp, Trung bình hoặc Cao dựa trên tác động tiềm tàng.
+- **Không ép buộc thay đổi**: Bạn chọn tối ưu hóa nào để áp dụng. Không có gì được bật theo mặc định.
+- **Khuyến nghị điểm khôi phục**: Luôn khuyến nghị tạo điểm khôi phục Windows trước khi áp dụng các thay đổi để thêm một lớp an toàn.
+
+---
+
+## Tài liệu
+
+### [Tài liệu chính thức](https://optimizerduck.vercel.app/docs/guides/getting-started)
+
+Hướng dẫn từng bước, giải thích về từng tối ưu hóa và các phương pháp hay nhất để sử dụng optimizerDuck.
+
+---
+
+## Cộng đồng
+
+> [!TIP]
+> Tham gia cộng đồng đang phát triển của chúng tôi trên Discord! Nhận hỗ trợ, chia sẻ kinh nghiệm và kết nối với những người dùng và cộng tác viên khác.
+>
+> <a href="https://discord.gg/tDUBDCYw9Q"><img src="https://discord.com/api/guilds/1091675679994675240/widget.png?style=banner2" alt="Discord Banner 2"/></a>
+
+Nếu optimizerDuck đã giúp ích cho PC của bạn:
+
+- ⭐ Tặng sao cho repo
+- 💬 Tham gia Discord để được hỗ trợ
+- 🐞 Báo cáo lỗi trên GitHub
+- 🎁 Hỗ trợ dự án [tại đây](https://optimizerduck.vercel.app/docs/contribute/support-me)
+
+### Liên kết
+
+- 🌐 [Trang web](https://optimizerduck.vercel.app/)
+- 📖 [Tài liệu](https://optimizerduck.vercel.app/docs/guides/getting-started)
+- 💬 [Discord](https://discord.gg/tDUBDCYw9Q)
+- 🐞 [Vấn đề (Issues)](https://github.com/itsfatduck/optimizerDuck/issues)
+
+Mọi đóng góp đều hữu ích! Cho dù đó là báo cáo lỗi, đề xuất tính năng mới hay chỉ là chia sẻ trải nghiệm của bạn, chúng tôi đều trân trọng.
+
+---
+
+## Tuyên bố từ chối trách nhiệm
+
+optimizerDuck được cung cấp **"nguyên trạng"**, không bảo hành.
+
+Bằng cách sử dụng công cụ này, bạn đồng ý rằng các tác giả không chịu trách nhiệm về sự không ổn định của hệ thống, mất mát dữ liệu hoặc các vấn đề từ phần mềm bên thứ ba hoặc các sửa đổi của người dùng.
+
+Luôn tạo một **điểm khôi phục** trước khi áp dụng các thay đổi.
+
+> [!NOTE]
+> optimizerDuck sửa đổi cài đặt hệ thống và registry. Tự chịu rủi ro khi sử dụng. Chúng tôi khuyên bạn nên sao lưu dữ liệu quan trọng và tạo điểm khôi phục trước khi thực hiện các thay đổi.
+>
+> Xem [Điều khoản dịch vụ](./TERMS.md), [Chính sách bảo mật](./PRIVACY.md) và [Tuyên bố từ chối trách nhiệm](./DISCLAIMER.md) để biết thêm thông tin.
+
+---
+
+## Giấy phép
+
+<div align="center">
+
+<a href="./LICENSE">
+<img src=".github/assets/gplv3.png" alt="GPL v3 License" title="GPL v3 License"/>
+</a>
+
+**[Giấy phép GPL v3](https://www.gnu.org/licenses/gpl-3.0.en.html)**<br>Xem [LICENSE](./LICENSE).
+
+</div>
+
+<div align="center">
+
+## Cảm ơn tất cả các người đóng góp ❤️
+
+[![Contributors](https://contrib.rocks/image?repo=itsfatduck/optimizerDuck)](https://github.com/itsfatduck/optimizerDuck/graphs/contributors)
+
+</div>
\ No newline at end of file
diff --git a/README.zh-TW.md b/README.zh-TW.md
new file mode 100644
index 0000000..fcf6593
--- /dev/null
+++ b/README.zh-TW.md
@@ -0,0 +1,195 @@
+<div align="center">
+
+<a href="https://optimizerduck.vercel.app/"><img src="./.github/assets/optimizerDuck.png" alt="optimizerDuck Banner" title="optimizerDuck"/></a>
+
+# [optimizerDuck](https://optimizerduck.vercel.app/)
+
+**optimizerDuck 是一款免費、開源的 Windows 優化工具,旨在提供性能、隱私和簡單性。**
+
+[![Release](https://img.shields.io/github/release/itsfatduck/optimizerDuck?color=fed114&label=%E7%99%BC%E4%BD%88&style=flat-square)](https://github.com/itsfatduck/optimizerDuck/releases/latest)
+[![Downloads](https://img.shields.io/github/downloads/itsfatduck/optimizerDuck/total?label=%E4%B8%8B%E8%BC%89%E9%87%8F&style=flat-square&color=lightgreen)](https://github.com/itsfatduck/optimizerDuck/releases)
+[![Stars](https://img.shields.io/endpoint?url=https://api.pinstudios.net/api/badges/stars/itsfatduck/optimizerDuck&style=flat-square)](https://github.com/itsfatduck/optimizerDuck/stargazers)
+[![License](https://img.shields.io/badge/%E6%8E%88%E6%AC%8A-GPL_v3-red?style=flat-square)](./LICENSE)
+[![Discord](https://img.shields.io/discord/1091675679994675240?color=5865f2&label=Discord&style=flat-square)](https://discord.gg/tDUBDCYw9Q)
+<br>
+[![CI](https://github.com/itsfatduck/optimizerDuck/actions/workflows/ci.yml/badge.svg)](https://github.com/itsfatduck/optimizerDuck/actions/workflows/ci.yml)
+[![.NET Latest](https://img.shields.io/badge/.NET_Runtime-%E6%9C%80%E6%96%B0-ef99dd?style=flat-square)](https://dotnet.microsoft.com/en-us/download)
+[![Supported OS](https://img.shields.io/badge/%E6%94%AF%E6%8F%B4%E7%B3%BB%E7%B5%B1-Windows_10%2B_x64-0078d4?style=flat-square)](https://www.microsoft.com/en-us/software-download/)
+
+[English](README.md) | [Tiếng Việt](README.vi.md) | 繁體中文
+
+<details>
+<summary>⭐ 星星歷史</summary>
+
+如果 optimizerDuck 幫助改善了您的電腦,請考慮給這個倉庫一個 ⭐ 並分享給他人。
+每一顆星都助於激勵未來的改進。
+
+<a href="https://www.star-history.com/#itsfatduck/optimizerDuck&type=timeline&legend=top-left">
+ <picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=itsfatduck/optimizerDuck&type=timeline&theme=dark&legend=top-left" />
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=itsfatduck/optimizerDuck&type=timeline&legend=top-left" />
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=itsfatduck/optimizerDuck&type=timeline&legend=top-left" />
+ </picture>
+</a>
+
+</details>
+
+<img src="./.github/assets/app.png" alt="optimizerDuck 深色模式" title="optimizerDuck 深色模式" width="800"/>
+
+</div>
+
+---
+
+## 快速開始
+
+1. 從 **GitHub** 下載 → https://github.com/itsfatduck/optimizerDuck/releases/latest
+2. 執行 `.exe`(無需安裝)
+3. 應用更改後重新啟動您的電腦
+
+> [!TIP]
+> 在進行系統更改之前,請務必建立**還原點**。
+
+> [!NOTE]
+> 支援英文、越南文和繁體中文(感謝我們的貢獻者! [@abc0922001](https://github.com/abc0922001))。想加入您的語言嗎?[在此貢獻](./.github/CONTRIBUTING.md)。
+
+---
+
+## 亮點
+
+超過 35 種優化,分為 6 個類別,並內建工具來管理您的系統。所有功能都帶有清晰的風險指示和一鍵還原。
+
+| | 功能 | 作用 |
+| :-- | :---------------------- | :------------------------------------------------------------------------ |
+| 🚀 | **性能與電源** | 加速系統、禁用臃腫服務、調整電源設置。 |
+| 🛡️ | **隱私保護** | 關閉遙測、Cortana、Copilot、廣告和追踪。取回您的數據。 |
+| 🎮 | **GPU 調整** | 廠商特定的調整。AMD、NVIDIA 或 Intel。 |
+| 🧩 | **功能切換** | 輕鬆啟用或禁用各種 Windows 功能。 |
+| 🧹 | **磁碟清理** | 清理臨時文件、快取、舊的 Windows 安裝。回收磁碟空間。 |
+| 🗑️ | **臃腫軟體卸載** | 刪除預裝的 Windows 應用。風險指示助您決定。 |
+| ⚡ | **啟動管理** | 控制啟動時執行的應用。保留您需要的,禁用其餘的。 |
+| 📋 | **排程工作** | 查看、執行、停止或刪除 Windows 排程工作。完全控制。 |
+| 💻 | **系統儀表板** | 一目了然查看您的 CPU、RAM、GPU、儲存和作業系統資訊。 |
+| 🔄 | **還原更改** | 犯了錯誤?一鍵撤銷任何更改。 |
+| 🎨 | **簡潔介面** | 深色、淺色或高對比主題。現代 Fluent 設計。 |
+| 🌐 | **多語言** | 英文、越南文、繁體中文。 |
+| 🔒 | **離線執行** | 無遙測、無廣告、無數據收集。一切都在本地執行。 |
+
+---
+
+## 優化類別
+
+內建 6 個類別的優化,每個類別都有清晰的解釋和風險等級:
+
+- **性能**:服務主機調整、優先級調整、鍵盤速度、遊戲調整。
+- **安全與隱私**:遙測、錯誤報告、Cortana、Copilot、廣告、位置追踪。
+- **GPU**:針對 AMD、NVIDIA 或 Intel GPU 的廠商特定調整。
+- **電源管理**:休眠、快速啟動、USB 節電、自定義電源計劃。
+- **臃腫軟體與服務**:刪除預裝應用。精細調整 200 多個 Windows 服務。
+- **使用者體驗**:檔案總管速度、視覺效果、選單延遲。
+
+---
+
+## 功能切換
+
+您不僅可以應用系統優化,還可以輕鬆啟用或禁用各種 Windows 功能。無需挖掘註冊表或在 Google 上無休止地搜尋。一切都可以在簡潔、直觀且使用者友好的介面中完成。
+
+- **桌面**:顯示/隱藏圖示(本機、資源回收筒、網路、使用者文件、控制台),刪除捷徑箭頭。
+- **工作列**:居中對齊、小組件、工作檢視按鈕、結束工作按鈕、在時鐘中顯示秒數、禁用 Bing 搜尋。
+- **外觀**:應用程式和系統的深色模式。
+- **檔案總管**:副檔名、隱藏文件、剪貼簿歷史、精簡模式、貼齊輔助、項目選取框、傳統右鍵選單。
+- **遊戲**:遊戲模式、遊戲列、背景錄製、滑鼠加速、全螢幕優化、硬體加速 GPU 排程。
+- **系統**:啟動時自動啟用 Num Lock。
+
+---
+
+## 內建工具
+
+- **儀表板**:實時硬體概覽。
+- **啟動管理**:控制啟動應用。過濾、搜尋、啟用/禁用。
+- **排程工作**:完整的任務管理。
+- **磁碟清理**:掃描、選擇、清理。就這麼簡單。
+- **臃腫軟體卸載**:帶有風險等級的列表。過濾並安全刪除。
+
+---
+
+## 安全
+
+optimizerDuck 在設計時充分考慮了安全性。我們深知修改系統設置可能存在風險,因此我們實施了多重保障措施。
+
+有關我們對使用者隱私和數據安全承諾的詳細資訊,請參閱 [隱私政策](./PRIVACY.md)。
+
+- **備份一切**:每次更改都備份在本地文件夾中,允許您還原單個調整或整個系統。
+- **一鍵還原**:犯了錯誤?只需點擊“還原”即可撤銷您所做的最後一次更改。
+- **風險等級**:在應用每個調整之前查看其風險等級。我們根據潛在影響將其分為低、中、高風險。
+- **不強制更改**:您選擇要應用的優化。預設情況下不啟用任何內容。
+- **建議還原點**:始終建議在應用更改之前建立 Windows 還原點,以增加一層安全性。
+
+---
+
+## 文件
+
+### [官方文件](https://optimizerduck.vercel.app/docs/guides/getting-started)
+
+分步說明、每項優化的解釋以及使用 optimizerDuck 的最佳實踐。
+
+---
+
+## 社群
+
+> [!TIP]
+> 加入我們不斷壯大的 Discord 社群!獲取支援、分享您的經驗,並與其他使用者和貢獻者建立聯繫。
+>
+> <a href="https://discord.gg/tDUBDCYw9Q"><img src="https://discord.com/api/guilds/1091675679994675240/widget.png?style=banner2" alt="Discord Banner 2"/></a>
+
+如果 optimizerDuck 幫助了您的電腦:
+
+- ⭐ 給倉庫點星
+- 💬 加入 Discord 獲取支援
+- 🐞 在 GitHub 上報告錯誤
+- 🎁 在此[支持項目](https://optimizerduck.vercel.app/docs/contribute/support-me)
+
+### 連結
+
+- 🌐 [網站](https://optimizerduck.vercel.app/)
+- 📖 [文件](https://optimizerduck.vercel.app/docs/guides/getting-started)
+- 💬 [Discord](https://discord.gg/tDUBDCYw9Q)
+- 🐞 [問題 (Issues)](https://github.com/itsfatduck/optimizerDuck/issues)
+
+每一份貢獻都有幫助!無論是錯誤報告、新功能建議,還是僅僅分享您的經驗,我們都深表感謝。
+
+---
+
+## 免責聲明
+
+optimizerDuck 按 **"原樣"** 提供,不提供任何形式的保證。
+
+使用本工具即表示您同意作者不對系統不穩定、數據丟失或來自第三方軟體或使用者修改的問題負責。
+
+在應用更改之前,請務必建立**還原點**。
+
+> [!NOTE]
+> optimizerDuck 會修改系統設置和註冊表。使用風險自負。我們建議在進行更改之前備份重要數據並建立還原點。
+>
+> 欲了解更多資訊,請參閱 [服務條款](./TERMS.md)、[隱私政策](./PRIVACY.md) 和 [免責聲明](./DISCLAIMER.md)。
+
+---
+
+## 授權
+
+<div align="center">
+
+<a href="./LICENSE">
+<img src=".github/assets/gplv3.png" alt="GPL v3 License" title="GPL v3 License"/>
+</a>
+
+**[GPL v3 授權](https://www.gnu.org/licenses/gpl-3.0.en.html)**<br>參見 [LICENSE](./LICENSE)。
+
+</div>
+
+<div align="center">
+
+## 感謝所有貢獻者 ❤️
+
+[![Contributors](https://contrib.rocks/image?repo=itsfatduck/optimizerDuck)](https://github.com/itsfatduck/optimizerDuck/graphs/contributors)
+
+</div>
\ No newline at end of file
diff --git a/optimizerDuck.Test/Services/Managers/RevertManagerTests.cs b/optimizerDuck.Test/Services/Managers/RevertManagerTests.cs
index 669edf2..b89bc1f 100644
--- a/optimizerDuck.Test/Services/Managers/RevertManagerTests.cs
+++ b/optimizerDuck.Test/Services/Managers/RevertManagerTests.cs
@@ -38,7 +38,7 @@ public class RevertManagerTests
OptimizationId = id,
OptimizationName = "TestOptimization",
AppliedAt = DateTime.UtcNow,
- Steps = new List<RevertStepData>()
+ Steps = new List<RevertStepData>(),
};
try
@@ -70,7 +70,10 @@ public class RevertManagerTests
{
await File.WriteAllTextAsync(path, "{ invalid json }", cancellationToken);
- var manager = new RevertManager(NullLogger<RevertManager>.Instance, NullLoggerFactory.Instance);
+ var manager = new RevertManager(
+ NullLogger<RevertManager>.Instance,
+ NullLoggerFactory.Instance
+ );
var op = new MockOptimization(id);
var result = await manager.RevertAsync(op);
@@ -104,8 +107,8 @@ public class RevertManagerTests
Data = new ShellRevertStep
{
ShellType = ShellType.CMD,
- Command = "exit 0"
- }.ToData()
+ Command = "exit 0",
+ }.ToData(),
},
new()
{
@@ -113,10 +116,10 @@ public class RevertManagerTests
Data = new ShellRevertStep
{
ShellType = ShellType.CMD,
- Command = "exit 1"
- }.ToData()
- }
- }
+ Command = "exit 1",
+ }.ToData(),
+ },
+ },
};
try
@@ -124,7 +127,10 @@ public class RevertManagerTests
var json = JsonConvert.SerializeObject(payload, Formatting.Indented);
await File.WriteAllTextAsync(path, json, cancellationToken);
- var manager = new RevertManager(NullLogger<RevertManager>.Instance, NullLoggerFactory.Instance);
+ var manager = new RevertManager(
+ NullLogger<RevertManager>.Instance,
+ NullLoggerFactory.Instance
+ );
var result = await manager.RevertAsync(new MockOptimization(id));
Assert.False(result.Success);
@@ -160,10 +166,10 @@ public class RevertManagerTests
Data = new ShellRevertStep
{
ShellType = ShellType.CMD,
- Command = "exit 1"
- }.ToData()
- }
- }
+ Command = "exit 1",
+ }.ToData(),
+ },
+ },
};
try
@@ -171,7 +177,10 @@ public class RevertManagerTests
var json = JsonConvert.SerializeObject(payload, Formatting.Indented);
await File.WriteAllTextAsync(path, json, cancellationToken);
- var manager = new RevertManager(NullLogger<RevertManager>.Instance, NullLoggerFactory.Instance);
+ var manager = new RevertManager(
+ NullLogger<RevertManager>.Instance,
+ NullLoggerFactory.Instance
+ );
var result = await manager.RevertAsync(new MockOptimization(id));
Assert.False(result.Success);
@@ -208,8 +217,8 @@ public class RevertManagerTests
Data = new ShellRevertStep
{
ShellType = ShellType.CMD,
- Command = "exit 0"
- }.ToData()
+ Command = "exit 0",
+ }.ToData(),
},
new()
{
@@ -217,10 +226,10 @@ public class RevertManagerTests
Data = new RetryableTestRevertStep
{
StepId = Guid.NewGuid().ToString("N"),
- RemainingFailures = 1
- }.ToData()
- }
- }
+ RemainingFailures = 1,
+ }.ToData(),
+ },
+ },
};
try
@@ -228,7 +237,10 @@ public class RevertManagerTests
var json = JsonConvert.SerializeObject(payload, Formatting.Indented);
await File.WriteAllTextAsync(path, json, cancellationToken);
- var manager = new RevertManager(NullLogger<RevertManager>.Instance, NullLoggerFactory.Instance);
+ var manager = new RevertManager(
+ NullLogger<RevertManager>.Instance,
+ NullLoggerFactory.Instance
+ );
var result = await manager.RevertAsync(new MockOptimization(id));
Assert.False(result.Success);
@@ -256,7 +268,10 @@ public class MockOptimization(Guid id) : IOptimization
public string ShortDescription => "Mock description";
public OptimizationState State { get; set; } = new();
- public Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ public Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
return Task.FromResult(ApplyResult.True());
}
@@ -290,7 +305,7 @@ public class RetryableTestRevertStep : IRevertStep
return new JObject
{
[nameof(StepId)] = StepId,
- [nameof(RemainingFailures)] = RemainingFailures
+ [nameof(RemainingFailures)] = RemainingFailures,
};
}
@@ -299,7 +314,7 @@ public class RetryableTestRevertStep : IRevertStep
return new RetryableTestRevertStep
{
StepId = data[nameof(StepId)]?.ToString() ?? Guid.NewGuid().ToString("N"),
- RemainingFailures = data[nameof(RemainingFailures)]?.Value<int>() ?? 0
+ RemainingFailures = data[nameof(RemainingFailures)]?.Value<int>() ?? 0,
};
}
}
diff --git a/optimizerDuck.Test/Services/OptimizationExecutionContextTests.cs b/optimizerDuck.Test/Services/OptimizationExecutionContextTests.cs
index ac376f1..20e4fb1 100644
--- a/optimizerDuck.Test/Services/OptimizationExecutionContextTests.cs
+++ b/optimizerDuck.Test/Services/OptimizationExecutionContextTests.cs
@@ -125,7 +125,8 @@ public class ExecutionScopeTests
using var scope = ExecutionScope.Begin(new MockOptimization(), logger);
Assert.Throws<InvalidOperationException>(() =>
- ExecutionScope.Begin(new MockOptimization(), logger));
+ ExecutionScope.Begin(new MockOptimization(), logger)
+ );
}
[Fact]
@@ -179,7 +180,10 @@ public class MockOptimization : IOptimization
public string ShortDescription => "Mock description";
public OptimizationState State { get; set; } = new();
- public Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ public Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
return Task.FromResult(ApplyResult.True());
}
@@ -204,4 +208,4 @@ public class MockRevertStep : IRevertStep
{
return new MockRevertStep();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck.Test/Services/OptimizationServiceTests.cs b/optimizerDuck.Test/Services/OptimizationServiceTests.cs
index f20c4b1..5d26e36 100644
--- a/optimizerDuck.Test/Services/OptimizationServiceTests.cs
+++ b/optimizerDuck.Test/Services/OptimizationServiceTests.cs
@@ -24,10 +24,14 @@ public class OptimizationServiceTests
{
ApplyImpl = _ =>
{
- ExecutionScope.RecordStep("Test", "Test step", true,
- new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 0" });
+ ExecutionScope.RecordStep(
+ "Test",
+ "Test step",
+ true,
+ new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 0" }
+ );
return Task.FromResult(ApplyResult.True());
- }
+ },
};
var revertPath = GetRevertFilePath(optimization.Id);
@@ -67,11 +71,15 @@ public class OptimizationServiceTests
{
ApplyImpl = _ =>
{
- ExecutionScope.RecordStep("Test", "Test step", true,
- new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 0" });
+ ExecutionScope.RecordStep(
+ "Test",
+ "Test step",
+ true,
+ new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 0" }
+ );
ExecutionScope.RecordStep("Test", "Failed step", false, error: "fail");
return Task.FromResult(ApplyResult.False("apply failed"));
- }
+ },
};
var revertPath = GetRevertFilePath(optimization.Id);
@@ -104,7 +112,7 @@ public class OptimizationServiceTests
{
var optimization = new FakeOptimization
{
- ApplyImpl = _ => Task.FromResult(ApplyResult.True())
+ ApplyImpl = _ => Task.FromResult(ApplyResult.True()),
};
var revertPath = GetRevertFilePath(optimization.Id);
@@ -126,10 +134,10 @@ public class OptimizationServiceTests
Data = new ShellRevertStep
{
ShellType = ShellType.CMD,
- Command = "exit 0"
- }.ToData()
- }
- }
+ Command = "exit 0",
+ }.ToData(),
+ },
+ },
};
var json = JsonConvert.SerializeObject(payload, Formatting.Indented);
@@ -165,16 +173,21 @@ public class OptimizationServiceTests
Error = "fail",
RetryAction = () =>
{
- ExecutionScope.RecordStep("Shell", "retried step", true,
- new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 0" });
+ ExecutionScope.RecordStep(
+ "Shell",
+ "retried step",
+ true,
+ new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 0" }
+ );
return Task.FromResult(true);
- }
+ },
};
var result = await OptimizationService.RetryFailedStepsWithResultsAsync(
[failedStep],
false,
- NullLogger.Instance);
+ NullLogger.Instance
+ );
Assert.Empty(result.FailedSteps);
Assert.Single(result.RecoveredSteps);
@@ -192,18 +205,41 @@ public class OptimizationServiceTests
{
ApplyImpl = _ =>
{
- ExecutionScope.RecordStep("Shell", "step 1", true,
- new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 11" });
- ExecutionScope.RecordStep("Shell", "step 2", false, null, "fail", () =>
- {
- ExecutionScope.RecordStep("Shell", "step 2 retry", true,
- new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 0" });
- return Task.FromResult(true);
- });
- ExecutionScope.RecordStep("Shell", "step 3", true,
- new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 33" });
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 1",
+ true,
+ new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 11" }
+ );
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 2",
+ false,
+ null,
+ "fail",
+ () =>
+ {
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 2 retry",
+ true,
+ new ShellRevertStep
+ {
+ ShellType = ShellType.CMD,
+ Command = "exit 0",
+ }
+ );
+ return Task.FromResult(true);
+ }
+ );
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 3",
+ true,
+ new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 33" }
+ );
return Task.FromResult(ApplyResult.True());
- }
+ },
};
var revertPath = GetRevertFilePath(optimization.Id);
@@ -225,8 +261,14 @@ public class OptimizationServiceTests
Assert.Equal("Shell", data.Steps[0].Type);
Assert.Equal("Unknown", data.Steps[1].Type);
Assert.Equal("Shell", data.Steps[2].Type);
- Assert.Equal("exit 11", data.Steps[0].Data[nameof(ShellRevertStep.Command)]?.ToString());
- Assert.Equal("exit 33", data.Steps[2].Data[nameof(ShellRevertStep.Command)]?.ToString());
+ Assert.Equal(
+ "exit 11",
+ data.Steps[0].Data[nameof(ShellRevertStep.Command)]?.ToString()
+ );
+ Assert.Equal(
+ "exit 33",
+ data.Steps[2].Data[nameof(ShellRevertStep.Command)]?.ToString()
+ );
}
finally
{
@@ -245,18 +287,41 @@ public class OptimizationServiceTests
{
ApplyImpl = _ =>
{
- ExecutionScope.RecordStep("Shell", "step 1", true,
- new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 11" });
- ExecutionScope.RecordStep("Shell", "step 2", false, null, "fail", () =>
- {
- ExecutionScope.RecordStep("Shell", "step 2 retry", true,
- new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 0" });
- return Task.FromResult(true);
- });
- ExecutionScope.RecordStep("Shell", "step 3", true,
- new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 33" });
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 1",
+ true,
+ new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 11" }
+ );
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 2",
+ false,
+ null,
+ "fail",
+ () =>
+ {
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 2 retry",
+ true,
+ new ShellRevertStep
+ {
+ ShellType = ShellType.CMD,
+ Command = "exit 0",
+ }
+ );
+ return Task.FromResult(true);
+ }
+ );
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 3",
+ true,
+ new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 33" }
+ );
return Task.FromResult(ApplyResult.True());
- }
+ },
};
var revertPath = GetRevertFilePath(optimization.Id);
@@ -275,26 +340,40 @@ public class OptimizationServiceTests
var retryResult = await OptimizationService.RetryFailedStepsWithResultsAsync(
applyResult.FailedSteps,
false,
- NullLogger.Instance);
+ NullLogger.Instance
+ );
var retriedStep = Assert.Single(retryResult.RecoveredSteps);
Assert.Equal(2, retriedStep.Index);
Assert.NotNull(retriedStep.RevertStep);
- var revertManager = new RevertManager(NullLogger<RevertManager>.Instance, NullLoggerFactory.Instance);
+ var revertManager = new RevertManager(
+ NullLogger<RevertManager>.Instance,
+ NullLoggerFactory.Instance
+ );
await revertManager.UpsertRevertStepAtIndexAsync(
optimization.Id,
optimization.OptimizationKey,
retriedStep.Index,
- retriedStep.RevertStep!);
+ retriedStep.RevertStep!
+ );
var data = await RevertManager.GetRevertDataAsync(optimization.Id);
Assert.NotNull(data);
Assert.Equal(3, data!.Steps.Count);
- Assert.Equal("exit 11", data.Steps[0].Data[nameof(ShellRevertStep.Command)]?.ToString());
- Assert.Equal("exit 0", data.Steps[1].Data[nameof(ShellRevertStep.Command)]?.ToString());
- Assert.Equal("exit 33", data.Steps[2].Data[nameof(ShellRevertStep.Command)]?.ToString());
+ Assert.Equal(
+ "exit 11",
+ data.Steps[0].Data[nameof(ShellRevertStep.Command)]?.ToString()
+ );
+ Assert.Equal(
+ "exit 0",
+ data.Steps[1].Data[nameof(ShellRevertStep.Command)]?.ToString()
+ );
+ Assert.Equal(
+ "exit 33",
+ data.Steps[2].Data[nameof(ShellRevertStep.Command)]?.ToString()
+ );
}
finally
{
@@ -313,24 +392,62 @@ public class OptimizationServiceTests
{
ApplyImpl = _ =>
{
- ExecutionScope.RecordStep("Shell", "step 1", true,
- new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 11" });
- ExecutionScope.RecordStep("Shell", "step 2", false, null, "fail 2", () =>
- {
- ExecutionScope.RecordStep("Shell", "step 2 retry", true,
- new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 22" });
- return Task.FromResult(true);
- });
- ExecutionScope.RecordStep("Shell", "step 3", true,
- new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 33" });
- ExecutionScope.RecordStep("Shell", "step 4", false, null, "fail 4", () =>
- {
- ExecutionScope.RecordStep("Shell", "step 4 retry", true,
- new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 44" });
- return Task.FromResult(true);
- });
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 1",
+ true,
+ new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 11" }
+ );
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 2",
+ false,
+ null,
+ "fail 2",
+ () =>
+ {
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 2 retry",
+ true,
+ new ShellRevertStep
+ {
+ ShellType = ShellType.CMD,
+ Command = "exit 22",
+ }
+ );
+ return Task.FromResult(true);
+ }
+ );
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 3",
+ true,
+ new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 33" }
+ );
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 4",
+ false,
+ null,
+ "fail 4",
+ () =>
+ {
+ ExecutionScope.RecordStep(
+ "Shell",
+ "step 4 retry",
+ true,
+ new ShellRevertStep
+ {
+ ShellType = ShellType.CMD,
+ Command = "exit 44",
+ }
+ );
+ return Task.FromResult(true);
+ }
+ );
return Task.FromResult(ApplyResult.True());
- }
+ },
};
var revertPath = GetRevertFilePath(optimization.Id);
@@ -350,28 +467,35 @@ public class OptimizationServiceTests
var retryResult = await OptimizationService.RetryFailedStepsWithResultsAsync(
applyResult.FailedSteps,
false,
- NullLogger.Instance);
+ NullLogger.Instance
+ );
Assert.Empty(retryResult.FailedSteps);
- Assert.Equal([2, 4], retryResult.RecoveredSteps.Select(step => step.Index).ToArray());
-
- var revertManager = new RevertManager(NullLogger<RevertManager>.Instance, NullLoggerFactory.Instance);
+ Assert.Equal(
+ [2, 4],
+ retryResult.RecoveredSteps.Select(step => step.Index).ToArray()
+ );
+
+ var revertManager = new RevertManager(
+ NullLogger<RevertManager>.Instance,
+ NullLoggerFactory.Instance
+ );
foreach (var recoveredStep in retryResult.RecoveredSteps)
await revertManager.UpsertRevertStepAtIndexAsync(
optimization.Id,
optimization.OptimizationKey,
recoveredStep.Index,
- recoveredStep.RevertStep!);
+ recoveredStep.RevertStep!
+ );
var data = await RevertManager.GetRevertDataAsync(optimization.Id);
Assert.NotNull(data);
Assert.Equal(4, data!.Steps.Count);
- var commands = data.Steps
- .Select(step => step.Data[nameof(ShellRevertStep.Command)]!.ToString())
+ var commands = data
+ .Steps.Select(step => step.Data[nameof(ShellRevertStep.Command)]!.ToString())
.ToArray();
- Assert.Equal(["exit 11", "exit 22", "exit 33", "exit 44"],
- commands);
+ Assert.Equal(["exit 11", "exit 22", "exit 33", "exit 44"], commands);
}
finally
{
@@ -393,13 +517,14 @@ public class OptimizationServiceTests
Description = "still failing step",
Success = false,
Error = "initial error",
- RetryAction = () => throw new InvalidOperationException("retry exploded")
+ RetryAction = () => throw new InvalidOperationException("retry exploded"),
};
var result = await OptimizationService.RetryFailedStepsWithResultsAsync(
[failedStep],
false,
- NullLogger.Instance);
+ NullLogger.Instance
+ );
var stillFailedStep = Assert.Single(result.FailedSteps);
Assert.Empty(result.RecoveredSteps);
@@ -410,14 +535,23 @@ public class OptimizationServiceTests
private static OptimizationService CreateService()
{
- var revertManager = new RevertManager(NullLogger<RevertManager>.Instance, NullLoggerFactory.Instance);
+ var revertManager = new RevertManager(
+ NullLogger<RevertManager>.Instance,
+ NullLoggerFactory.Instance
+ );
var loggerFactory = NullLoggerFactory.Instance;
var systemInfoService = new SystemInfoService(NullLogger<SystemInfoService>.Instance);
var streamService = new StreamService(NullLogger<StreamService>.Instance);
var contentDialogService = new ContentDialogService();
var logger = NullLogger<OptimizationService>.Instance;
- return new OptimizationService(revertManager, loggerFactory, systemInfoService, streamService,
- contentDialogService, logger);
+ return new OptimizationService(
+ revertManager,
+ loggerFactory,
+ systemInfoService,
+ streamService,
+ contentDialogService,
+ logger
+ );
}
private static string GetRevertFilePath(Guid id)
@@ -458,12 +592,10 @@ public class OptimizationServiceTests
public string Prefix { get; } = "Test";
public string ProgressPrefix { get; } = "Test";
- public Func<(IProgress<ProcessingProgress> progress, OptimizationContext context), Task<ApplyResult>> ApplyImpl
- {
- get;
- init;
- } =
- _ => Task.FromResult(ApplyResult.True());
+ public Func<
+ (IProgress<ProcessingProgress> progress, OptimizationContext context),
+ Task<ApplyResult>
+ > ApplyImpl { get; init; } = _ => Task.FromResult(ApplyResult.True());
public Guid Id { get; } = Guid.NewGuid();
public OptimizationRisk Risk { get; } = OptimizationRisk.Safe;
@@ -473,7 +605,10 @@ public class OptimizationServiceTests
public string ShortDescription { get; } = "Test";
public OptimizationState State { get; set; } = new();
- public Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ public Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
return ApplyImpl((progress, context));
}
diff --git a/optimizerDuck.Test/Services/OptimizationServices/RegistryServiceTests.cs b/optimizerDuck.Test/Services/OptimizationServices/RegistryServiceTests.cs
index ff8352d..07e122b 100644
--- a/optimizerDuck.Test/Services/OptimizationServices/RegistryServiceTests.cs
+++ b/optimizerDuck.Test/Services/OptimizationServices/RegistryServiceTests.cs
@@ -3,8 +3,8 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Win32;
-using optimizerDuck.Domain.Execution;
using optimizerDuck.Domain.Abstractions;
+using optimizerDuck.Domain.Execution;
using optimizerDuck.Domain.Optimizations.Models;
using optimizerDuck.Domain.Optimizations.Models.Services;
using optimizerDuck.Domain.UI;
@@ -26,7 +26,11 @@ public class RegistryServiceTests : IDisposable
public string Name => "Test";
public string ShortDescription => "";
public OptimizationState State { get; set; } = new();
- public Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context) => Task.FromResult(ApplyResult.True());
+
+ public Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ ) => Task.FromResult(ApplyResult.True());
}
public RegistryServiceTests()
@@ -147,7 +151,9 @@ public class RegistryServiceTests : IDisposable
Assert.True(RegistryService.Write(new RegistryItem(keyPathA, "Value1", "Data1")));
Assert.True(RegistryService.Write(new RegistryItem(keyPathA, null, "DefaultData")));
- Assert.True(RegistryService.Write(new RegistryItem(keyPathB, "Value3", 42, RegistryValueKind.DWord)));
+ Assert.True(
+ RegistryService.Write(new RegistryItem(keyPathB, "Value3", 42, RegistryValueKind.DWord))
+ );
Assert.True(RegistryService.CreateSubKey(new RegistryItem(keyPathC)));
// 2. Perform the deletion of tree A
@@ -157,7 +163,9 @@ public class RegistryServiceTests : IDisposable
Assert.False(RegistryService.KeyExists(new RegistryItem(keyPathA)));
// 3. Obtain the revert step generated out of the deleted tree
- var deleteStep = _scope.ExecutedSteps.LastOrDefault(s => s.Name == "Registry" && s.RevertStep != null);
+ var deleteStep = _scope.ExecutedSteps.LastOrDefault(s =>
+ s.Name == "Registry" && s.RevertStep != null
+ );
Assert.NotNull(deleteStep);
var revertStep = deleteStep.RevertStep;
@@ -192,9 +200,11 @@ public class RegistryServiceTests : IDisposable
Assert.True(RegistryService.KeyExists(new RegistryItem(keyPathB)));
// Obtain revert step
- var createStep = _scope.ExecutedSteps.LastOrDefault(s => s.Name == "Registry" && s.RevertStep != null);
+ var createStep = _scope.ExecutedSteps.LastOrDefault(s =>
+ s.Name == "Registry" && s.RevertStep != null
+ );
Assert.NotNull(createStep);
-
+
// Execute revert
Assert.True(await createStep.RevertStep!.ExecuteAsync());
diff --git a/optimizerDuck.Test/Services/OptimizationServices/ShellServiceTests.cs b/optimizerDuck.Test/Services/OptimizationServices/ShellServiceTests.cs
index dc4a110..4f2eaae 100644
--- a/optimizerDuck.Test/Services/OptimizationServices/ShellServiceTests.cs
+++ b/optimizerDuck.Test/Services/OptimizationServices/ShellServiceTests.cs
@@ -27,4 +27,4 @@ public class ShellServiceTests
Assert.Equal(0, result.ExitCode);
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck.Test/optimizerDuck.Test.csproj b/optimizerDuck.Test/optimizerDuck.Test.csproj
index 38de7b5..e34c258 100644
--- a/optimizerDuck.Test/optimizerDuck.Test.csproj
+++ b/optimizerDuck.Test/optimizerDuck.Test.csproj
@@ -1,34 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>net10.0-windows10.0.17763.0</TargetFramework>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <Nullable>enable</Nullable>
+ <IsPackable>false</IsPackable>
+ <OutputType>Exe</OutputType>
+ </PropertyGroup>
- <PropertyGroup>
- <TargetFramework>net10.0-windows10.0.17763.0</TargetFramework>
- <ImplicitUsings>enable</ImplicitUsings>
- <Nullable>enable</Nullable>
- <IsPackable>false</IsPackable>
- <OutputType>Exe</OutputType>
- </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="coverlet.collector" Version="8.0.0">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+ </PackageReference>
+ <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.5" />
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
+ <PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
+ <PackageReference Include="xunit.v3" Version="3.2.2" />
+ <PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+ </PackageReference>
+ </ItemGroup>
- <ItemGroup>
- <PackageReference Include="coverlet.collector" Version="8.0.0">
- <PrivateAssets>all</PrivateAssets>
- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
- </PackageReference>
- <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.5"/>
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0"/>
- <PackageReference Include="Newtonsoft.Json" Version="13.0.4"/>
- <PackageReference Include="xunit.v3" Version="3.2.2"/>
- <PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
- <PrivateAssets>all</PrivateAssets>
- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
- </PackageReference>
- </ItemGroup>
-
- <ItemGroup>
- <Using Include="Xunit"/>
- </ItemGroup>
-
- <ItemGroup>
- <ProjectReference Include="..\optimizerDuck\optimizerDuck.csproj"/>
- </ItemGroup>
+ <ItemGroup>
+ <Using Include="Xunit" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\optimizerDuck\optimizerDuck.csproj" />
+ </ItemGroup>
</Project>
diff --git a/optimizerDuck.slnx b/optimizerDuck.slnx
index 379ec99..bd06313 100644
--- a/optimizerDuck.slnx
+++ b/optimizerDuck.slnx
@@ -1,4 +1,4 @@
<Solution>
- <Project Path="optimizerDuck.Test/optimizerDuck.Test.csproj"/>
- <Project Path="optimizerDuck/optimizerDuck.csproj"/>
+ <Project Path="optimizerDuck.Test/optimizerDuck.Test.csproj" />
+ <Project Path="optimizerDuck/optimizerDuck.csproj" />
</Solution>
diff --git a/optimizerDuck/App.xaml b/optimizerDuck/App.xaml
index 998bb36..d9c27b9 100644
--- a/optimizerDuck/App.xaml
+++ b/optimizerDuck/App.xaml
@@ -1,20 +1,21 @@
<Application
- x:Class="optimizerDuck.App"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
- <Application.Resources>
- <ResourceDictionary>
- <ResourceDictionary.MergedDictionaries>
- <ui:ThemesDictionary Theme="Dark" />
- <ui:ControlsDictionary />
- </ResourceDictionary.MergedDictionaries>
+ x:Class="optimizerDuck.App"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <Application.Resources>
+ <ResourceDictionary>
+ <ResourceDictionary.MergedDictionaries>
+ <ui:ThemesDictionary Theme="Dark" />
+ <ui:ControlsDictionary />
+ </ResourceDictionary.MergedDictionaries>
- <Style TargetType="Image">
- <Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality" />
- <Setter Property="SnapsToDevicePixels" Value="True" />
- <Setter Property="UseLayoutRounding" Value="True" />
- </Style>
- </ResourceDictionary>
- </Application.Resources>
-</Application>
\ No newline at end of file
+ <Style TargetType="Image">
+ <Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality" />
+ <Setter Property="SnapsToDevicePixels" Value="True" />
+ <Setter Property="UseLayoutRounding" Value="True" />
+ </Style>
+ </ResourceDictionary>
+ </Application.Resources>
+</Application>
diff --git a/optimizerDuck/App.xaml.cs b/optimizerDuck/App.xaml.cs
index 3eaad79..a16783b 100644
--- a/optimizerDuck/App.xaml.cs
+++ b/optimizerDuck/App.xaml.cs
@@ -1,4 +1,8 @@
-using Microsoft.Extensions.Configuration;
+using System.Globalization;
+using System.IO;
+using System.Windows;
+using System.Windows.Media;
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
@@ -17,10 +21,6 @@ using Serilog;
using Serilog.Events;
using Serilog.Formatting;
using Serilog.Parsing;
-using System.Globalization;
-using System.IO;
-using System.Windows;
-using System.Windows.Media;
using Wpf.Ui;
using Wpf.Ui.Appearance;
using Wpf.Ui.DependencyInjection;
@@ -46,11 +46,11 @@ public class ScopeBlockTextFormatter : ITextFormatter
LogEventLevel.Warning => "WARNING",
LogEventLevel.Error => "ERROR",
LogEventLevel.Fatal => "FATAL",
- _ => "UNKNOWN"
+ _ => "UNKNOWN",
};
//var prefix = $"{timestamp} | {ctx,-67} | {levelText,-7} | "; // byebye 67 char SourceContext truncation, we have a new design now...
- var prefix = $"{timestamp} | {ctx,-35} | {levelText,-7} | ";
+ var prefix = $"{timestamp} | {ctx, -35} | {levelText, -7} | ";
// print message
output.WriteLine(prefix + RenderWithoutQuotes(logEvent));
@@ -58,12 +58,14 @@ public class ScopeBlockTextFormatter : ITextFormatter
// print property
foreach (var kvp in logEvent.Properties)
{
- if (kvp.Key == "SourceContext") continue;
+ if (kvp.Key == "SourceContext")
+ continue;
- var usedInMessage = logEvent.MessageTemplate.Tokens
- .OfType<PropertyToken>()
+ var usedInMessage = logEvent
+ .MessageTemplate.Tokens.OfType<PropertyToken>()
.Any(t => t.PropertyName == kvp.Key);
- if (usedInMessage) continue;
+ if (usedInMessage)
+ continue;
var valueText = kvp.Value is ScalarValue sv
? sv.Value?.ToString() ?? ""
@@ -83,7 +85,10 @@ public class ScopeBlockTextFormatter : ITextFormatter
{
var output = new StringWriter();
foreach (var token in logEvent.MessageTemplate.Tokens)
- if (token is PropertyToken pt && logEvent.Properties.TryGetValue(pt.PropertyName, out var value))
+ if (
+ token is PropertyToken pt
+ && logEvent.Properties.TryGetValue(pt.PropertyName, out var value)
+ )
{
if (value is ScalarValue { Value: string s })
// write string without quotes
@@ -134,68 +139,74 @@ public partial class App : Application
.ConfigureAppConfiguration(c =>
{
ConfigManager.ValidateConfig();
- c.AddJsonFile(Path.Combine(Shared.RootDirectory, "appsettings.json"), false, true);
- })
- .ConfigureServices((context, services) =>
- {
- services.Configure<AppSettings>(context.Configuration);
-
- // WPF UI shi
- services.AddNavigationViewPageProvider();
- services.AddSingleton<INavigationService, NavigationService>();
- services.AddSingleton<IContentDialogService, ContentDialogService>();
- services.AddSingleton<ISnackbarService, SnackbarService>();
-
- // Windows
- services.AddSingleton<MainWindow>();
- services.AddSingleton<MainWindowViewModel>();
-
- // Pages
- services.AddSingleton<DashboardViewModel>();
- services.AddSingleton<DashboardPage>();
-
- services.AddSingleton<OptimizeViewModel>();
- services.AddSingleton<OptimizePage>();
-
- services.AddSingleton<SettingsViewModel>();
- services.AddSingleton<SettingsPage>();
-
- services.AddSingleton<BloatwareViewModel>();
- services.AddSingleton<BloatwarePage>();
-
- services.AddSingleton<DiskCleanupViewModel>();
- services.AddSingleton<DiskCleanupPage>();
-
- services.AddSingleton<StartupManagerViewModel>();
- services.AddSingleton<StartupManagerPage>();
-
- services.AddSingleton<ScheduledTasksViewModel>();
- services.AddSingleton<ScheduledTasksPage>();
-
- // Toggle Features
- services.AddSingleton<FeaturesViewModel>();
- services.AddSingleton<FeaturesPage>();
-
- services.AddAllFeaturesCategoryPages();
-
- // Optimizations
- services.AddAllOptimizationPages();
-
- // Managers
- services.AddSingleton<ConfigManager>();
- services.AddSingleton<RevertManager>();
-
- // Services
- services.AddSingleton<OptimizationRegistry>();
- services.AddSingleton<FeatureRegistry>();
- services.AddSingleton<OptimizationService>();
- services.AddSingleton<BloatwareService>();
- services.AddSingleton<DiskCleanupService>();
- services.AddSingleton<StartupManagerService>();
- services.AddSingleton<SystemInfoService>();
- services.AddSingleton<StreamService>();
- services.AddSingleton<UpdaterService>();
+ c.AddJsonFile(
+ Path.Combine(Shared.RootDirectory, "appsettings.json"),
+ false,
+ true
+ );
})
+ .ConfigureServices(
+ (context, services) =>
+ {
+ services.Configure<AppSettings>(context.Configuration);
+
+ // WPF UI shi
+ services.AddNavigationViewPageProvider();
+ services.AddSingleton<INavigationService, NavigationService>();
+ services.AddSingleton<IContentDialogService, ContentDialogService>();
+ services.AddSingleton<ISnackbarService, SnackbarService>();
+
+ // Windows
+ services.AddSingleton<MainWindow>();
+ services.AddSingleton<MainWindowViewModel>();
+
+ // Pages
+ services.AddSingleton<DashboardViewModel>();
+ services.AddSingleton<DashboardPage>();
+
+ services.AddSingleton<OptimizeViewModel>();
+ services.AddSingleton<OptimizePage>();
+
+ services.AddSingleton<SettingsViewModel>();
+ services.AddSingleton<SettingsPage>();
+
+ services.AddSingleton<BloatwareViewModel>();
+ services.AddSingleton<BloatwarePage>();
+
+ services.AddSingleton<DiskCleanupViewModel>();
+ services.AddSingleton<DiskCleanupPage>();
+
+ services.AddSingleton<StartupManagerViewModel>();
+ services.AddSingleton<StartupManagerPage>();
+
+ services.AddSingleton<ScheduledTasksViewModel>();
+ services.AddSingleton<ScheduledTasksPage>();
+
+ // Toggle Features
+ services.AddSingleton<FeaturesViewModel>();
+ services.AddSingleton<FeaturesPage>();
+
+ services.AddAllFeaturesCategoryPages();
+
+ // Optimizations
+ services.AddAllOptimizationPages();
+
+ // Managers
+ services.AddSingleton<ConfigManager>();
+ services.AddSingleton<RevertManager>();
+
+ // Services
+ services.AddSingleton<OptimizationRegistry>();
+ services.AddSingleton<FeatureRegistry>();
+ services.AddSingleton<OptimizationService>();
+ services.AddSingleton<BloatwareService>();
+ services.AddSingleton<DiskCleanupService>();
+ services.AddSingleton<StartupManagerService>();
+ services.AddSingleton<SystemInfoService>();
+ services.AddSingleton<StreamService>();
+ services.AddSingleton<UpdaterService>();
+ }
+ )
.Build();
await _host.StartAsync();
@@ -204,7 +215,9 @@ public partial class App : Application
await config.InitializeAsync();
await config.EnsureDefaultsAsync();
- var appOptionsMonitor = _host.Services.GetRequiredService<IOptionsMonitor<AppSettings>>();
+ var appOptionsMonitor = _host.Services.GetRequiredService<
+ IOptionsMonitor<AppSettings>
+ >();
// init shell service with config
ShellService.Init(appOptionsMonitor);
@@ -214,7 +227,11 @@ public partial class App : Application
Loc.Instance.ChangeCulture(new CultureInfo(appSettings.App.Language));
_logger = _host.Services.GetRequiredService<ILogger<App>>();
- _logger.LogInformation("\n{Logo}\nVersion: {Version}\n\n", Shared.RawLogo, Shared.FileVersion);
+ _logger.LogInformation(
+ "\n{Logo}\nVersion: {Version}\n\n",
+ Shared.RawLogo,
+ Shared.FileVersion
+ );
_logger.LogInformation("Loaded language: {Language}", appSettings.App.Language);
var optimizationRegistry = _host.Services.GetRequiredService<OptimizationRegistry>();
@@ -234,7 +251,7 @@ public partial class App : Application
{
ApplicationTheme.Dark => ApplicationTheme.Dark,
ApplicationTheme.HighContrast => ApplicationTheme.HighContrast,
- _ => ApplicationTheme.Light
+ _ => ApplicationTheme.Light,
},
updateAccent: false
);
@@ -258,7 +275,8 @@ public partial class App : Application
$"Failed to start optimizerDuck.{Environment.NewLine}{Environment.NewLine}{ex.Message}",
"optimizerDuck",
MessageBoxButton.OK,
- MessageBoxImage.Error);
+ MessageBoxImage.Error
+ );
Shutdown(-1);
}
}
@@ -275,4 +293,4 @@ public partial class App : Application
base.OnExit(e);
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/AssemblyInfo.cs b/optimizerDuck/AssemblyInfo.cs
index 4a05c7d..77c6c5d 100644
--- a/optimizerDuck/AssemblyInfo.cs
+++ b/optimizerDuck/AssemblyInfo.cs
@@ -5,6 +5,6 @@ using System.Windows;
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
\ No newline at end of file
+//(used if a resource is not found in the page,
+// app, or any theme specific resource dictionaries)
+)]
diff --git a/optimizerDuck/Common/Converters/BooleanConverter.cs b/optimizerDuck/Common/Converters/BooleanConverter.cs
index 941430c..27d8509 100644
--- a/optimizerDuck/Common/Converters/BooleanConverter.cs
+++ b/optimizerDuck/Common/Converters/BooleanConverter.cs
@@ -12,13 +12,23 @@ public class BooleanConverter<T>(T trueValue, T falseValue) : IValueConverter
public T True { get; set; } = trueValue;
public T False { get; set; } = falseValue;
- public virtual object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public virtual object? Convert(
+ object? value,
+ Type targetType,
+ object? parameter,
+ CultureInfo culture
+ )
{
return value is true ? True : False;
}
- public virtual object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public virtual object ConvertBack(
+ object? value,
+ Type targetType,
+ object? parameter,
+ CultureInfo culture
+ )
{
return value is T value1 && EqualityComparer<T>.Default.Equals(value1, True);
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Converters/BooleanToVisibilityConverter.cs b/optimizerDuck/Common/Converters/BooleanToVisibilityConverter.cs
index 74a367f..584d7f3 100644
--- a/optimizerDuck/Common/Converters/BooleanToVisibilityConverter.cs
+++ b/optimizerDuck/Common/Converters/BooleanToVisibilityConverter.cs
@@ -3,4 +3,4 @@
namespace optimizerDuck.Common.Converters;
public sealed class BooleanToVisibilityConverter()
- : BooleanConverter<Visibility>(Visibility.Visible, Visibility.Collapsed);
\ No newline at end of file
+ : BooleanConverter<Visibility>(Visibility.Visible, Visibility.Collapsed);
diff --git a/optimizerDuck/Common/Converters/EmptyWhileNotLoadingConverter.cs b/optimizerDuck/Common/Converters/EmptyWhileNotLoadingConverter.cs
index b36b919..6d87cb1 100644
--- a/optimizerDuck/Common/Converters/EmptyWhileNotLoadingConverter.cs
+++ b/optimizerDuck/Common/Converters/EmptyWhileNotLoadingConverter.cs
@@ -8,18 +8,22 @@ public class EmptyWhileNotLoadingConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
- if (values.Length < 2) return Visibility.Collapsed;
+ if (values.Length < 2)
+ return Visibility.Collapsed;
if (values[0] is int count && values[1] is bool isLoading)
- return count == 0 && !isLoading
- ? Visibility.Visible
- : Visibility.Collapsed;
+ return count == 0 && !isLoading ? Visibility.Visible : Visibility.Collapsed;
return Visibility.Collapsed;
}
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ public object[] ConvertBack(
+ object value,
+ Type[] targetTypes,
+ object parameter,
+ CultureInfo culture
+ )
{
throw new NotSupportedException();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Converters/GreaterThanNumberToVisibilityConverter.cs b/optimizerDuck/Common/Converters/GreaterThanNumberToVisibilityConverter.cs
index 41ab8db..4b27309 100644
--- a/optimizerDuck/Common/Converters/GreaterThanNumberToVisibilityConverter.cs
+++ b/optimizerDuck/Common/Converters/GreaterThanNumberToVisibilityConverter.cs
@@ -16,8 +16,13 @@ public class GreaterThanNumberToVisibilityConverter : IValueConverter
return intValue > Threshold ? Visibility.Visible : Visibility.Collapsed;
}
- public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object ConvertBack(
+ object? value,
+ Type targetType,
+ object? parameter,
+ CultureInfo culture
+ )
{
throw new NotSupportedException();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Converters/GreaterThanZeroToVisibilityConverter.cs b/optimizerDuck/Common/Converters/GreaterThanZeroToVisibilityConverter.cs
index 603bf49..2d471b7 100644
--- a/optimizerDuck/Common/Converters/GreaterThanZeroToVisibilityConverter.cs
+++ b/optimizerDuck/Common/Converters/GreaterThanZeroToVisibilityConverter.cs
@@ -14,8 +14,13 @@ public class GreaterThanZeroToVisibilityConverter : IValueConverter
return value is > 0 ? True : False;
}
- public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object ConvertBack(
+ object? value,
+ Type targetType,
+ object? parameter,
+ CultureInfo culture
+ )
{
throw new NotSupportedException();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Converters/InverseBooleanConverter.cs b/optimizerDuck/Common/Converters/InverseBooleanConverter.cs
index 68ffc95..86ef8ab 100644
--- a/optimizerDuck/Common/Converters/InverseBooleanConverter.cs
+++ b/optimizerDuck/Common/Converters/InverseBooleanConverter.cs
@@ -20,4 +20,4 @@ public class InverseBooleanConverter : IValueConverter
return value;
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Converters/InverseBooleanToVisibilityConverter.cs b/optimizerDuck/Common/Converters/InverseBooleanToVisibilityConverter.cs
index e7310d0..3a9478a 100644
--- a/optimizerDuck/Common/Converters/InverseBooleanToVisibilityConverter.cs
+++ b/optimizerDuck/Common/Converters/InverseBooleanToVisibilityConverter.cs
@@ -3,4 +3,4 @@
namespace optimizerDuck.Common.Converters;
public sealed class InverseBooleanToVisibilityConverter()
- : BooleanConverter<Visibility>(Visibility.Collapsed, Visibility.Visible);
\ No newline at end of file
+ : BooleanConverter<Visibility>(Visibility.Collapsed, Visibility.Visible);
diff --git a/optimizerDuck/Common/Converters/MBToGBConverter.cs b/optimizerDuck/Common/Converters/MBToGBConverter.cs
index f1b47f0..ace64bf 100644
--- a/optimizerDuck/Common/Converters/MBToGBConverter.cs
+++ b/optimizerDuck/Common/Converters/MBToGBConverter.cs
@@ -7,12 +7,18 @@ public class MBToGBConverter : IValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
- if (value is int mb and > 0) return (mb / 1024.0).ToString("F1");
+ if (value is int mb and > 0)
+ return (mb / 1024.0).ToString("F1");
return "N/A";
}
- public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object ConvertBack(
+ object? value,
+ Type targetType,
+ object? parameter,
+ CultureInfo culture
+ )
{
throw new NotSupportedException();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Converters/MinusNumberConverter.cs b/optimizerDuck/Common/Converters/MinusNumberConverter.cs
index 63566e2..6fabb24 100644
--- a/optimizerDuck/Common/Converters/MinusNumberConverter.cs
+++ b/optimizerDuck/Common/Converters/MinusNumberConverter.cs
@@ -18,4 +18,4 @@ public class MinusNumberConverter : IValueConverter
{
throw new NotImplementedException();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Converters/NullToVisibilityConverter.cs b/optimizerDuck/Common/Converters/NullToVisibilityConverter.cs
index 2f6661d..69699e1 100644
--- a/optimizerDuck/Common/Converters/NullToVisibilityConverter.cs
+++ b/optimizerDuck/Common/Converters/NullToVisibilityConverter.cs
@@ -14,8 +14,13 @@ public class NullToVisibilityConverter : IValueConverter
return value is null ? True : False;
}
- public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object? ConvertBack(
+ object? value,
+ Type targetType,
+ object? parameter,
+ CultureInfo culture
+ )
{
throw new NotImplementedException();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Converters/SizeToBrushConverter.cs b/optimizerDuck/Common/Converters/SizeToBrushConverter.cs
index d1bdfea..3e24e39 100644
--- a/optimizerDuck/Common/Converters/SizeToBrushConverter.cs
+++ b/optimizerDuck/Common/Converters/SizeToBrushConverter.cs
@@ -14,32 +14,41 @@ public class SizeToBrushConverter : IValueConverter
private const long TenMB = 10L * 1024 * 1024;
private const long HundredMB = 100L * 1024 * 1024;
- private static readonly SolidColorBrush GreenBrush =
- ThemeResource.Get<SolidColorBrush>("SystemFillColorSuccessBrush");
+ private static readonly SolidColorBrush GreenBrush = ThemeResource.Get<SolidColorBrush>(
+ "SystemFillColorSuccessBrush"
+ );
- private static readonly SolidColorBrush OrangeBrush =
- ThemeResource.Get<SolidColorBrush>("SystemFillColorCautionBrush");
+ private static readonly SolidColorBrush OrangeBrush = ThemeResource.Get<SolidColorBrush>(
+ "SystemFillColorCautionBrush"
+ );
- private static readonly SolidColorBrush RedBrush =
- ThemeResource.Get<SolidColorBrush>("SystemFillColorCriticalBrush");
+ private static readonly SolidColorBrush RedBrush = ThemeResource.Get<SolidColorBrush>(
+ "SystemFillColorCriticalBrush"
+ );
private static readonly SolidColorBrush DefaultBrush = new(Color.FromArgb(0x0, 0x0, 0x0, 0x0));
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
- if (value is not long bytes) return DefaultBrush;
+ if (value is not long bytes)
+ return DefaultBrush;
return bytes switch
{
<= 0 => DefaultBrush,
< TenMB => GreenBrush,
< HundredMB => OrangeBrush,
- _ => RedBrush
+ _ => RedBrush,
};
}
- public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object ConvertBack(
+ object? value,
+ Type targetType,
+ object? parameter,
+ CultureInfo culture
+ )
{
throw new NotImplementedException();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Converters/ThemeToGitHubIconConverter.cs b/optimizerDuck/Common/Converters/ThemeToGitHubIconConverter.cs
index b4e29eb..ead9e03 100644
--- a/optimizerDuck/Common/Converters/ThemeToGitHubIconConverter.cs
+++ b/optimizerDuck/Common/Converters/ThemeToGitHubIconConverter.cs
@@ -11,14 +11,16 @@ public sealed class ThemeToGitHubIconConverter : IValueConverter
{
if (value is ApplicationTheme theme && theme == ApplicationTheme.Dark)
return new BitmapImage(
- new Uri("pack://application:,,,/Resources/Images/GitHubLogoWhite.png"));
+ new Uri("pack://application:,,,/Resources/Images/GitHubLogoWhite.png")
+ );
return new BitmapImage(
- new Uri("pack://application:,,,/Resources/Images/GitHubLogoBlack.png"));
+ new Uri("pack://application:,,,/Resources/Images/GitHubLogoBlack.png")
+ );
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Converters/ThemeToIndexConverter.cs b/optimizerDuck/Common/Converters/ThemeToIndexConverter.cs
index 421921d..4a944a4 100644
--- a/optimizerDuck/Common/Converters/ThemeToIndexConverter.cs
+++ b/optimizerDuck/Common/Converters/ThemeToIndexConverter.cs
@@ -12,17 +12,22 @@ public sealed class ThemeToIndexConverter : IValueConverter
{
ApplicationTheme.Dark => 1,
ApplicationTheme.HighContrast => 2,
- _ => 0
+ _ => 0,
};
}
- public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object ConvertBack(
+ object? value,
+ Type targetType,
+ object? parameter,
+ CultureInfo culture
+ )
{
return value switch
{
1 => ApplicationTheme.Dark,
2 => ApplicationTheme.HighContrast,
- _ => ApplicationTheme.Light
+ _ => ApplicationTheme.Light,
};
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Converters/WidthToColumnConverter.cs b/optimizerDuck/Common/Converters/WidthToColumnConverter.cs
index 8fbfe65..da20205 100644
--- a/optimizerDuck/Common/Converters/WidthToColumnConverter.cs
+++ b/optimizerDuck/Common/Converters/WidthToColumnConverter.cs
@@ -7,18 +7,24 @@ public class WidthToColumnConverter : IValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
- if (value is not double width) return 2;
+ if (value is not double width)
+ return 2;
return width switch
{
< 770 => 1,
< 1100 => 2,
< 1480 => 3,
- _ => 4
+ _ => 4,
};
}
- public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object ConvertBack(
+ object? value,
+ Type targetType,
+ object? parameter,
+ CultureInfo culture
+ )
{
throw new NotSupportedException();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Converters/ZeroToVisibilityConverter.cs b/optimizerDuck/Common/Converters/ZeroToVisibilityConverter.cs
index e1fe13d..0a59aac 100644
--- a/optimizerDuck/Common/Converters/ZeroToVisibilityConverter.cs
+++ b/optimizerDuck/Common/Converters/ZeroToVisibilityConverter.cs
@@ -14,8 +14,13 @@ public class ZeroToVisibilityConverter : IValueConverter
return value is 0 ? True : False;
}
- public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object ConvertBack(
+ object? value,
+ Type targetType,
+ object? parameter,
+ CultureInfo culture
+ )
{
throw new NotSupportedException();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Extensions/FeaturesCategoryPageRegistryExtensions.cs b/optimizerDuck/Common/Extensions/FeaturesCategoryPageRegistryExtensions.cs
index 8855180..75276a8 100644
--- a/optimizerDuck/Common/Extensions/FeaturesCategoryPageRegistryExtensions.cs
+++ b/optimizerDuck/Common/Extensions/FeaturesCategoryPageRegistryExtensions.cs
@@ -31,7 +31,8 @@ public static class FeaturesCategoryPageRegistryExtensions
private static object CreatePage(
IServiceProvider serviceProvider,
Type categoryType,
- Type pageType)
+ Type pageType
+ )
{
var registry = serviceProvider.GetRequiredService<FeatureRegistry>();
var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
@@ -41,4 +42,4 @@ public static class FeaturesCategoryPageRegistryExtensions
return Activator.CreateInstance(pageType, viewModel)!;
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Extensions/LanguageExtensions.cs b/optimizerDuck/Common/Extensions/LanguageExtensions.cs
index b8cc59d..fed5479 100644
--- a/optimizerDuck/Common/Extensions/LanguageExtensions.cs
+++ b/optimizerDuck/Common/Extensions/LanguageExtensions.cs
@@ -10,34 +10,42 @@ namespace optimizerDuck.Common.Extensions;
/// </summary>
public class LocExtension : MarkupExtension
{
- public LocExtension()
- {
- }
+ public LocExtension() { }
public LocExtension(string key)
{
Key = key;
}
- public LocExtension(string key, BindingBase arg1) : this(key)
+ public LocExtension(string key, BindingBase arg1)
+ : this(key)
{
Args.Add(arg1);
}
- public LocExtension(string key, BindingBase arg1, BindingBase arg2) : this(key)
+ public LocExtension(string key, BindingBase arg1, BindingBase arg2)
+ : this(key)
{
Args.Add(arg1);
Args.Add(arg2);
}
- public LocExtension(string key, BindingBase arg1, BindingBase arg2, BindingBase arg3) : this(key)
+ public LocExtension(string key, BindingBase arg1, BindingBase arg2, BindingBase arg3)
+ : this(key)
{
Args.Add(arg1);
Args.Add(arg2);
Args.Add(arg3);
}
- public LocExtension(string key, BindingBase arg1, BindingBase arg2, BindingBase arg3, BindingBase arg4) : this(key)
+ public LocExtension(
+ string key,
+ BindingBase arg1,
+ BindingBase arg2,
+ BindingBase arg3,
+ BindingBase arg4
+ )
+ : this(key)
{
Args.Add(arg1);
Args.Add(arg2);
@@ -45,8 +53,15 @@ public class LocExtension : MarkupExtension
Args.Add(arg4);
}
- public LocExtension(string key, BindingBase arg1, BindingBase arg2, BindingBase arg3, BindingBase arg4,
- BindingBase arg5) : this(key)
+ public LocExtension(
+ string key,
+ BindingBase arg1,
+ BindingBase arg2,
+ BindingBase arg3,
+ BindingBase arg4,
+ BindingBase arg5
+ )
+ : this(key)
{
Args.Add(arg1);
Args.Add(arg2);
@@ -65,21 +80,17 @@ public class LocExtension : MarkupExtension
return new Binding($"[{Key}]")
{
Source = Loc.Instance,
- Mode = BindingMode.OneWay
+ Mode = BindingMode.OneWay,
}.ProvideValue(serviceProvider);
var mb = new MultiBinding
{
Converter = new LocDynamicConverter(),
- ConverterParameter = Key
+ ConverterParameter = Key,
};
// [0] Loc.Instance (required OneWay)
- mb.Bindings.Add(new Binding
- {
- Source = Loc.Instance,
- Mode = BindingMode.OneWay
- });
+ mb.Bindings.Add(new Binding { Source = Loc.Instance, Mode = BindingMode.OneWay });
foreach (var arg in Args)
{
@@ -112,8 +123,13 @@ public class LocDynamicConverter : IMultiValueConverter
return string.Format(culture, format, args);
}
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ public object[] ConvertBack(
+ object value,
+ Type[] targetTypes,
+ object parameter,
+ CultureInfo culture
+ )
{
throw new NotSupportedException();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Extensions/OptimizationPageRegistryExtensions.cs b/optimizerDuck/Common/Extensions/OptimizationPageRegistryExtensions.cs
index 19d7866..ed171c5 100644
--- a/optimizerDuck/Common/Extensions/OptimizationPageRegistryExtensions.cs
+++ b/optimizerDuck/Common/Extensions/OptimizationPageRegistryExtensions.cs
@@ -26,14 +26,18 @@ public static class OptimizationPageRegistryExtensions
var attr = categoryType.GetCustomAttribute<OptimizationCategoryAttribute>()!;
var pageType = attr.PageType!;
- services.AddSingleton(pageType, sp => CreateOptimizationPage(sp, categoryType, pageType));
+ services.AddSingleton(
+ pageType,
+ sp => CreateOptimizationPage(sp, categoryType, pageType)
+ );
}
}
private static object CreateOptimizationPage(
IServiceProvider serviceProvider,
Type categoryType,
- Type pageType)
+ Type pageType
+ )
{
var optimizationRegistry = serviceProvider.GetRequiredService<OptimizationRegistry>();
var optimizationService = serviceProvider.GetRequiredService<OptimizationService>();
@@ -57,4 +61,4 @@ public static class OptimizationPageRegistryExtensions
return Activator.CreateInstance(pageType, viewModel)!;
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Extensions/StringExtensions.cs b/optimizerDuck/Common/Extensions/StringExtensions.cs
index 6d8f72d..826574c 100644
--- a/optimizerDuck/Common/Extensions/StringExtensions.cs
+++ b/optimizerDuck/Common/Extensions/StringExtensions.cs
@@ -26,9 +26,11 @@ public static class TextExtensions
return deserialized switch
{
- IEnumerable<object> list => string.Join(Environment.NewLine,
- list.Where(_ => true).Select(o => o.ToString()?.Trim() ?? string.Empty)),
- _ => deserialized?.ToString()?.Trim() ?? string.Empty
+ IEnumerable<object> list => string.Join(
+ Environment.NewLine,
+ list.Where(_ => true).Select(o => o.ToString()?.Trim() ?? string.Empty)
+ ),
+ _ => deserialized?.ToString()?.Trim() ?? string.Empty,
};
}
catch
@@ -52,9 +54,7 @@ public static class TextExtensions
if (values.Count == 0)
values.Add(doc.Root?.Value.Trim() ?? string.Empty);
- return string.Join(Environment.NewLine, values)
- .Replace("_x000D__x000A_", "\n")
- .Trim();
+ return string.Join(Environment.NewLine, values).Replace("_x000D__x000A_", "\n").Trim();
}
catch
{
@@ -95,8 +95,10 @@ public static class TextExtensions
public static string FormatTime(this TimeSpan time)
{
- if (time.TotalSeconds >= 1) return $"{time.TotalSeconds:F1}s";
- if (time.TotalMilliseconds >= 1) return $"{time.TotalMilliseconds:F0}ms";
+ if (time.TotalSeconds >= 1)
+ return $"{time.TotalSeconds:F1}s";
+ if (time.TotalMilliseconds >= 1)
+ return $"{time.TotalMilliseconds:F0}ms";
return time.Ticks > 0 ? $"{time.Ticks} ticks" : "0";
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Helpers/ReflectionHelper.cs b/optimizerDuck/Common/Helpers/ReflectionHelper.cs
index b70a29a..2d0a9de 100644
--- a/optimizerDuck/Common/Helpers/ReflectionHelper.cs
+++ b/optimizerDuck/Common/Helpers/ReflectionHelper.cs
@@ -23,10 +23,14 @@ public static class ReflectionHelper
public static IEnumerable<Type> FindImplementationsInLoadedAssemblies(Type interfaceType)
{
- return AppDomain.CurrentDomain.GetAssemblies()
+ return AppDomain
+ .CurrentDomain.GetAssemblies()
.SelectMany(SafeGetTypes)
- .Where(t => t != interfaceType && t is { IsClass: true, IsAbstract: false } &&
- interfaceType.IsAssignableFrom(t))
+ .Where(t =>
+ t != interfaceType
+ && t is { IsClass: true, IsAbstract: false }
+ && interfaceType.IsAssignableFrom(t)
+ )
.ToList();
}
@@ -34,4 +38,4 @@ public static class ReflectionHelper
{
return FindImplementationsInLoadedAssemblies(typeof(TInterface));
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Common/Helpers/Shared.cs b/optimizerDuck/Common/Helpers/Shared.cs
index 8761801..ea08862 100644
--- a/optimizerDuck/Common/Helpers/Shared.cs
+++ b/optimizerDuck/Common/Helpers/Shared.cs
@@ -6,16 +6,15 @@ namespace optimizerDuck.Common.Helpers;
public static class Shared
{
public const string RawLogo = """
- _ _ _ _____ _
- | | (_) (_) | __ \ | |
- ___ _ __ | |_ _ _ __ ___ _ _______ _ __| | | |_ _ ___| | __
- / _ \| '_ \| __| | '_ ` _ \| |_ / _ \ '__| | | | | | |/ __| |/ /
- | (_) | |_) | |_| | | | | | | |/ / __/ | | |__| | |_| | (__| <
- \___/| .__/ \__|_|_| |_| |_|_/___\___|_| |_____/ \__,_|\___|_|\_\
- | |
- |_|
- """;
-
+ _ _ _ _____ _
+ | | (_) (_) | __ \ | |
+ ___ _ __ | |_ _ _ __ ___ _ _______ _ __| | | |_ _ ___| | __
+ / _ \| '_ \| __| | '_ ` _ \| |_ / _ \ '__| | | | | | |/ __| |/ /
+ | (_) | |_) | |_| | | | | | | |/ / __/ | | |__| | |_| | (__| <
+ \___/| .__/ \__|_|_| |_| |_|_/___\___|_| |_____/ \__,_|\___|_|\_\
+ | |
+ |_|
+ """;
public const string DiscordInviteURL = "https://discord.gg/tDUBDCYw9Q";
public const string WebsiteURL = "https://optimizerduck.vercel.app/";
@@ -36,7 +35,9 @@ public static class Shared
public static readonly string ExePath = Environment.ProcessPath!;
public static readonly string ExeDir = Path.GetDirectoryName(ExePath)!;
public static readonly string ExeName = Path.GetFileName(ExePath);
- public static readonly string FileVersion = FileVersionInfo.GetVersionInfo(ExePath).FileVersion!;
+ public static readonly string FileVersion = FileVersionInfo
+ .GetVersionInfo(ExePath)
+ .FileVersion!;
public static readonly HashSet<string> SafeApps = new()
{
@@ -50,7 +51,6 @@ public static class Shared
"Microsoft.BingHealthAndFitness",
"Microsoft.BingTravel",
"Microsoft.MicrosoftNews",
-
// Utilities & Services
"Microsoft.GetHelp",
"Microsoft.GetStarted",
@@ -71,38 +71,32 @@ public static class Shared
"Microsoft.RemoteDesktop",
"Microsoft.OutlookForWindows",
"Microsoft.LinkedInForWindows",
-
// Mixed Reality & 3D
"Microsoft.Microsoft3DViewer",
"Microsoft.MixedReality.Portal",
"Microsoft.Print3D",
"Microsoft.3DBuilder",
"Microsoft.Paint3D",
-
// Multimedia (Legacy/Redundant)
"Microsoft.ZuneMusic",
"Microsoft.ZuneVideo",
"Microsoft.Sway",
"Microsoft.WindowsSoundRecorder",
-
// Entertainment & Games
"Microsoft.MicrosoftSolitaireCollection",
"Microsoft.WindowsAlarms",
"Microsoft.549981C3F5F10", // Cortana
-
// Third-party (often pre-installed by MS)
"SpotifyAB.SpotifyMusic",
"Disney.DisneyPlus",
"Amazon.Amazon",
"Clipchamp.Clipchamp",
-
// Legacy / Others
"WindowsPhone",
"CommsPhone",
- "Microsoft.DrawboardPDF"
+ "Microsoft.DrawboardPDF",
};
-
public static readonly HashSet<string> CautionApps = new()
{
// Core Utilities
@@ -112,7 +106,6 @@ public static class Shared
"Microsoft.WindowsNotepad",
"Microsoft.WindowsCamera",
"Microsoft.ScreenSketch",
-
// System Tools
"Microsoft.WindowsStore",
"Microsoft.StorePurchaseApp",
@@ -120,15 +113,12 @@ public static class Shared
"Microsoft.WindowsTerminal",
"Microsoft.WindowsTerminalPreview",
"Microsoft.PowerAutomateDesktop",
-
// Communication
"MicrosoftTeams",
"Microsoft.WindowsCommunicationsApps",
-
// Security & Family
"MicrosoftCorporationII.MicrosoftFamily",
"MicrosoftCorporationII.MicrosoftSupportDiagnosticTool",
-
// Extensions (Essential for files)
"Microsoft.HEIFImageExtension",
"Microsoft.WebMediaExtensions",
@@ -138,7 +128,6 @@ public static class Shared
"Microsoft.AV1VideoExtension",
"Microsoft.HEVCVideoExtension",
"Microsoft.MPEG2VideoExtension",
-
// Xbox / Gaming Services
"Microsoft.XboxIdentityProvider",
"Microsoft.XboxSpeechToTextOverlay",
@@ -146,15 +135,16 @@ public static class Shared
"Microsoft.XboxGamingOverlay",
"Microsoft.XboxApp",
"Microsoft.Xbox.TCUI",
- "Microsoft.GamingApp"
+ "Microsoft.GamingApp",
};
public static string RootDirectory =>
- Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "optimizerDuck");
+ Path.Combine(
+ Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
+ "optimizerDuck"
+ );
- public static string ResourcesDirectory =>
- Path.Combine(RootDirectory, "Resources");
+ public static string ResourcesDirectory => Path.Combine(RootDirectory, "Resources");
- public static string RevertDirectory =>
- Path.Combine(RootDirectory, "Revert");
+ public static string RevertDirectory => Path.Combine(RootDirectory, "Revert");
}
diff --git a/optimizerDuck/Common/Helpers/ThemeResource.cs b/optimizerDuck/Common/Helpers/ThemeResource.cs
index b793c87..0c233ef 100644
--- a/optimizerDuck/Common/Helpers/ThemeResource.cs
+++ b/optimizerDuck/Common/Helpers/ThemeResource.cs
@@ -4,9 +4,9 @@ namespace optimizerDuck.Common.Helpers;
public static class ThemeResource
{
- public static T Get<T>(string key) where T : class
+ public static T Get<T>(string key)
+ where T : class
{
- return Application.Current.Resources[key] as T
- ?? throw new KeyNotFoundException(key);
+ return Application.Current.Resources[key] as T ?? throw new KeyNotFoundException(key);
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Abstractions/IFeature.cs b/optimizerDuck/Domain/Abstractions/IFeature.cs
index 250a006..d2cabf3 100644
--- a/optimizerDuck/Domain/Abstractions/IFeature.cs
+++ b/optimizerDuck/Domain/Abstractions/IFeature.cs
@@ -13,4 +13,4 @@ public interface IFeature
Task<bool> GetStateAsync();
Task EnableAsync();
Task DisableAsync();
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Abstractions/IFeatureCategory.cs b/optimizerDuck/Domain/Abstractions/IFeatureCategory.cs
index 9884c82..0ac8480 100644
--- a/optimizerDuck/Domain/Abstractions/IFeatureCategory.cs
+++ b/optimizerDuck/Domain/Abstractions/IFeatureCategory.cs
@@ -11,4 +11,4 @@ public interface IFeatureCategory
public SymbolRegular Icon { get; init; }
public FeatureCategoryOrder Order { get; init; }
public ObservableCollection<IFeature> Features { get; init; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Abstractions/IOptimization.cs b/optimizerDuck/Domain/Abstractions/IOptimization.cs
index 9c36a31..b2f9797 100644
--- a/optimizerDuck/Domain/Abstractions/IOptimization.cs
+++ b/optimizerDuck/Domain/Abstractions/IOptimization.cs
@@ -45,5 +45,8 @@ public interface IOptimization
/// <param name="progress">A progress reporter for UI updates.</param>
/// <param name="context">The context providing logger, system snapshot, and services.</param>
/// <returns>A task that completes with the result of the apply operation.</returns>
- Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context);
-}
\ No newline at end of file
+ Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ );
+}
diff --git a/optimizerDuck/Domain/Abstractions/IOptimizationCategory.cs b/optimizerDuck/Domain/Abstractions/IOptimizationCategory.cs
index bfeef8f..417ee73 100644
--- a/optimizerDuck/Domain/Abstractions/IOptimizationCategory.cs
+++ b/optimizerDuck/Domain/Abstractions/IOptimizationCategory.cs
@@ -22,4 +22,4 @@ public interface IOptimizationCategory
/// The collection of optimizations belonging to this category.
/// </summary>
public ObservableCollection<IOptimization> Optimizations { get; init; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Abstractions/IRevertStep.cs b/optimizerDuck/Domain/Abstractions/IRevertStep.cs
index 92c4817..d43da69 100644
--- a/optimizerDuck/Domain/Abstractions/IRevertStep.cs
+++ b/optimizerDuck/Domain/Abstractions/IRevertStep.cs
@@ -28,4 +28,4 @@ public interface IRevertStep
/// </summary>
/// <returns>A <see cref="JObject" /> containing the serialized step data.</returns>
JObject ToData();
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Abstractions/IWindow.cs b/optimizerDuck/Domain/Abstractions/IWindow.cs
index 2b0d17b..b47a2ee 100644
--- a/optimizerDuck/Domain/Abstractions/IWindow.cs
+++ b/optimizerDuck/Domain/Abstractions/IWindow.cs
@@ -16,4 +16,4 @@ public interface IWindow
/// Shows the window.
/// </summary>
void Show();
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Attributes/FeatureAttribute.cs b/optimizerDuck/Domain/Attributes/FeatureAttribute.cs
index effe275..68f22ba 100644
--- a/optimizerDuck/Domain/Attributes/FeatureAttribute.cs
+++ b/optimizerDuck/Domain/Attributes/FeatureAttribute.cs
@@ -17,4 +17,4 @@ public sealed class FeatureAttribute : Attribute
? Enum.GetName(e.GetType(), e) ?? string.Empty
: Section.ToString() ?? string.Empty;
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Attributes/FeatureCategoryAttribute.cs b/optimizerDuck/Domain/Attributes/FeatureCategoryAttribute.cs
index 127d7da..2f99474 100644
--- a/optimizerDuck/Domain/Attributes/FeatureCategoryAttribute.cs
+++ b/optimizerDuck/Domain/Attributes/FeatureCategoryAttribute.cs
@@ -4,4 +4,4 @@
public class FeatureCategoryAttribute : Attribute
{
public Type? PageType { get; init; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Attributes/OptimizationAttribute.cs b/optimizerDuck/Domain/Attributes/OptimizationAttribute.cs
index dec0d5a..39ddd3d 100644
--- a/optimizerDuck/Domain/Attributes/OptimizationAttribute.cs
+++ b/optimizerDuck/Domain/Attributes/OptimizationAttribute.cs
@@ -22,4 +22,4 @@ public sealed class OptimizationAttribute : Attribute
/// The tags that categorize the system areas this optimization affects.
/// </summary>
public required OptimizationTags Tags { get; init; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Attributes/OptimizationCategoryAttribute.cs b/optimizerDuck/Domain/Attributes/OptimizationCategoryAttribute.cs
index 4f93ff4..44f27fb 100644
--- a/optimizerDuck/Domain/Attributes/OptimizationCategoryAttribute.cs
+++ b/optimizerDuck/Domain/Attributes/OptimizationCategoryAttribute.cs
@@ -12,4 +12,4 @@ public class OptimizationCategoryAttribute(Type pageType) : Attribute
/// The type of the UI page associated with this optimization category.
/// </summary>
public Type PageType { get; init; } = pageType;
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Configuration/AppSettings.cs b/optimizerDuck/Domain/Configuration/AppSettings.cs
index 5870094..0d768e4 100644
--- a/optimizerDuck/Domain/Configuration/AppSettings.cs
+++ b/optimizerDuck/Domain/Configuration/AppSettings.cs
@@ -69,4 +69,4 @@ public sealed class AppSettings
/// </summary>
public bool RemoveProvisioned { get; set; } = true;
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Execution/ExecutionScope.cs b/optimizerDuck/Domain/Execution/ExecutionScope.cs
index 6d330b9..6f02c15 100644
--- a/optimizerDuck/Domain/Execution/ExecutionScope.cs
+++ b/optimizerDuck/Domain/Execution/ExecutionScope.cs
@@ -18,7 +18,6 @@ public sealed class ExecutionScope : IDisposable
private bool _disposed;
private int _stepIndex;
-
public static ExecutionScope? Current => _current.Value;
public Guid? OptimizationId { get; private init; }
@@ -53,17 +52,21 @@ public sealed class ExecutionScope : IDisposable
{
Logger.LogInformation(
"Completed in {Time} (no operations tracked)",
- _stopwatch.Elapsed.ToString(@"mm\:ss\.fff"));
+ _stopwatch.Elapsed.ToString(@"mm\:ss\.fff")
+ );
}
else
{
- var summary = string.Join(", ", _stats.Select(kv =>
- $"{kv.Key}: +({kv.Value.Success}) -({kv.Value.Fail})"));
+ var summary = string.Join(
+ ", ",
+ _stats.Select(kv => $"{kv.Key}: +({kv.Value.Success}) -({kv.Value.Fail})")
+ );
Logger.LogInformation(
"Completed in {Time} | {Summary}",
_stopwatch.Elapsed.ToString(@"mm\:ss\.fff"),
- summary);
+ summary
+ );
}
if (!LoggingOnly)
@@ -80,42 +83,64 @@ public sealed class ExecutionScope : IDisposable
public static ExecutionScope Begin(IOptimization optimization, ILogger logger)
{
if (_current.Value != null)
- throw new InvalidOperationException("An execution scope is already active in the current context.");
+ throw new InvalidOperationException(
+ "An execution scope is already active in the current context."
+ );
var scope = new ExecutionScope
{
- OptimizationId = optimization.Id, OptimizationKey = optimization.OptimizationKey,
- OptimizationName = optimization.Name, Logger = logger
+ OptimizationId = optimization.Id,
+ OptimizationKey = optimization.OptimizationKey,
+ OptimizationName = optimization.Name,
+ Logger = logger,
};
_current.Value = scope;
- logger.LogDebug("Execution scope started for {Key} (ID: {Id})", optimization.OptimizationKey, optimization.Id);
+ logger.LogDebug(
+ "Execution scope started for {Key} (ID: {Id})",
+ optimization.OptimizationKey,
+ optimization.Id
+ );
return scope;
}
public static ExecutionScope BeginForLogging(ILogger logger)
{
if (_current.Value != null)
- throw new InvalidOperationException("An execution scope is already active in the current context.");
+ throw new InvalidOperationException(
+ "An execution scope is already active in the current context."
+ );
var scope = new ExecutionScope
{
- OptimizationId = Guid.Empty, OptimizationKey = string.Empty, OptimizationName = string.Empty,
- Logger = logger, LoggingOnly = true
+ OptimizationId = Guid.Empty,
+ OptimizationKey = string.Empty,
+ OptimizationName = string.Empty,
+ Logger = logger,
+ LoggingOnly = true,
};
_current.Value = scope;
logger.LogDebug("Execution scope started (logging only)");
return scope;
}
- public static ExecutionScope BeginForLogging(Guid optimizationId, string optimizationKey, ILogger logger)
+ public static ExecutionScope BeginForLogging(
+ Guid optimizationId,
+ string optimizationKey,
+ ILogger logger
+ )
{
if (_current.Value != null)
- throw new InvalidOperationException("An execution scope is already active in the current context.");
+ throw new InvalidOperationException(
+ "An execution scope is already active in the current context."
+ );
var scope = new ExecutionScope
{
- OptimizationId = optimizationId, OptimizationKey = optimizationKey, OptimizationName = string.Empty,
- Logger = logger, LoggingOnly = true
+ OptimizationId = optimizationId,
+ OptimizationKey = optimizationKey,
+ OptimizationName = string.Empty,
+ Logger = logger,
+ LoggingOnly = true,
};
_current.Value = scope;
logger.LogDebug("Execution scope started for {Key} (logging only)", optimizationKey);
@@ -125,14 +150,16 @@ public sealed class ExecutionScope : IDisposable
public static ExecutionScope BeginForCapture(ILogger logger)
{
if (_current.Value != null)
- throw new InvalidOperationException("An execution scope is already active in the current context.");
+ throw new InvalidOperationException(
+ "An execution scope is already active in the current context."
+ );
var scope = new ExecutionScope
{
OptimizationId = Guid.Empty,
OptimizationKey = string.Empty,
OptimizationName = string.Empty,
- Logger = logger
+ Logger = logger,
};
_current.Value = scope;
logger.LogDebug("Execution scope started for retry capture");
@@ -145,11 +172,19 @@ public sealed class ExecutionScope : IDisposable
bool success,
IRevertStep? revertStep = null,
string? error = null,
- Func<Task<bool>>? retryAction = null)
+ Func<Task<bool>>? retryAction = null
+ )
{
var scope = Current;
- return scope?.RecordStepInternal(name, description, success, revertStep, error, retryAction);
+ return scope?.RecordStepInternal(
+ name,
+ description,
+ success,
+ revertStep,
+ error,
+ retryAction
+ );
}
public static void Track(string serviceName, bool success)
@@ -158,15 +193,16 @@ public sealed class ExecutionScope : IDisposable
scope?._stats.AddOrUpdate(
serviceName,
- _ => success
- ? new Stats { Success = 1 }
- : new Stats { Fail = 1 },
+ _ => success ? new Stats { Success = 1 } : new Stats { Fail = 1 },
(_, stats) =>
{
- if (success) stats.Success++;
- else stats.Fail++;
+ if (success)
+ stats.Success++;
+ else
+ stats.Fail++;
return stats;
- });
+ }
+ );
}
public List<OperationStepResult> GetStepResults()
@@ -186,20 +222,23 @@ public sealed class ExecutionScope : IDisposable
Status = status,
Message = status switch
{
- OptimizationSuccessResult.Success =>
- string.Format(Translations.Optimization_Apply_Success,
- OptimizationName),
- OptimizationSuccessResult.Failed when allFailed =>
- string.Format(Translations.Optimization_Apply_Error_Failed,
- OptimizationName),
+ OptimizationSuccessResult.Success => string.Format(
+ Translations.Optimization_Apply_Success,
+ OptimizationName
+ ),
+ OptimizationSuccessResult.Failed when allFailed => string.Format(
+ Translations.Optimization_Apply_Error_Failed,
+ OptimizationName
+ ),
OptimizationSuccessResult.PartialSuccess or OptimizationSuccessResult.Failed =>
string.Format(
Translations.Optimization_Apply_Error_FailedWithSteps,
OptimizationName,
- failedSteps.Count),
- _ => $"Unknown result for {OptimizationName}"
+ failedSteps.Count
+ ),
+ _ => $"Unknown result for {OptimizationName}",
},
- FailedSteps = failedSteps
+ FailedSteps = failedSteps,
};
}
@@ -209,7 +248,8 @@ public sealed class ExecutionScope : IDisposable
bool success,
IRevertStep? revertStep,
string? error,
- Func<Task<bool>>? retryAction = null)
+ Func<Task<bool>>? retryAction = null
+ )
{
if (LoggingOnly)
return null;
@@ -221,7 +261,8 @@ public sealed class ExecutionScope : IDisposable
success,
revertStep,
error,
- retryAction);
+ retryAction
+ );
_executedSteps.Add(step);
@@ -236,11 +277,9 @@ public sealed class ExecutionScope : IDisposable
var failed = FailedSteps.Count;
var total = ExecutedSteps.Count;
- return failed == 0
- ? OptimizationSuccessResult.Success
- : failed < total
- ? OptimizationSuccessResult.PartialSuccess
- : OptimizationSuccessResult.Failed;
+ return failed == 0 ? OptimizationSuccessResult.Success
+ : failed < total ? OptimizationSuccessResult.PartialSuccess
+ : OptimizationSuccessResult.Failed;
}
private static OperationStepResult ToOperationStepResult(ExecutedStep step)
@@ -253,7 +292,7 @@ public sealed class ExecutionScope : IDisposable
Success = step.Success,
Error = step.Error,
RetryAction = step.RetryAction,
- RevertStep = step.RevertStep
+ RevertStep = step.RevertStep,
};
}
@@ -306,8 +345,15 @@ public sealed record ExecutedStep
/// <summary>
/// Initializes a new instance of the <see cref="ExecutedStep" /> class.
/// </summary>
- public ExecutedStep(int index, string name, string description, bool success,
- IRevertStep? revertStep, string? error, Func<Task<bool>>? retryAction = null)
+ public ExecutedStep(
+ int index,
+ string name,
+ string description,
+ bool success,
+ IRevertStep? revertStep,
+ string? error,
+ Func<Task<bool>>? retryAction = null
+ )
{
Index = index;
Name = name;
diff --git a/optimizerDuck/Domain/Features/Categories/Desktop.cs b/optimizerDuck/Domain/Features/Categories/Desktop.cs
index 1e84b4f..f4af312 100644
--- a/optimizerDuck/Domain/Features/Categories/Desktop.cs
+++ b/optimizerDuck/Domain/Features/Categories/Desktop.cs
@@ -17,7 +17,7 @@ public class Desktop : IFeatureCategory
private enum Sections
{
Icons,
- Behaviors
+ Behaviors,
}
public string Name => Loc.Instance[$"Features.{nameof(Desktop)}.Name"];
@@ -32,16 +32,17 @@ public class Desktop : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel",
- Name = "{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
- OnValue = 0,
- OffValue = 1,
- DefaultValue = 0
- }
- ];
+ [
+ new()
+ {
+ Path =
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel",
+ Name = "{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
+ OnValue = 0,
+ OffValue = 1,
+ DefaultValue = 0,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Icons), Icon = SymbolRegular.Delete24)]
@@ -50,16 +51,17 @@ public class Desktop : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel",
- Name = "{645FF040-5081-101B-9F08-00AA002F954E}",
- OnValue = 0,
- OffValue = 1,
- DefaultValue = 0
- }
- ];
+ [
+ new()
+ {
+ Path =
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel",
+ Name = "{645FF040-5081-101B-9F08-00AA002F954E}",
+ OnValue = 0,
+ OffValue = 1,
+ DefaultValue = 0,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Icons), Icon = SymbolRegular.Folder24)]
@@ -68,16 +70,17 @@ public class Desktop : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel",
- Name = "{59031a47-3f72-44a7-89c5-5595fe6b30ee}",
- OnValue = 0,
- OffValue = 1,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path =
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel",
+ Name = "{59031a47-3f72-44a7-89c5-5595fe6b30ee}",
+ OnValue = 0,
+ OffValue = 1,
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Icons), Icon = SymbolRegular.Desktop24)]
@@ -86,16 +89,17 @@ public class Desktop : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel",
- Name = "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}",
- OnValue = 0,
- OffValue = 1,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path =
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel",
+ Name = "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}",
+ OnValue = 0,
+ OffValue = 1,
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Icons), Icon = SymbolRegular.Grid24)]
@@ -104,16 +108,17 @@ public class Desktop : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel",
- Name = "{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}",
- OnValue = 0,
- OffValue = 1,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path =
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel",
+ Name = "{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}",
+ OnValue = 0,
+ OffValue = 1,
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Icons), Icon = SymbolRegular.Desktop24)]
@@ -122,23 +127,23 @@ public class Desktop : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer",
- Name = "NoDesktop",
- OnValue = 0,
- OffValue = 1,
- DefaultValue = 0
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer",
+ Name = "NoDesktop",
+ OnValue = 0,
+ OffValue = 1,
+ DefaultValue = 0,
+ },
+ ];
}
-
[Feature(Section = nameof(Sections.Behaviors), Icon = SymbolRegular.ArrowForward24)]
public class RemoveShortcutArrow : BaseFeature
{
- private const string Path = @"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons";
+ private const string Path =
+ @"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons";
protected override bool NeedsPostAction => true;
@@ -150,7 +155,14 @@ public class Desktop : IFeatureCategory
public override async Task EnableAsync()
{
- RegistryService.Write(new RegistryItem(Path, "29", @"%windir%\System32\shell32.dll,-50", Microsoft.Win32.RegistryValueKind.String));
+ RegistryService.Write(
+ new RegistryItem(
+ Path,
+ "29",
+ @"%windir%\System32\shell32.dll,-50",
+ Microsoft.Win32.RegistryValueKind.String
+ )
+ );
if (NeedsPostAction)
await ExecutePostActionAsync();
}
diff --git a/optimizerDuck/Domain/Features/Categories/Gaming.cs b/optimizerDuck/Domain/Features/Categories/Gaming.cs
index f0abb09..60e36d7 100644
--- a/optimizerDuck/Domain/Features/Categories/Gaming.cs
+++ b/optimizerDuck/Domain/Features/Categories/Gaming.cs
@@ -18,7 +18,7 @@ public class Gaming : IFeatureCategory
{
GameSettings,
Input,
- Display
+ Display,
}
public string Name => Loc.Instance[$"Features.{nameof(Gaming)}.Name"];
@@ -31,199 +31,199 @@ public class Gaming : IFeatureCategory
public class GameMode : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\GameBar",
- Name = "AllowAutoGameMode",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- },
- new()
- {
- Path = @"HKCU\Software\Microsoft\GameBar",
- Name = "AutoGameModeEnabled",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\GameBar",
+ Name = "AllowAutoGameMode",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\GameBar",
+ Name = "AutoGameModeEnabled",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.GameSettings), Icon = SymbolRegular.XboxConsole24)]
public class GameBar : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\System\GameConfigStore",
- Name = "GameBarEnabled",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- },
- new()
- {
- Path = @"HKCU\Software\Microsoft\GameBar",
- Name = "ShowStartupPanel",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- },
- new()
- {
- Path = @"HKCU\Software\Microsoft\GameBar",
- Name = "UseNexusForGameBarEnabled",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- },
- new()
- {
- Path = @"HKCU\Software\Microsoft\GameBar",
- Name = "GamePanelStartupTipIndex",
- OnValue = 3,
- OffValue = 0,
- DefaultValue = 3
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\System\GameConfigStore",
+ Name = "GameBarEnabled",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\GameBar",
+ Name = "ShowStartupPanel",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\GameBar",
+ Name = "UseNexusForGameBarEnabled",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\GameBar",
+ Name = "GamePanelStartupTipIndex",
+ OnValue = 3,
+ OffValue = 0,
+ DefaultValue = 3,
+ },
+ ];
}
[Feature(Section = nameof(Sections.GameSettings), Icon = SymbolRegular.Record24)]
public class BackgroundRecording : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR",
- Name = "AppCaptureEnabled",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- },
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR",
- Name = "HistoricalCaptureEnabled",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 0
- },
- new()
- {
- Path = @"HKCU\System\GameConfigStore",
- Name = "GameDVR_Enabled",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- },
- new()
- {
- Path = @"HKCU\System\GameConfigStore",
- Name = "GameDVR_HistoricalCaptureEnabled",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 0
- },
- new()
- {
- Path = @"HKLM\SOFTWARE\Policies\Microsoft\Windows\GameDVR",
- Name = "AllowGameDVR",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR",
+ Name = "AppCaptureEnabled",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR",
+ Name = "HistoricalCaptureEnabled",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 0,
+ },
+ new()
+ {
+ Path = @"HKCU\System\GameConfigStore",
+ Name = "GameDVR_Enabled",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ new()
+ {
+ Path = @"HKCU\System\GameConfigStore",
+ Name = "GameDVR_HistoricalCaptureEnabled",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 0,
+ },
+ new()
+ {
+ Path = @"HKLM\SOFTWARE\Policies\Microsoft\Windows\GameDVR",
+ Name = "AllowGameDVR",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Input), Icon = SymbolRegular.Cursor24)]
public class MouseAcceleration : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Control Panel\Mouse",
- Name = "MouseSpeed",
- OnValue = "1",
- OffValue = "0",
- DefaultValue = "1"
- },
- new()
- {
- Path = @"HKCU\Control Panel\Mouse",
- Name = "MouseThreshold1",
- OnValue = "6",
- OffValue = "0",
- DefaultValue = "6"
- },
- new()
- {
- Path = @"HKCU\Control Panel\Mouse",
- Name = "MouseThreshold2",
- OnValue = "10",
- OffValue = "0",
- DefaultValue = "10"
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Control Panel\Mouse",
+ Name = "MouseSpeed",
+ OnValue = "1",
+ OffValue = "0",
+ DefaultValue = "1",
+ },
+ new()
+ {
+ Path = @"HKCU\Control Panel\Mouse",
+ Name = "MouseThreshold1",
+ OnValue = "6",
+ OffValue = "0",
+ DefaultValue = "6",
+ },
+ new()
+ {
+ Path = @"HKCU\Control Panel\Mouse",
+ Name = "MouseThreshold2",
+ OnValue = "10",
+ OffValue = "0",
+ DefaultValue = "10",
+ },
+ ];
}
[Feature(Section = nameof(Sections.Display), Icon = SymbolRegular.FullScreenMaximize24)]
public class FullscreenOptimizations : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\System\GameConfigStore",
- Name = "GameDVR_DXGIHonorFSEWindowsCompatible",
- OnValue = 0,
- OffValue = 1,
- DefaultValue = 0
- },
- new()
- {
- Path = @"HKCU\System\GameConfigStore",
- Name = "GameDVR_FSEBehavior",
- OnValue = 0,
- OffValue = 2,
- DefaultValue = 0
- },
- new()
- {
- Path = @"HKCU\System\GameConfigStore",
- Name = "GameDVR_FSEBehaviorMode",
- OnValue = 0,
- OffValue = 2,
- DefaultValue = 0
- },
- new()
- {
- Path = @"HKCU\System\GameConfigStore",
- Name = "GameDVR_HonorUserFSEBehaviorMode",
- OnValue = 0,
- OffValue = 1,
- DefaultValue = 0
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\System\GameConfigStore",
+ Name = "GameDVR_DXGIHonorFSEWindowsCompatible",
+ OnValue = 0,
+ OffValue = 1,
+ DefaultValue = 0,
+ },
+ new()
+ {
+ Path = @"HKCU\System\GameConfigStore",
+ Name = "GameDVR_FSEBehavior",
+ OnValue = 0,
+ OffValue = 2,
+ DefaultValue = 0,
+ },
+ new()
+ {
+ Path = @"HKCU\System\GameConfigStore",
+ Name = "GameDVR_FSEBehaviorMode",
+ OnValue = 0,
+ OffValue = 2,
+ DefaultValue = 0,
+ },
+ new()
+ {
+ Path = @"HKCU\System\GameConfigStore",
+ Name = "GameDVR_HonorUserFSEBehaviorMode",
+ OnValue = 0,
+ OffValue = 1,
+ DefaultValue = 0,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Display), Icon = SymbolRegular.VideoClip24)]
public class HardwareAcceleratedGpuScheduling : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers",
- Name = "HwSchMode",
- OnValue = 2,
- OffValue = 1,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers",
+ Name = "HwSchMode",
+ OnValue = 2,
+ OffValue = 1,
+ DefaultValue = 1,
+ },
+ ];
}
}
diff --git a/optimizerDuck/Domain/Features/Categories/Preferences.cs b/optimizerDuck/Domain/Features/Categories/Preferences.cs
index 3089211..4ef4a3e 100644
--- a/optimizerDuck/Domain/Features/Categories/Preferences.cs
+++ b/optimizerDuck/Domain/Features/Categories/Preferences.cs
@@ -18,7 +18,7 @@ public class Preferences : IFeatureCategory
{
Taskbar,
Appearance,
- Explorer
+ Explorer,
}
public string Name => Loc.Instance[$"Features.{nameof(Preferences)}.Name"];
@@ -33,16 +33,16 @@ public class Preferences : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- Name = "TaskbarAl",
- OnValue = 1, // Center
- OffValue = 0, // Left
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ Name = "TaskbarAl",
+ OnValue = 1, // Center
+ OffValue = 0, // Left
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Taskbar), Icon = SymbolRegular.Grid24)]
@@ -51,32 +51,32 @@ public class Preferences : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- Name = "TaskbarDa",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- },
- new()
- {
- Path = @"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds",
- Name = "EnableFeeds",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- },
- new()
- {
- Path = @"HKLM\SOFTWARE\Policies\Microsoft\Dsh",
- Name = "AllowNewsAndInterests",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ Name = "TaskbarDa",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ new()
+ {
+ Path = @"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds",
+ Name = "EnableFeeds",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ new()
+ {
+ Path = @"HKLM\SOFTWARE\Policies\Microsoft\Dsh",
+ Name = "AllowNewsAndInterests",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Taskbar), Icon = SymbolRegular.DesktopMac24)]
@@ -85,56 +85,59 @@ public class Preferences : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- Name = "ShowTaskViewButton",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ Name = "ShowTaskViewButton",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Taskbar), Icon = SymbolRegular.WindowConsole20)]
public class TaskbarEndTask : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings",
- Name = "TaskbarEndTask",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 0
- }
- ];
+ [
+ new()
+ {
+ Path =
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings",
+ Name = "TaskbarEndTask",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 0,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Appearance), Icon = SymbolRegular.DarkTheme24)]
public class DarkMode : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
- Name = "AppsUseLightTheme",
- OnValue = 0,
- OffValue = 1,
- DefaultValue = 1
- },
- new()
- {
- Path = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
- Name = "SystemUsesLightTheme",
- OnValue = 0,
- OffValue = 1,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path =
+ @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
+ Name = "AppsUseLightTheme",
+ OnValue = 0,
+ OffValue = 1,
+ DefaultValue = 1,
+ },
+ new()
+ {
+ Path =
+ @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
+ Name = "SystemUsesLightTheme",
+ OnValue = 0,
+ OffValue = 1,
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Explorer), Icon = SymbolRegular.AlertOff24)]
@@ -143,56 +146,56 @@ public class Preferences : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- Name = "ShowSyncProviderNotifications",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ Name = "ShowSyncProviderNotifications",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Explorer), Icon = SymbolRegular.Lightbulb24)]
public class SystemSuggestions : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- Name = "SystemPaneSuggestionsEnabled",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ Name = "SystemPaneSuggestionsEnabled",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Explorer), Icon = SymbolRegular.Alert24)]
public class ToastNotifications : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\PushNotifications",
- Name = "ToastEnabled",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- },
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\PushNotifications",
- Name = "LockScreenToastEnabled",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\PushNotifications",
+ Name = "ToastEnabled",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\PushNotifications",
+ Name = "LockScreenToastEnabled",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Explorer), Icon = SymbolRegular.Table24)]
@@ -201,16 +204,16 @@ public class Preferences : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- Name = "UseCompactMode",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 0
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ Name = "UseCompactMode",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 0,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Explorer), Icon = SymbolRegular.Grid24)]
@@ -219,16 +222,16 @@ public class Preferences : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- Name = "EnableSnapAssistFlyout",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ Name = "EnableSnapAssistFlyout",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Explorer), Icon = SymbolRegular.CheckboxChecked24)]
@@ -237,16 +240,16 @@ public class Preferences : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- Name = "AutoCheckSelect",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 0
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ Name = "AutoCheckSelect",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 0,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Explorer), Icon = SymbolRegular.DocumentText24)]
@@ -255,16 +258,16 @@ public class Preferences : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- Name = "HideFileExt",
- OnValue = 0,
- OffValue = 1,
- DefaultValue = 1
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ Name = "HideFileExt",
+ OnValue = 0,
+ OffValue = 1,
+ DefaultValue = 1,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Explorer), Icon = SymbolRegular.FolderProhibited48)]
@@ -273,32 +276,32 @@ public class Preferences : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- Name = "Hidden",
- OnValue = 1,
- OffValue = 2,
- DefaultValue = 2
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ Name = "Hidden",
+ OnValue = 1,
+ OffValue = 2,
+ DefaultValue = 2,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Explorer), Icon = SymbolRegular.DocumentText24)]
public class ClipboardHistory : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Clipboard",
- Name = "EnableClipboardHistory",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 0
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Clipboard",
+ Name = "EnableClipboardHistory",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 0,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Explorer), Icon = SymbolRegular.CursorClick24)]
@@ -307,48 +310,48 @@ public class Preferences : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- Name = "DisallowShaking",
- OnValue = 0,
- OffValue = 1,
- DefaultValue = 0
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ Name = "DisallowShaking",
+ OnValue = 0,
+ OffValue = 1,
+ DefaultValue = 0,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Taskbar), Icon = SymbolRegular.Clock24)]
public class ShowSecondsInSystemClock : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- Name = "ShowSecondsInSystemClock",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 0
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ Name = "ShowSecondsInSystemClock",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 0,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Explorer), Icon = SymbolRegular.Folder24)]
public class LaunchToThisPc : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- Name = "LaunchTo",
- OnValue = 1,
- OffValue = 2,
- DefaultValue = 2
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ Name = "LaunchTo",
+ OnValue = 1,
+ OffValue = 2,
+ DefaultValue = 2,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Taskbar), Icon = SymbolRegular.Search24)]
@@ -357,16 +360,16 @@ public class Preferences : IFeatureCategory
protected override bool NeedsPostAction => true;
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKCU\Software\Policies\Microsoft\Windows\Explorer",
- Name = "DisableSearchBoxSuggestions",
- OnValue = 1,
- OffValue = 0,
- DefaultValue = 0
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKCU\Software\Policies\Microsoft\Windows\Explorer",
+ Name = "DisableSearchBoxSuggestions",
+ OnValue = 1,
+ OffValue = 0,
+ DefaultValue = 0,
+ },
+ ];
}
[Feature(Section = nameof(Sections.Explorer), Icon = SymbolRegular.CursorClick24)]
@@ -375,8 +378,7 @@ public class Preferences : IFeatureCategory
private const string BasePath =
@"HKCU\SOFTWARE\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}";
- private const string InprocPath =
- BasePath + @"\InprocServer32";
+ private const string InprocPath = BasePath + @"\InprocServer32";
protected override bool NeedsPostAction => true;
diff --git a/optimizerDuck/Domain/Features/Categories/SystemFeatures.cs b/optimizerDuck/Domain/Features/Categories/SystemFeatures.cs
index e5ed98d..04f5b26 100644
--- a/optimizerDuck/Domain/Features/Categories/SystemFeatures.cs
+++ b/optimizerDuck/Domain/Features/Categories/SystemFeatures.cs
@@ -3,8 +3,8 @@ using optimizerDuck.Domain.Abstractions;
using optimizerDuck.Domain.Attributes;
using optimizerDuck.Domain.Features.Models;
using optimizerDuck.Domain.Optimizations.Models.Services;
-using optimizerDuck.Services.Managers;
using optimizerDuck.Domain.UI;
+using optimizerDuck.Services.Managers;
using optimizerDuck.UI.Pages.Features;
using Wpf.Ui.Controls;
@@ -15,7 +15,7 @@ public class SystemFeatures : IFeatureCategory
{
private enum Sections
{
- Input
+ Input,
}
public string Name => Loc.Instance[$"Features.{nameof(SystemFeatures)}.Name"];
@@ -28,23 +28,23 @@ public class SystemFeatures : IFeatureCategory
public class EnableNumLockOnBoot : BaseFeature
{
protected override IEnumerable<RegistryToggle> RegistryToggles =>
- [
- new()
- {
- Path = @"HKU\.DEFAULT\Control Panel\Keyboard",
- Name = "InitialKeyboardIndicators",
- OnValue = "2",
- OffValue = "0",
- DefaultValue = "0"
- },
- new()
- {
- Path = @"HKCU\\Control Panel\\Keyboard",
- Name = "InitialKeyboardIndicators",
- OnValue = "2",
- OffValue = "0",
- DefaultValue = "0"
- }
- ];
+ [
+ new()
+ {
+ Path = @"HKU\.DEFAULT\Control Panel\Keyboard",
+ Name = "InitialKeyboardIndicators",
+ OnValue = "2",
+ OffValue = "0",
+ DefaultValue = "0",
+ },
+ new()
+ {
+ Path = @"HKCU\\Control Panel\\Keyboard",
+ Name = "InitialKeyboardIndicators",
+ OnValue = "2",
+ OffValue = "0",
+ DefaultValue = "0",
+ },
+ ];
}
}
diff --git a/optimizerDuck/Domain/Features/Models/BaseFeature.cs b/optimizerDuck/Domain/Features/Models/BaseFeature.cs
index 75651ac..9a611b4 100644
--- a/optimizerDuck/Domain/Features/Models/BaseFeature.cs
+++ b/optimizerDuck/Domain/Features/Models/BaseFeature.cs
@@ -12,19 +12,19 @@ public abstract class BaseFeature : IFeature
private FeatureAttribute? _meta;
private FeatureAttribute Meta =>
- _meta ??= GetType().GetCustomAttribute<FeatureAttribute>()
- ?? throw new InvalidOperationException(
- $"{GetType().Name} is missing [Feature] attribute");
+ _meta ??=
+ GetType().GetCustomAttribute<FeatureAttribute>()
+ ?? throw new InvalidOperationException(
+ $"{GetType().Name} is missing [Feature] attribute"
+ );
public Type? OwnerType { get; set; }
public string OwnerKey =>
OwnerType?.Name
- ?? throw new InvalidOperationException(
- $"{GetType().Name} has no owner assigned");
+ ?? throw new InvalidOperationException($"{GetType().Name} has no owner assigned");
- protected virtual IEnumerable<RegistryToggle> RegistryToggles
- => [];
+ protected virtual IEnumerable<RegistryToggle> RegistryToggles => [];
public string FeatureKey => GetType().Name;
@@ -75,11 +75,10 @@ public abstract class BaseFeature : IFeature
}
private Task SetTogglesState(bool isOn)
-
{
foreach (var toggle in RegistryToggles)
toggle.SetState(isOn);
return Task.CompletedTask;
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Features/Models/FeatureSection.cs b/optimizerDuck/Domain/Features/Models/FeatureSection.cs
index 84c4f43..12c8c70 100644
--- a/optimizerDuck/Domain/Features/Models/FeatureSection.cs
+++ b/optimizerDuck/Domain/Features/Models/FeatureSection.cs
@@ -6,7 +6,9 @@ namespace optimizerDuck.Domain.Features.Models;
public partial class FeatureSection : ObservableObject
{
- [ObservableProperty] private ObservableCollection<FeatureViewModel> _features = [];
+ [ObservableProperty]
+ private ObservableCollection<FeatureViewModel> _features = [];
- [ObservableProperty] private string _name = string.Empty;
-}
\ No newline at end of file
+ [ObservableProperty]
+ private string _name = string.Empty;
+}
diff --git a/optimizerDuck/Domain/Features/Models/RegistryToggle.cs b/optimizerDuck/Domain/Features/Models/RegistryToggle.cs
index 1d26cb8..8c1a787 100644
--- a/optimizerDuck/Domain/Features/Models/RegistryToggle.cs
+++ b/optimizerDuck/Domain/Features/Models/RegistryToggle.cs
@@ -38,10 +38,7 @@ public class RegistryToggle
return da == db;
}
- return a.ToString()?.Equals(
- b.ToString(),
- StringComparison.OrdinalIgnoreCase
- ) == true;
+ return a.ToString()?.Equals(b.ToString(), StringComparison.OrdinalIgnoreCase) == true;
}
private object? GetRawValue()
@@ -62,4 +59,4 @@ public class RegistryToggle
else
RegistryService.Write(new RegistryItem(Path, Name, targetValue, ValueKind));
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Optimizations/Categories/BloatwareAndServices.cs b/optimizerDuck/Domain/Optimizations/Categories/BloatwareAndServices.cs
index af6092f..efca90c 100644
--- a/optimizerDuck/Domain/Optimizations/Categories/BloatwareAndServices.cs
+++ b/optimizerDuck/Domain/Optimizations/Categories/BloatwareAndServices.cs
@@ -15,37 +15,60 @@ namespace optimizerDuck.Domain.Optimizations.Categories;
public class BloatwareAndServices : IOptimizationCategory
{
public string Name => Loc.Instance[$"Optimizer.{nameof(BloatwareAndServices)}"];
- public OptimizationCategoryOrder Order { get; init; } = OptimizationCategoryOrder.BloatwareAndServices;
+ public OptimizationCategoryOrder Order { get; init; } =
+ OptimizationCategoryOrder.BloatwareAndServices;
public ObservableCollection<IOptimization> Optimizations { get; init; } = [];
- [Optimization(Id = "E3C970B0-129D-4354-BAE4-2732E5BACCF7", Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.System | OptimizationTags.Disk)]
+ [Optimization(
+ Id = "E3C970B0-129D-4354-BAE4-2732E5BACCF7",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Disk
+ )]
public class DisablePreinstalledApps : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "PreInstalledAppsEnabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "PreInstalledAppsEverEnabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "OemPreInstalledAppsEnabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SilentInstalledAppsEnabled", 0)
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "PreInstalledAppsEnabled",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "PreInstalledAppsEverEnabled",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "OemPreInstalledAppsEnabled",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "SilentInstalledAppsEnabled",
+ 0
+ )
);
context.Logger.LogInformation("Blocked preinstalled apps");
return Task.FromResult(ApplyResult.True());
}
}
- [Optimization(Id = "66126FAC-E79B-4CDA-9F53-F85DD88730A9", Risk = OptimizationRisk.Risky,
- Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Latency)]
+ [Optimization(
+ Id = "66126FAC-E79B-4CDA-9F53-F85DD88730A9",
+ Risk = OptimizationRisk.Risky,
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Latency
+ )]
public class ConfigureServices : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
var servicesToChange = new List<ServiceItem>
{
@@ -287,25 +310,33 @@ public class BloatwareAndServices : IOptimizationCategory
new("wmiApSrv", ServiceStartupType.Manual),
new("workfolderssvc", ServiceStartupType.Manual),
new("wscsvc", ServiceStartupType.AutomaticDelayedStart),
- new("wuauserv", ServiceStartupType.Manual)
+ new("wuauserv", ServiceStartupType.Manual),
};
for (var i = 0; i < servicesToChange.Count; i++)
{
var service = servicesToChange[i];
- progress?.Report(new ProcessingProgress
- {
- Message = string.Format(Loc.Instance[$"{ProgressPrefix}.ChangeServiceStartupType"], service.Name,
- service.StartupType),
- IsIndeterminate = false,
- Value = i + 1,
- Total = servicesToChange.Count
- });
+ progress?.Report(
+ new ProcessingProgress
+ {
+ Message = string.Format(
+ Loc.Instance[$"{ProgressPrefix}.ChangeServiceStartupType"],
+ service.Name,
+ service.StartupType
+ ),
+ IsIndeterminate = false,
+ Value = i + 1,
+ Total = servicesToChange.Count,
+ }
+ );
ServiceProcessService.ChangeServiceStartupType(service);
}
- context.Logger.LogInformation("Optimized service startup for {Count} services", servicesToChange.Count);
+ context.Logger.LogInformation(
+ "Optimized service startup for {Count} services",
+ servicesToChange.Count
+ );
return Task.FromResult(ApplyResult.True());
}
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Optimizations/Categories/Gpu.cs b/optimizerDuck/Domain/Optimizations/Categories/Gpu.cs
index cfbf515..630286e 100644
--- a/optimizerDuck/Domain/Optimizations/Categories/Gpu.cs
+++ b/optimizerDuck/Domain/Optimizations/Categories/Gpu.cs
@@ -18,14 +18,24 @@ public abstract class GpuRegistryOptimization : BaseOptimization
protected abstract IReadOnlyList<RegistryItem> CreateItems(string registryPath);
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
- foreach (var gpu in context.Snapshot.Gpus
- .Where(g => g.Vendor == Vendor && !string.IsNullOrEmpty(g.DeviceId)))
+ foreach (
+ var gpu in context.Snapshot.Gpus.Where(g =>
+ g.Vendor == Vendor && !string.IsNullOrEmpty(g.DeviceId)
+ )
+ )
{
if (!Gpu.TryParseDeviceIdToIndex(gpu.DeviceId, out var index))
{
- context.Logger.LogWarning("Invalid DeviceId for GPU {GpuName} ({DeviceId})", gpu.Name, gpu.DeviceId);
+ context.Logger.LogWarning(
+ "Invalid DeviceId for GPU {GpuName} ({DeviceId})",
+ gpu.Name,
+ gpu.DeviceId
+ );
continue;
}
@@ -33,7 +43,11 @@ public abstract class GpuRegistryOptimization : BaseOptimization
$@"HKLM\SYSTEM\CurrentControlSet\Control\Class\{{4d36e968-e325-11ce-bfc1-08002be10318}}\{index:D4}";
RegistryService.Write(CreateItems(path).ToArray());
- context.Logger.LogInformation("Applied {Optimization} for GPU {DeviceId}", GetType().Name, gpu.DeviceId);
+ context.Logger.LogInformation(
+ "Applied {Optimization} for GPU {DeviceId}",
+ GetType().Name,
+ gpu.DeviceId
+ );
}
return Task.FromResult(ApplyResult.True());
@@ -125,24 +139,23 @@ public class Gpu : IOptimizationCategory
[Optimization(
Id = "4433CE93-B632-4D67-AE71-0241C31099C0",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Amd | OptimizationTags.Power)]
+ Tags = OptimizationTags.Amd | OptimizationTags.Power
+ )]
public class AmdDisableUlps : GpuRegistryOptimization
{
protected override GpuVendor Vendor => GpuVendor.AMD;
protected override IReadOnlyList<RegistryItem> CreateItems(string path)
{
- return
- [
- new RegistryItem(path, "EnableULPS", 0)
- ];
+ return [new RegistryItem(path, "EnableULPS", 0)];
}
}
[Optimization(
Id = "A3836587-C461-4BEB-9C4C-88493B36C138",
Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.Amd | OptimizationTags.Performance)]
+ Tags = OptimizationTags.Amd | OptimizationTags.Performance
+ )]
public class AmdDisablePowerGating : GpuRegistryOptimization
{
protected override GpuVendor Vendor => GpuVendor.AMD;
@@ -153,7 +166,7 @@ public class Gpu : IOptimizationCategory
[
new RegistryItem(path, "DisablePowerGating", 1),
new RegistryItem(path, "PP_GPUPowerDownEnabled", 0),
- new RegistryItem(path, "DisableDynamicPstate", 1)
+ new RegistryItem(path, "DisableDynamicPstate", 1),
];
}
}
@@ -161,7 +174,8 @@ public class Gpu : IOptimizationCategory
[Optimization(
Id = "DB379BB5-FC8C-4AD3-BE32-11BE09E76FBA",
Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.Amd | OptimizationTags.Performance)]
+ Tags = OptimizationTags.Amd | OptimizationTags.Performance
+ )]
public class AmdDisableVideoClockGating : GpuRegistryOptimization
{
protected override GpuVendor Vendor => GpuVendor.AMD;
@@ -173,7 +187,7 @@ public class Gpu : IOptimizationCategory
new RegistryItem(path, "DisableVCEPowerGating", 1),
new RegistryItem(path, "DisableVceClockGating", 1),
new RegistryItem(path, "EnableUvdClockGating", 0),
- new RegistryItem(path, "EnableVceSwClockGating", 0)
+ new RegistryItem(path, "EnableVceSwClockGating", 0),
];
}
}
@@ -181,7 +195,8 @@ public class Gpu : IOptimizationCategory
[Optimization(
Id = "8A4B4C4D-000E-42DB-8BD7-293067F8FAE7",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Amd | OptimizationTags.Latency)]
+ Tags = OptimizationTags.Amd | OptimizationTags.Latency
+ )]
public class AmdDisableAspm : GpuRegistryOptimization
{
protected override GpuVendor Vendor => GpuVendor.AMD;
@@ -191,7 +206,7 @@ public class Gpu : IOptimizationCategory
return
[
new RegistryItem(path, "EnableAspmL0s", 0),
- new RegistryItem(path, "EnableAspmL1", 0)
+ new RegistryItem(path, "EnableAspmL1", 0),
];
}
}
@@ -199,68 +214,60 @@ public class Gpu : IOptimizationCategory
[Optimization(
Id = "FA58802F-B98C-4E98-AA67-067C5A394296",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Nvidia | OptimizationTags.Power)]
+ Tags = OptimizationTags.Nvidia | OptimizationTags.Power
+ )]
public class NvidiaDisableDynamicPstate : GpuRegistryOptimization
{
protected override GpuVendor Vendor => GpuVendor.NVIDIA;
protected override IReadOnlyList<RegistryItem> CreateItems(string path)
{
- return
- [
- new RegistryItem(path, "DisableDynamicPstate", 1)
- ];
+ return [new RegistryItem(path, "DisableDynamicPstate", 1)];
}
}
[Optimization(
Id = "9E7702BE-9E03-4C96-A316-C4E435CB993E",
Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.Nvidia | OptimizationTags.Performance)]
+ Tags = OptimizationTags.Nvidia | OptimizationTags.Performance
+ )]
public class NvidiaDisableAsyncPstates : GpuRegistryOptimization
{
protected override GpuVendor Vendor => GpuVendor.NVIDIA;
protected override IReadOnlyList<RegistryItem> CreateItems(string path)
{
- return
- [
- new RegistryItem(path, "DisableASyncPstates", 1)
- ];
+ return [new RegistryItem(path, "DisableASyncPstates", 1)];
}
}
[Optimization(
Id = "DF8739FF-E322-4958-B369-DF584BB9B0C1",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Intel | OptimizationTags.Latency)]
+ Tags = OptimizationTags.Intel | OptimizationTags.Latency
+ )]
public class IntelDisableAsyncFlips : GpuRegistryOptimization
{
protected override GpuVendor Vendor => GpuVendor.Intel;
protected override IReadOnlyList<RegistryItem> CreateItems(string path)
{
- return
- [
- new RegistryItem(path, "Display1_DisableAsyncFlips", 1)
- ];
+ return [new RegistryItem(path, "Display1_DisableAsyncFlips", 1)];
}
}
[Optimization(
Id = "EBFB0DED-5D1A-4CD1-B5C0-4F7018DD6054",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Intel | OptimizationTags.Display)]
+ Tags = OptimizationTags.Intel | OptimizationTags.Display
+ )]
public class IntelDisableAdaptiveVsync : GpuRegistryOptimization
{
protected override GpuVendor Vendor => GpuVendor.Intel;
protected override IReadOnlyList<RegistryItem> CreateItems(string path)
{
- return
- [
- new RegistryItem(path, "AdaptiveVsyncEnable", 0)
- ];
+ return [new RegistryItem(path, "AdaptiveVsyncEnable", 0)];
}
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Optimizations/Categories/Performance.cs b/optimizerDuck/Domain/Optimizations/Categories/Performance.cs
index 0aac045..ba5071c 100644
--- a/optimizerDuck/Domain/Optimizations/Categories/Performance.cs
+++ b/optimizerDuck/Domain/Optimizations/Categories/Performance.cs
@@ -19,56 +19,90 @@ public class Performance : IOptimizationCategory
public OptimizationCategoryOrder Order { get; init; } = OptimizationCategoryOrder.Performance;
public ObservableCollection<IOptimization> Optimizations { get; init; } = [];
- [Optimization(Id = "648EC19A-FDA5-4607-8A7C-148B8B05FB4C", Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Ram)]
+ [Optimization(
+ Id = "648EC19A-FDA5-4607-8A7C-148B8B05FB4C",
+ Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Ram
+ )]
public class DisableBackgroundApps : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications",
- "GlobalUserDisabled", 1),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search", "BackgroundAppGlobalToggle",
- 0)
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications",
+ "GlobalUserDisabled",
+ 1
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search",
+ "BackgroundAppGlobalToggle",
+ 0
+ )
);
context.Logger.LogInformation("Disabled background apps");
return Task.FromResult(ApplyResult.True());
}
}
- [Optimization(Id = "CD436A05-51F1-46E9-B4DE-5262EE7F812A", Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.System | OptimizationTags.Performance)]
+ [Optimization(
+ Id = "CD436A05-51F1-46E9-B4DE-5262EE7F812A",
+ Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.System | OptimizationTags.Performance
+ )]
public class SvcHostSplit : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
if (context.Snapshot.Ram.TotalKB <= 0)
{
- context.Logger.LogInformation("Invalid RAM value: {RamTotalKB}. Skipping...",
- context.Snapshot.Ram.TotalKB);
- return Task.FromResult(ApplyResult.False(string.Format(Loc.Instance[$"{ErrorPrefix}.InvalidRAM"],
- context.Snapshot.Ram.TotalKB)));
+ context.Logger.LogInformation(
+ "Invalid RAM value: {RamTotalKB}. Skipping...",
+ context.Snapshot.Ram.TotalKB
+ );
+ return Task.FromResult(
+ ApplyResult.False(
+ string.Format(
+ Loc.Instance[$"{ErrorPrefix}.InvalidRAM"],
+ context.Snapshot.Ram.TotalKB
+ )
+ )
+ );
}
RegistryService.Write(
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control", "SvcHostSplitThresholdInKB",
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control",
+ "SvcHostSplitThresholdInKB",
context.Snapshot.Ram.TotalKB,
- RegistryValueKind.DWord)
+ RegistryValueKind.DWord
+ )
+ );
+ context.Logger.LogInformation(
+ "Enabled service host splitting with threshold: {ThresholdKB} KB",
+ context.Snapshot.Ram.TotalKB
);
- context.Logger.LogInformation("Enabled service host splitting with threshold: {ThresholdKB} KB",
- context.Snapshot.Ram.TotalKB);
return Task.FromResult(ApplyResult.True());
}
}
- [Optimization(Id = "C51E4187-BE49-4376-A97D-46C967A033B5", Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Power)]
+ [Optimization(
+ Id = "C51E4187-BE49-4376-A97D-46C967A033B5",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Power
+ )]
public class ProcessPriority : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
/*
ref: https://forums.blurbusters.com/viewtopic.php?t=8535
@@ -92,34 +126,53 @@ public class Performance : IOptimizationCategory
const int win32Priority = 38; // Short, Variable, High foreground boost
RegistryService.Write(
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\PriorityControl", "Win32PrioritySeparation",
- win32Priority)
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\PriorityControl",
+ "Win32PrioritySeparation",
+ win32Priority
+ )
+ );
+ context.Logger.LogInformation(
+ "Enabled foreground boost with priority: {Priority}",
+ win32Priority
);
- context.Logger.LogInformation("Enabled foreground boost with priority: {Priority}", win32Priority);
return Task.FromResult(ApplyResult.True());
}
}
- [Optimization(Id = "D3E93D47-FC7E-44E2-8B58-D8626A75DB93", Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Power)]
+ [Optimization(
+ Id = "D3E93D47-FC7E-44E2-8B58-D8626A75DB93",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Power
+ )]
public class GameTaskScheduling : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
new RegistryItem(
@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games",
- "Priority", 2),
+ "Priority",
+ 2
+ ),
new RegistryItem(
@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games",
- "Scheduling Category", "High"),
+ "Scheduling Category",
+ "High"
+ ),
new RegistryItem(
@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games",
- "SFIO Priority", "High"),
+ "SFIO Priority",
+ "High"
+ ),
new RegistryItem(
@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games",
- "GPU Priority", 8)
+ "GPU Priority",
+ 8
+ )
);
context.Logger.LogInformation("Enabled game task scheduling with high priority");
@@ -130,11 +183,14 @@ 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
+ )]
public class MultimediaResponsiveness : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
const string systemProfileKey =
@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile";
@@ -144,9 +200,9 @@ public class Performance : IOptimizationCategory
systemProfileKey,
"NetworkThrottlingIndex",
unchecked((int)0xFFFFFFFF),
- RegistryValueKind.DWord),
- new RegistryItem(systemProfileKey, "SystemResponsiveness",
- 10) // minimum possible value (Values below 10 and above 100 are clamped to 20.)
+ RegistryValueKind.DWord
+ ),
+ new RegistryItem(systemProfileKey, "SystemResponsiveness", 10) // minimum possible value (Values below 10 and above 100 are clamped to 20.)
);
context.Logger.LogInformation("Optimized multimedia responsiveness for low latency");
@@ -157,11 +213,14 @@ public class Performance : IOptimizationCategory
[Optimization(
Id = "613FE85C-770D-441C-B97A-147B89B99028",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Latency)]
+ Tags = OptimizationTags.Latency
+ )]
public class KeyboardLatencyOptimization : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Keyboard", "KeyboardDelay", "0"),
@@ -176,16 +235,31 @@ public class Performance : IOptimizationCategory
[Optimization(
Id = "B7BB32F8-C756-47A4-83F2-F6E7EC7D45B8",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Latency | OptimizationTags.System)]
+ Tags = OptimizationTags.Latency | OptimizationTags.System
+ )]
public class DisableAccessibilityKeyboardHotkeys : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys", "Flags", "510"),
- new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response", "Flags", "122"),
- new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Accessibility\ToggleKeys", "Flags", "58")
+ new RegistryItem(
+ @"HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys",
+ "Flags",
+ "510"
+ ),
+ new RegistryItem(
+ @"HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response",
+ "Flags",
+ "122"
+ ),
+ new RegistryItem(
+ @"HKEY_CURRENT_USER\Control Panel\Accessibility\ToggleKeys",
+ "Flags",
+ "58"
+ )
);
context.Logger.LogInformation("Disabled accessibility keyboard hotkeys");
diff --git a/optimizerDuck/Domain/Optimizations/Categories/PowerManagement.cs b/optimizerDuck/Domain/Optimizations/Categories/PowerManagement.cs
index 59dc53e..8fd36fb 100644
--- a/optimizerDuck/Domain/Optimizations/Categories/PowerManagement.cs
+++ b/optimizerDuck/Domain/Optimizations/Categories/PowerManagement.cs
@@ -20,12 +20,17 @@ public class PowerManagement : IOptimizationCategory
public OptimizationCategoryOrder Order { get; init; } = OptimizationCategoryOrder.Power;
public ObservableCollection<IOptimization> Optimizations { get; init; } = [];
- [Optimization(Id = "C7A97DDE-6631-48BF-A0A8-590D447A81AB", Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.System | OptimizationTags.Power | OptimizationTags.Performance)]
+ [Optimization(
+ Id = "C7A97DDE-6631-48BF-A0A8-590D447A81AB",
+ Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.System | OptimizationTags.Power | OptimizationTags.Performance
+ )]
public class DisableHibernate : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
ShellService.CMD("powercfg /h off", "powercfg /h on");
context.Logger.LogInformation("Disabled hibernate");
@@ -33,12 +38,17 @@ public class PowerManagement : IOptimizationCategory
}
}
- [Optimization(Id = "2B49A8A6-E8CA-4D77-A883-DC27BDBE8B05", Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.System | OptimizationTags.Power | OptimizationTags.Performance)]
+ [Optimization(
+ Id = "2B49A8A6-E8CA-4D77-A883-DC27BDBE8B05",
+ Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.System | OptimizationTags.Power | OptimizationTags.Performance
+ )]
public class DisableFastStartup : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
new RegistryItem(
@@ -52,21 +62,28 @@ public class PowerManagement : IOptimizationCategory
}
}
- [Optimization(Id = "805F993F-67F9-4F5A-8606-998EA9087CF0", Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Latency | OptimizationTags.Performance)]
+ [Optimization(
+ Id = "805F993F-67F9-4F5A-8606-998EA9087CF0",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Latency | OptimizationTags.Performance
+ )]
public class DisableUSBPowerSaving : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
context.Logger.LogInformation("Saving current USB power state");
- var usbStates = ShellService.PowerShell("""
- $states = Get-CimInstance -Namespace root\wmi -ClassName MSPower_DeviceEnable -ErrorAction SilentlyContinue |
- Where-Object { $_.InstanceName -match 'USB\\ROOT' } |
- Select-Object InstanceName, Enable
+ var usbStates = ShellService.PowerShell(
+ """
+ $states = Get-CimInstance -Namespace root\wmi -ClassName MSPower_DeviceEnable -ErrorAction SilentlyContinue |
+ Where-Object { $_.InstanceName -match 'USB\\ROOT' } |
+ Select-Object InstanceName, Enable
- $states | ConvertTo-Json -Compress
- """);
+ $states | ConvertTo-Json -Compress
+ """
+ );
if (string.IsNullOrWhiteSpace(usbStates.Stdout))
{
@@ -75,42 +92,50 @@ public class PowerManagement : IOptimizationCategory
}
context.Logger.LogInformation("Disabling USB power saving");
- ShellService.PowerShell("""
- $devices = Get-CimInstance -Namespace root\wmi -ClassName MSPower_DeviceEnable -ErrorAction SilentlyContinue |
- Where-Object { $_.InstanceName -match 'USB\\ROOT' }
-
- foreach ($d in $devices) {
- if ($d.Enable -ne $false) {
- Set-CimInstance -CimInstance $d -Property @{ Enable = $false } | Out-Null
- }
- }
- """,
+ ShellService.PowerShell(
+ """
+ $devices = Get-CimInstance -Namespace root\wmi -ClassName MSPower_DeviceEnable -ErrorAction SilentlyContinue |
+ Where-Object { $_.InstanceName -match 'USB\\ROOT' }
+
+ foreach ($d in $devices) {
+ if ($d.Enable -ne $false) {
+ Set-CimInstance -CimInstance $d -Property @{ Enable = $false } | Out-Null
+ }
+ }
+ """,
$$"""
- $states = @('{{usbStates.Stdout}}' | ConvertFrom-Json)
-
- foreach ($s in $states) {
- $obj = Get-CimInstance -Namespace root\wmi -ClassName MSPower_DeviceEnable -ErrorAction SilentlyContinue |
- Where-Object { $_.InstanceName -eq $s.InstanceName }
-
- if ($obj -and $obj.Enable -ne [bool]$s.Enable) {
- Write-Host "Reverting $($s.InstanceName) to $([bool]$s.Enable)"
- Set-CimInstance -CimInstance $obj -Property @{ Enable = [bool]$s.Enable } | Out-Null
- }
- }
- """
+ $states = @('{{usbStates.Stdout}}' | ConvertFrom-Json)
+
+ foreach ($s in $states) {
+ $obj = Get-CimInstance -Namespace root\wmi -ClassName MSPower_DeviceEnable -ErrorAction SilentlyContinue |
+ Where-Object { $_.InstanceName -eq $s.InstanceName }
+
+ if ($obj -and $obj.Enable -ne [bool]$s.Enable) {
+ Write-Host "Reverting $($s.InstanceName) to $([bool]$s.Enable)"
+ Set-CimInstance -CimInstance $obj -Property @{ Enable = [bool]$s.Enable } | Out-Null
+ }
+ }
+ """
);
return Task.FromResult(ApplyResult.True());
}
}
- [Optimization(Id = "EE71E993-EE41-4449-8856-84B09B2B0C46", Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Latency | OptimizationTags.Performance | OptimizationTags.NetworkRequired |
- OptimizationTags.Power)]
+ [Optimization(
+ Id = "EE71E993-EE41-4449-8856-84B09B2B0C46",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Latency
+ | OptimizationTags.Performance
+ | OptimizationTags.NetworkRequired
+ | OptimizationTags.Power
+ )]
public class InstallOptimizerDuckPowerPlan : BaseOptimization
{
- public override async Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override async Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
var activeQuery = ShellService.CMD("powercfg /getactivescheme");
var match = Regex.Match(
@@ -128,47 +153,68 @@ public class PowerManagement : IOptimizationCategory
var previousPlanGuid = match.Groups[1].Value;
context.Logger.LogInformation("Current active power plan: {Guid}", previousPlanGuid);
- progress?.Report(new ProcessingProgress
- {
- Message = Loc.Instance[$"{ProgressPrefix}.Downloading"],
- IsIndeterminate = true
- });
+ progress?.Report(
+ new ProcessingProgress
+ {
+ Message = Loc.Instance[$"{ProgressPrefix}.Downloading"],
+ IsIndeterminate = true,
+ }
+ );
var (success, powerPlanPath) = await context.StreamService.TryDownloadAsync(
Shared.PowerPlanUrl,
- "optimizerDuck.pow");
+ "optimizerDuck.pow"
+ );
if (!success || string.IsNullOrWhiteSpace(powerPlanPath))
{
context.Logger.LogError("Failed to download optimizerDuck power plan");
return ApplyResult.False(Loc.Instance[$"{ErrorPrefix}.DownloadFailed"]);
}
- context.Logger.LogInformation("Downloaded optimizerDuck power plan to {Path}", powerPlanPath);
+ context.Logger.LogInformation(
+ "Downloaded optimizerDuck power plan to {Path}",
+ powerPlanPath
+ );
- progress?.Report(new ProcessingProgress
- {
- Message = Loc.Instance[$"{ProgressPrefix}.Importing"],
- IsIndeterminate = true
- });
-
- ShellService.CMD("powercfg /setactive 381b4222-f694-41f0-9685-ff5bb260df2e",
- policy: ShellPolicy.SuccessExitCodes(0, 1)); // set Balanced
- var result = ShellService.CMD($"powercfg /delete {Shared.PowerPlanGUID}",
- $"powercfg /setactive {previousPlanGuid}", ShellPolicy.SuccessExitCodes(0, 1));
+ progress?.Report(
+ new ProcessingProgress
+ {
+ Message = Loc.Instance[$"{ProgressPrefix}.Importing"],
+ IsIndeterminate = true,
+ }
+ );
+
+ ShellService.CMD(
+ "powercfg /setactive 381b4222-f694-41f0-9685-ff5bb260df2e",
+ policy: ShellPolicy.SuccessExitCodes(0, 1)
+ ); // set Balanced
+ var result = ShellService.CMD(
+ $"powercfg /delete {Shared.PowerPlanGUID}",
+ $"powercfg /setactive {previousPlanGuid}",
+ ShellPolicy.SuccessExitCodes(0, 1)
+ );
if (result.ExitCode == 0)
context.Logger.LogInformation("Deleted old power plan");
- var importResult = ShellService.CMD($"powercfg /import \"{powerPlanPath}\" {Shared.PowerPlanGUID}");
+ var importResult = ShellService.CMD(
+ $"powercfg /import \"{powerPlanPath}\" {Shared.PowerPlanGUID}"
+ );
if (importResult.ExitCode != 0)
{
- context.Logger.LogError("Failed to import optimizerDuck power plan: {Error}", importResult.Stderr);
+ context.Logger.LogError(
+ "Failed to import optimizerDuck power plan: {Error}",
+ importResult.Stderr
+ );
return ApplyResult.False(Loc.Instance[$"{ErrorPrefix}.ImportFailed"]);
}
var setActiveResult = ShellService.CMD($"powercfg /setactive {Shared.PowerPlanGUID}");
if (setActiveResult.ExitCode != 0)
{
- context.Logger.LogError("Failed to activate optimizerDuck power plan: {Error}", setActiveResult.Stderr);
+ context.Logger.LogError(
+ "Failed to activate optimizerDuck power plan: {Error}",
+ setActiveResult.Stderr
+ );
return ApplyResult.False(Loc.Instance[$"{ErrorPrefix}.ActivateFailed"]);
}
@@ -177,36 +223,58 @@ public class PowerManagement : IOptimizationCategory
}
}
- [Optimization(Id = "D2392F86-2B35-4BA2-939B-6FF38EE18EE6", Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Power | OptimizationTags.Performance | OptimizationTags.System)]
+ [Optimization(
+ Id = "D2392F86-2B35-4BA2-939B-6FF38EE18EE6",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Power | OptimizationTags.Performance | OptimizationTags.System
+ )]
public class DisablePowerSaving : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\USB\AutomaticSurpriseRemoval",
- "AttemptRecoveryFromUsbPowerDrain", 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling", "PowerThrottlingOff",
- 1)
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\USB\AutomaticSurpriseRemoval",
+ "AttemptRecoveryFromUsbPowerDrain",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling",
+ "PowerThrottlingOff",
+ 1
+ )
);
context.Logger.LogInformation("Disabled power saving features");
return Task.FromResult(ApplyResult.True());
}
}
- [Optimization(Id = "C24B2B0E-A66D-43D0-8B4E-30550D107A68", Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Performance | OptimizationTags.Latency | OptimizationTags.Audio)]
+ [Optimization(
+ Id = "C24B2B0E-A66D-43D0-8B4E-30550D107A68",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Performance | OptimizationTags.Latency | OptimizationTags.Audio
+ )]
public class OptimizeMultimediaProfile : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile",
- "NoLazyMode", 1),
- new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile",
- "AlwaysOn", 1)
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile",
+ "NoLazyMode",
+ 1
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile",
+ "AlwaysOn",
+ 1
+ )
);
context.Logger.LogInformation("Optimized multimedia profile settings");
return Task.FromResult(ApplyResult.True());
diff --git a/optimizerDuck/Domain/Optimizations/Categories/SecurityAndPrivacy.cs b/optimizerDuck/Domain/Optimizations/Categories/SecurityAndPrivacy.cs
index 8fdd1bc..2788e77 100644
--- a/optimizerDuck/Domain/Optimizations/Categories/SecurityAndPrivacy.cs
+++ b/optimizerDuck/Domain/Optimizations/Categories/SecurityAndPrivacy.cs
@@ -15,79 +15,147 @@ namespace optimizerDuck.Domain.Optimizations.Categories;
public class SecurityAndPrivacy : IOptimizationCategory
{
public string Name => Loc.Instance[$"Optimizer.{nameof(SecurityAndPrivacy)}"];
- public OptimizationCategoryOrder Order { get; init; } = OptimizationCategoryOrder.SecurityAndPrivacy;
+ public OptimizationCategoryOrder Order { get; init; } =
+ OptimizationCategoryOrder.SecurityAndPrivacy;
public ObservableCollection<IOptimization> Optimizations { get; init; } = [];
- [Optimization(Id = "09F7CE38-93B2-4E1A-AB09-130268165B42", Risk = OptimizationRisk.Risky,
- Tags = OptimizationTags.System | OptimizationTags.Security)]
+ [Optimization(
+ Id = "09F7CE38-93B2-4E1A-AB09-130268165B42",
+ Risk = OptimizationRisk.Risky,
+ Tags = OptimizationTags.System | OptimizationTags.Security
+ )]
public class DisableUAC : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
- RegistryService.Write(new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System",
- "EnableLUA", 0));
+ RegistryService.Write(
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System",
+ "EnableLUA",
+ 0
+ )
+ );
context.Logger.LogInformation("Disabled UAC prompts");
return Task.FromResult(ApplyResult.True());
}
}
- [Optimization(Id = "74DC8DAC-1F90-4BBD-ACF7-7E626749D71C",
+ [Optimization(
+ Id = "74DC8DAC-1F90-4BBD-ACF7-7E626749D71C",
Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.Security | OptimizationTags.Privacy)]
+ Tags = OptimizationTags.Security | OptimizationTags.Privacy
+ )]
public class DisableTelemetry : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
- progress?.Report(new ProcessingProgress
- {
- Message = Loc.Instance[$"{ProgressPrefix}.EditRegistry"],
- IsIndeterminate = false,
- Value = 0,
- Total = 3
- });
+ progress?.Report(
+ new ProcessingProgress
+ {
+ Message = Loc.Instance[$"{ProgressPrefix}.EditRegistry"],
+ IsIndeterminate = false,
+ Value = 0,
+ Total = 3,
+ }
+ );
// @formatter:off
RegistryService.Write(
- new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection", "AllowTelemetry", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowTelemetry", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection", "DoNotShowFeedbackNotifications", 1),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowCommercialDataPipeline", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowDeviceNameInTelemetry", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection", "MicrosoftEdgeDataOptIn", 0),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection",
+ "AllowTelemetry",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection",
+ "AllowTelemetry",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection",
+ "DoNotShowFeedbackNotifications",
+ 1
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection",
+ "AllowCommercialDataPipeline",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection",
+ "AllowDeviceNameInTelemetry",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection",
+ "MicrosoftEdgeDataOptIn",
+ 0
+ ),
new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Siuf\Rules", "NumberOfSIUFInPeriod", 0),
- new RegistryItem(@"HKCU\Software\Policies\Microsoft\Windows\EdgeUI", "DisableMFUTracking", 1),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableInventory", 1),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\AppCompat", "AITEnable", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Policies\Microsoft\Assistance\Client\1.0", "NoExplicitFeedback", 1),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Assistance\Client\1.0", "NoActiveHelp", 1)
+ new RegistryItem(
+ @"HKCU\Software\Policies\Microsoft\Windows\EdgeUI",
+ "DisableMFUTracking",
+ 1
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\AppCompat",
+ "DisableInventory",
+ 1
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\AppCompat",
+ "AITEnable",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Policies\Microsoft\Assistance\Client\1.0",
+ "NoExplicitFeedback",
+ 1
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Assistance\Client\1.0",
+ "NoActiveHelp",
+ 1
+ )
);
RegistryService.DeleteValue([
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Siuf\Rules", "PeriodInNanoSeconds")
+ new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Siuf\Rules", "PeriodInNanoSeconds"),
]);
context.Logger.LogInformation("Reduced core telemetry and feedback");
- progress?.Report(new ProcessingProgress
- {
- Message = Loc.Instance[$"{ProgressPrefix}.DisableServices"],
- IsIndeterminate = false,
- Value = 1,
- Total = 3
- });
+ progress?.Report(
+ new ProcessingProgress
+ {
+ Message = Loc.Instance[$"{ProgressPrefix}.DisableServices"],
+ IsIndeterminate = false,
+ Value = 1,
+ Total = 3,
+ }
+ );
ServiceProcessService.ChangeServiceStartupType(
new ServiceItem("DiagTrack", ServiceStartupType.Disabled),
new ServiceItem("dmwappushservice", ServiceStartupType.Disabled),
new ServiceItem("DcpSvc", ServiceStartupType.Disabled),
- new ServiceItem("diagnosticshub.standardcollector.service", ServiceStartupType.Disabled),
+ new ServiceItem(
+ "diagnosticshub.standardcollector.service",
+ ServiceStartupType.Disabled
+ ),
new ServiceItem("DusmSvc", ServiceStartupType.Disabled)
);
- progress?.Report(new ProcessingProgress
- {
- Message = Loc.Instance[$"{ProgressPrefix}.DisableTasks"],
- IsIndeterminate = false,
- Value = 2,
- Total = 3
- });
+ progress?.Report(
+ new ProcessingProgress
+ {
+ Message = Loc.Instance[$"{ProgressPrefix}.DisableTasks"],
+ IsIndeterminate = false,
+ Value = 2,
+ Total = 3,
+ }
+ );
var tasksToDelete = new HashSet<string>([
@"\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser",
@"\Microsoft\Windows\Application Experience\ProgramDataUpdater",
@@ -98,14 +166,15 @@ public class SecurityAndPrivacy : IOptimizationCategory
@"\Microsoft\Windows\Customer Experience Improvement Program\Consolidator",
@"\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip",
@"\Microsoft\Windows\Feedback\Siuf\DmClient",
- @"\Microsoft\Windows\Feedback\Siuf\DmClientOnScenarioDownload"
+ @"\Microsoft\Windows\Feedback\Siuf\DmClientOnScenarioDownload",
]);
// @formatter:on
foreach (var task in tasksToDelete)
try
{
- if (!ScheduledTaskService.IsTaskEnabled(task)) continue;
+ if (!ScheduledTaskService.IsTaskEnabled(task))
+ continue;
ScheduledTaskService.DisableTask(task);
context.Logger.LogInformation("Disabled task {Task}", task);
}
@@ -118,16 +187,29 @@ public class SecurityAndPrivacy : IOptimizationCategory
}
}
- [Optimization(Id = "097B1C61-F372-4B9E-A1C9-D5E6F7A8B9C0", Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.System | OptimizationTags.Privacy)]
+ [Optimization(
+ Id = "097B1C61-F372-4B9E-A1C9-D5E6F7A8B9C0",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Privacy
+ )]
public class DisableErrorReporting : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting", "Disabled", 1),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\HandwritingErrorReports", "PreventHandwritingErrorReports", 1)
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting",
+ "Disabled",
+ 1
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\HandwritingErrorReports",
+ "PreventHandwritingErrorReports",
+ 1
+ )
);
ServiceProcessService.ChangeServiceStartupType(
@@ -140,13 +222,14 @@ public class SecurityAndPrivacy : IOptimizationCategory
@"\Microsoft\Windows\Windows Error Reporting\QueueReporting",
@"\Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector",
@"\Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticResolver",
- @"\Microsoft\Windows\Diagnosis\Scheduled"
+ @"\Microsoft\Windows\Diagnosis\Scheduled",
};
foreach (var task in tasksToDelete)
try
{
- if (!ScheduledTaskService.IsTaskEnabled(task)) continue;
+ if (!ScheduledTaskService.IsTaskEnabled(task))
+ continue;
ScheduledTaskService.DisableTask(task);
}
catch (Exception ex)
@@ -154,54 +237,148 @@ public class SecurityAndPrivacy : IOptimizationCategory
context.Logger.LogWarning(ex, "Failed to disable task {Task}", task);
}
- context.Logger.LogInformation("Disabled Windows Error Reporting and Compatibility Assistant");
+ context.Logger.LogInformation(
+ "Disabled Windows Error Reporting and Compatibility Assistant"
+ );
return Task.FromResult(ApplyResult.True());
}
}
- [Optimization(Id = "B1C2D3E4-F5A6-4B7C-8D9E-0F1A2B3C4D5E", Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Privacy)]
+ [Optimization(
+ Id = "B1C2D3E4-F5A6-4B7C-8D9E-0F1A2B3C4D5E",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Privacy
+ )]
public class DisableAdvertisingAndSuggestions : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo", "DisabledByGroupPolicy", 1),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Privacy", "TailoredExperiencesWithDiagnosticDataEnabled", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent", "DisableTailoredExperiencesWithDiagnosticData", 1),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent", "DisableWindowsConsumerFeatures", 1),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent", "DisableSoftLanding", 1),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent", "DisableThirdPartySuggestions", 1),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Feeds", "ShellFeedsTaskbarViewMode", 2),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "HideSCAMeetNow", 1),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement", "ScoobeSystemSettingEnabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\InputPersonalization", "RestrictImplicitInkCollection", 1),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\InputPersonalization", "RestrictImplicitTextCollection", 1),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore", "HarvestContacts", 0),
- new RegistryItem(@"HKCU\Control Panel\International\User Profile", "HttpAcceptLanguageOptOut", 1),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy", "01", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy", "02", 0)
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo",
+ "Enabled",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo",
+ "DisabledByGroupPolicy",
+ 1
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Privacy",
+ "TailoredExperiencesWithDiagnosticDataEnabled",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent",
+ "DisableTailoredExperiencesWithDiagnosticData",
+ 1
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent",
+ "DisableWindowsConsumerFeatures",
+ 1
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent",
+ "DisableSoftLanding",
+ 1
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent",
+ "DisableThirdPartySuggestions",
+ 1
+ ),
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Feeds",
+ "ShellFeedsTaskbarViewMode",
+ 2
+ ),
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer",
+ "HideSCAMeetNow",
+ 1
+ ),
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement",
+ "ScoobeSystemSettingEnabled",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\InputPersonalization",
+ "RestrictImplicitInkCollection",
+ 1
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\InputPersonalization",
+ "RestrictImplicitTextCollection",
+ 1
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore",
+ "HarvestContacts",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\Control Panel\International\User Profile",
+ "HttpAcceptLanguageOptOut",
+ 1
+ ),
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy",
+ "01",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy",
+ "02",
+ 0
+ )
);
- context.Logger.LogInformation("Disabled advertising ID, consumer features and system suggestions");
+ context.Logger.LogInformation(
+ "Disabled advertising ID, consumer features and system suggestions"
+ );
return Task.FromResult(ApplyResult.True());
}
}
- [Optimization(Id = "A1B2C3D4-E5F6-4A7B-8C9D-0E1F2A3B4C5D", Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Privacy)]
+ [Optimization(
+ Id = "A1B2C3D4-E5F6-4A7B-8C9D-0E1F2A3B4C5D",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Privacy
+ )]
public class DisableActivityHistory : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\System", "PublishUserActivities", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\System", "EnableActivityFeed", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\System", "PublishUserActivitiesOnUserConsent", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\System", "UploadUserActivities", 0)
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\System",
+ "PublishUserActivities",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\System",
+ "EnableActivityFeed",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\System",
+ "PublishUserActivitiesOnUserConsent",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\System",
+ "UploadUserActivities",
+ 0
+ )
);
context.Logger.LogInformation("Disabled activity history collection and syncing");
@@ -209,24 +386,65 @@ public class SecurityAndPrivacy : IOptimizationCategory
}
}
- [Optimization(Id = "C1D2E3F4-A5B6-4C7D-8E9F-0A1B2C3D4E5F", Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Privacy)]
+ [Optimization(
+ Id = "C1D2E3F4-A5B6-4C7D-8E9F-0A1B2C3D4E5F",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Privacy
+ )]
public class DisableLocationAndSensors : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocation", 1),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableSensors", 1),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors",
+ "DisableLocation",
+ 1
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors",
+ "DisableSensors",
+ 1
+ ),
new RegistryItem(@"HKLM\SYSTEM\Maps", "AutoUpdateEnabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Permissions\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}", "SensorPermissionState", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location", "Value", "Deny"),
- new RegistryItem(@"HKLM\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location", "Value", "Deny"),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Geolocation", "Status", 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration", "Status", 0),
- new RegistryItem(@"HKLM\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting", "Value", 0),
- new RegistryItem(@"HKLM\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots", "Value", 0)
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Permissions\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}",
+ "SensorPermissionState",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location",
+ "Value",
+ "Deny"
+ ),
+ new RegistryItem(
+ @"HKLM\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location",
+ "Value",
+ "Deny"
+ ),
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Geolocation",
+ "Status",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration",
+ "Status",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting",
+ "Value",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots",
+ "Value",
+ 0
+ )
);
try
@@ -239,92 +457,204 @@ public class SecurityAndPrivacy : IOptimizationCategory
context.Logger.LogWarning(ex, "Failed to disable maps update task");
}
- context.Logger.LogInformation("Disabled location tracking, sensors and offline maps updates");
+ context.Logger.LogInformation(
+ "Disabled location tracking, sensors and offline maps updates"
+ );
return Task.FromResult(ApplyResult.True());
}
}
- [Optimization(Id = "4107430C-0074-4380-90E7-3662572E4720", Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.Privacy)]
+ [Optimization(
+ Id = "4107430C-0074-4380-90E7-3662572E4720",
+ Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.Privacy
+ )]
public class DisableAutoLogger : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\AppModel", "Start", 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\Cellcore", "Start", 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\CloudExperienceHostOobe",
- "Start", 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\DataMarket", "Start", 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\DefenderApiLogger", "Start", 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\DefenderAuditLogger", "Start",
- 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\DiagLog", "Start", 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\Diagtrack-Listener", "Start",
- 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\LwtNetLog", "Start", 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\SQMLogger", "Start", 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\WdiContextLog", "Start", 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\WiFiSession", "Start", 0)
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\AppModel",
+ "Start",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\Cellcore",
+ "Start",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\CloudExperienceHostOobe",
+ "Start",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\DataMarket",
+ "Start",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\DefenderApiLogger",
+ "Start",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\DefenderAuditLogger",
+ "Start",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\DiagLog",
+ "Start",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\Diagtrack-Listener",
+ "Start",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\LwtNetLog",
+ "Start",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\SQMLogger",
+ "Start",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\WdiContextLog",
+ "Start",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\WiFiSession",
+ "Start",
+ 0
+ )
);
context.Logger.LogInformation("Disabled WMI AutoLogger sessions");
return Task.FromResult(ApplyResult.True());
}
}
- [Optimization(Id = "6856782A-B530-4623-BD89-942D73FB82FD", Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.Privacy | OptimizationTags.System)]
+ [Optimization(
+ Id = "6856782A-B530-4623-BD89-942D73FB82FD",
+ Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.Privacy | OptimizationTags.System
+ )]
public class DisableCortana : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowCortana", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowCloudSearch", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowCortanaAboveLock",
- 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowSearchToUseLocation",
- 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "ConnectedSearchUseWeb",
- 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "DisableWebSearch", 1),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Search",
- "CortanaConsent", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Search",
- "CortanaConsent2", 0)
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search",
+ "AllowCortana",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search",
+ "AllowCloudSearch",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search",
+ "AllowCortanaAboveLock",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search",
+ "AllowSearchToUseLocation",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search",
+ "ConnectedSearchUseWeb",
+ 0
+ ),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search",
+ "DisableWebSearch",
+ 1
+ ),
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Search",
+ "CortanaConsent",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Search",
+ "CortanaConsent2",
+ 0
+ )
);
context.Logger.LogInformation("Disabled Cortana and web search");
return Task.FromResult(ApplyResult.True());
}
}
- [Optimization(Id = "64C6BEC3-B58C-4E57-830A-1DE1F4650542", Risk = OptimizationRisk.Moderate,
- Tags = OptimizationTags.Privacy | OptimizationTags.System)]
+ [Optimization(
+ Id = "64C6BEC3-B58C-4E57-830A-1DE1F4650542",
+ Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.Privacy | OptimizationTags.System
+ )]
public class DisableCopilot : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot",
- "TurnOffWindowsCopilot", 1),
- new RegistryItem(@"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\WindowsCopilot",
- "TurnOffWindowsCopilot", 1),
- new RegistryItem(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- "ShowCopilotButton", 0),
- new RegistryItem(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Copilot", "IsCopilotAvailable",
- 0),
- new RegistryItem(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Copilot",
- "CopilotDisabledReason", "IsEnabledForGeographicRegionFailed"),
- new RegistryItem(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsCopilot",
- "AllowCopilotRuntime", 0),
+ new RegistryItem(
+ @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot",
+ "TurnOffWindowsCopilot",
+ 1
+ ),
+ new RegistryItem(
+ @"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\WindowsCopilot",
+ "TurnOffWindowsCopilot",
+ 1
+ ),
+ new RegistryItem(
+ @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ "ShowCopilotButton",
+ 0
+ ),
+ new RegistryItem(
+ @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Copilot",
+ "IsCopilotAvailable",
+ 0
+ ),
+ new RegistryItem(
+ @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Copilot",
+ "CopilotDisabledReason",
+ "IsEnabledForGeographicRegionFailed"
+ ),
+ new RegistryItem(
+ @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsCopilot",
+ "AllowCopilotRuntime",
+ 0
+ ),
new RegistryItem(
@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked",
- "{CB3B0003-8088-4EDE-8769-8B354AB2FF8C}", ""),
- new RegistryItem(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Copilot\BingChat",
- "IsUserEligible", 0)
+ "{CB3B0003-8088-4EDE-8769-8B354AB2FF8C}",
+ ""
+ ),
+ new RegistryItem(
+ @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Copilot\BingChat",
+ "IsUserEligible",
+ 0
+ )
);
context.Logger.LogInformation("Disabled Windows Copilot");
@@ -332,29 +662,52 @@ public class SecurityAndPrivacy : IOptimizationCategory
}
}
- [Optimization(Id = "00C997FE-1CB7-41BD-B473-65A81333AEE9", Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.System | OptimizationTags.Latency | OptimizationTags.Privacy)]
+ [Optimization(
+ Id = "00C997FE-1CB7-41BD-B473-65A81333AEE9",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Latency | OptimizationTags.Privacy
+ )]
public class DisableContentDeliveryManager : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "ContentDeliveryAllowed", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SubscribedContent-338387Enabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SubscribedContent-338388Enabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SubscribedContent-338389Enabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SubscribedContent-353698Enabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SystemPaneSuggestionsEnabled", 0)
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "ContentDeliveryAllowed",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "SubscribedContent-338387Enabled",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "SubscribedContent-338388Enabled",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "SubscribedContent-338389Enabled",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "SubscribedContent-353698Enabled",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "SystemPaneSuggestionsEnabled",
+ 0
+ )
);
context.Logger.LogInformation("Disabled content delivery manager");
return Task.FromResult(ApplyResult.True());
}
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Optimizations/Categories/UserExperience.cs b/optimizerDuck/Domain/Optimizations/Categories/UserExperience.cs
index a5c3b25..1d5459c 100644
--- a/optimizerDuck/Domain/Optimizations/Categories/UserExperience.cs
+++ b/optimizerDuck/Domain/Optimizations/Categories/UserExperience.cs
@@ -15,23 +15,29 @@ namespace optimizerDuck.Domain.Optimizations.Categories;
public class UserExperience : IOptimizationCategory
{
public string Name => Loc.Instance[$"Optimizer.{nameof(UserExperience)}"];
- public OptimizationCategoryOrder Order { get; init; } = OptimizationCategoryOrder.UserExperience;
+ public OptimizationCategoryOrder Order { get; init; } =
+ OptimizationCategoryOrder.UserExperience;
public ObservableCollection<IOptimization> Optimizations { get; init; } = [];
[Optimization(
Id = "9E2C4F7D-5A6B-4E9D-8C71-6E2F5A9C3314",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Latency)]
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Latency
+ )]
public sealed class SpeedUpExplorerAndMenus : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize",
- "StartupDelayInMSec", 0),
- new RegistryItem(@"HKCU\Control Panel\Desktop",
- "MenuShowDelay", "0")
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize",
+ "StartupDelayInMSec",
+ 0
+ ),
+ new RegistryItem(@"HKCU\Control Panel\Desktop", "MenuShowDelay", "0")
);
context.Logger.LogInformation("Speeded up Explorer and menus");
return Task.FromResult(ApplyResult.True());
@@ -41,24 +47,35 @@ public class UserExperience : IOptimizationCategory
[Optimization(
Id = "A3D1E8F2-7B4C-4A5D-9E62-8F3A1B7C4D59",
Risk = OptimizationRisk.Safe,
- Tags = OptimizationTags.Performance | OptimizationTags.Visual)]
+ Tags = OptimizationTags.Performance | OptimizationTags.Visual
+ )]
public sealed class DisableVisualEffects : BaseOptimization
{
- public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
- OptimizationContext context)
+ public override Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ )
{
RegistryService.Write(
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- "TaskbarAnimations", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- "ListviewShadow", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
- "EnableTransparency", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\DWM",
- "EnableAeroPeek", 0)
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ "TaskbarAnimations",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ "ListviewShadow",
+ 0
+ ),
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
+ "EnableTransparency",
+ 0
+ ),
+ new RegistryItem(@"HKCU\Software\Microsoft\Windows\DWM", "EnableAeroPeek", 0)
);
context.Logger.LogInformation("Disabled visual effects for better performance");
return Task.FromResult(ApplyResult.True());
}
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Optimizations/Models/ApplyResult.cs b/optimizerDuck/Domain/Optimizations/Models/ApplyResult.cs
index 9633d81..bfe9d00 100644
--- a/optimizerDuck/Domain/Optimizations/Models/ApplyResult.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/ApplyResult.cs
@@ -28,4 +28,4 @@ public readonly record struct ApplyResult
{
return new ApplyResult { Message = message };
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Optimizations/Models/BaseOptimization.cs b/optimizerDuck/Domain/Optimizations/Models/BaseOptimization.cs
index ac89633..a1c7a31 100644
--- a/optimizerDuck/Domain/Optimizations/Models/BaseOptimization.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/BaseOptimization.cs
@@ -14,43 +14,44 @@ public abstract class BaseOptimization : IOptimization
private OptimizationAttribute? _meta;
private OptimizationAttribute Meta =>
- _meta ??= GetType().GetCustomAttribute<OptimizationAttribute>()
- ?? throw new InvalidOperationException(
- $"{GetType().Name} is missing [Optimization] attribute");
+ _meta ??=
+ GetType().GetCustomAttribute<OptimizationAttribute>()
+ ?? throw new InvalidOperationException(
+ $"{GetType().Name} is missing [Optimization] attribute"
+ );
public Type? OwnerType { get; set; }
public string OwnerKey =>
OwnerType?.Name
- ?? throw new InvalidOperationException(
- $"{GetType().Name} has no owner assigned");
+ ?? throw new InvalidOperationException($"{GetType().Name} has no owner assigned");
- public RiskVisual RiskVisual => Risk switch
- {
- OptimizationRisk.Safe => new RiskVisual
- {
- Display = Translations.Optimizer_UI_Risk_Safe,
- Icon = SymbolRegular.ShieldCheckmark24
- },
- OptimizationRisk.Moderate => new RiskVisual
- {
- Display = Translations.Optimizer_UI_Risk_Moderate,
- Icon = SymbolRegular.Warning24
- },
- OptimizationRisk.Risky => new RiskVisual
+ public RiskVisual RiskVisual =>
+ Risk switch
{
- Display = Translations.Optimizer_UI_Risk_Risky,
- Icon = SymbolRegular.ShieldError24
- },
- _ => new RiskVisual
- {
- Display = Translations.Optimizer_UI_Risk_Safe,
- Icon = SymbolRegular.ShieldCheckmark24
- }
- };
-
- public IEnumerable<OptimizationTagDisplay> TagDisplays =>
- Meta.Tags.ToDisplays();
+ OptimizationRisk.Safe => new RiskVisual
+ {
+ Display = Translations.Optimizer_UI_Risk_Safe,
+ Icon = SymbolRegular.ShieldCheckmark24,
+ },
+ OptimizationRisk.Moderate => new RiskVisual
+ {
+ Display = Translations.Optimizer_UI_Risk_Moderate,
+ Icon = SymbolRegular.Warning24,
+ },
+ OptimizationRisk.Risky => new RiskVisual
+ {
+ Display = Translations.Optimizer_UI_Risk_Risky,
+ Icon = SymbolRegular.ShieldError24,
+ },
+ _ => new RiskVisual
+ {
+ Display = Translations.Optimizer_UI_Risk_Safe,
+ Icon = SymbolRegular.ShieldCheckmark24,
+ },
+ };
+
+ public IEnumerable<OptimizationTagDisplay> TagDisplays => Meta.Tags.ToDisplays();
public string Prefix => Loc.Instance[$"Optimizer.{OwnerKey}.{OptimizationKey}"];
public string ProgressPrefix => Loc.Instance[$"{Prefix}.Progress"];
@@ -66,7 +67,10 @@ public abstract class BaseOptimization : IOptimization
public string Name => Loc.Instance[$"{Prefix}.Name"];
public string ShortDescription => Loc.Instance[$"{Prefix}.ShortDescription"];
- public abstract Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context);
+ public abstract Task<ApplyResult> ApplyAsync(
+ IProgress<ProcessingProgress> progress,
+ OptimizationContext context
+ );
}
/*
@@ -99,4 +103,4 @@ public class OPTIMIZER : IOptimizationCategory
}
}
}
- */
\ No newline at end of file
+ */
diff --git a/optimizerDuck/Domain/Optimizations/Models/Bloatware/AppXPackage.cs b/optimizerDuck/Domain/Optimizations/Models/Bloatware/AppXPackage.cs
index bc36634..6924727 100644
--- a/optimizerDuck/Domain/Optimizations/Models/Bloatware/AppXPackage.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/Bloatware/AppXPackage.cs
@@ -12,7 +12,7 @@ public enum AppRisk
{
Safe,
Caution,
- Unknown
+ Unknown,
}
/// <summary>
@@ -23,7 +23,8 @@ public partial class AppXPackage : ObservableObject
/// <summary>
/// Indicates whether this package is selected for removal.
/// </summary>
- [ObservableProperty] private bool _isSelected;
+ [ObservableProperty]
+ private bool _isSelected;
/// <summary>
/// Path to the package's logo image.
@@ -63,27 +64,28 @@ public partial class AppXPackage : ObservableObject
/// <summary>
/// Gets the visual representation of the risk level for UI display.
/// </summary>
- public RiskVisual RiskVisual => Risk switch
- {
- AppRisk.Safe => new RiskVisual
+ public RiskVisual RiskVisual =>
+ Risk switch
{
- Display = Translations.Optimizer_UI_Risk_Safe,
- Icon = SymbolRegular.ShieldCheckmark24
- },
- AppRisk.Caution => new RiskVisual
- {
- Display = Translations.Optimizer_UI_Risk_Moderate,
- Icon = SymbolRegular.Warning24
- },
- _ => new RiskVisual
- {
- Display = Translations.Optimizer_UI_Risk_Safe,
- Icon = SymbolRegular.ShieldCheckmark24
- }
- };
+ AppRisk.Safe => new RiskVisual
+ {
+ Display = Translations.Optimizer_UI_Risk_Safe,
+ Icon = SymbolRegular.ShieldCheckmark24,
+ },
+ AppRisk.Caution => new RiskVisual
+ {
+ Display = Translations.Optimizer_UI_Risk_Moderate,
+ Icon = SymbolRegular.Warning24,
+ },
+ _ => new RiskVisual
+ {
+ Display = Translations.Optimizer_UI_Risk_Safe,
+ Icon = SymbolRegular.ShieldCheckmark24,
+ },
+ };
/// <summary>
/// Indicates whether the risk should be visible in the UI.
/// </summary>
public bool ShouldVisibleRisk => Risk != AppRisk.Unknown;
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Optimizations/Models/Cleanup/CleanupItem.cs b/optimizerDuck/Domain/Optimizations/Models/Cleanup/CleanupItem.cs
index 2e3c30a..bf3efba 100644
--- a/optimizerDuck/Domain/Optimizations/Models/Cleanup/CleanupItem.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/Cleanup/CleanupItem.cs
@@ -11,32 +11,38 @@ public partial class CleanupItem : ObservableObject
/// <summary>
/// The number of files in this cleanup item.
/// </summary>
- [ObservableProperty] private long _fileCount;
+ [ObservableProperty]
+ private long _fileCount;
/// <summary>
/// Indicates whether cleanup is in progress.
/// </summary>
- [ObservableProperty] private bool _isCleaning;
+ [ObservableProperty]
+ private bool _isCleaning;
/// <summary>
/// Indicates whether this item has been scanned.
/// </summary>
- [ObservableProperty] private bool _isScanned;
+ [ObservableProperty]
+ private bool _isScanned;
/// <summary>
/// Indicates whether scanning is in progress.
/// </summary>
- [ObservableProperty] private bool _isScanning;
+ [ObservableProperty]
+ private bool _isScanning;
/// <summary>
/// Indicates whether this item is selected for cleanup.
/// </summary>
- [ObservableProperty] private bool _isSelected = true;
+ [ObservableProperty]
+ private bool _isSelected = true;
/// <summary>
/// The size of files in bytes.
/// </summary>
- [ObservableProperty] private long _sizeBytes;
+ [ObservableProperty]
+ private long _sizeBytes;
/// <summary>
/// Unique identifier for this cleanup item.
@@ -88,7 +94,7 @@ public partial class CleanupItem : ObservableObject
< 1024 => $"{bytes} B",
< 1024 * 1024 => $"{bytes / 1024.0:F1} KB",
< 1024 * 1024 * 1024 => $"{bytes / (1024.0 * 1024.0):F1} MB",
- _ => $"{bytes / (1024.0 * 1024.0 * 1024.0):F2} GB"
+ _ => $"{bytes / (1024.0 * 1024.0 * 1024.0):F2} GB",
};
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Optimizations/Models/OptimizationContext.cs b/optimizerDuck/Domain/Optimizations/Models/OptimizationContext.cs
index 791f162..1ebe4b2 100644
--- a/optimizerDuck/Domain/Optimizations/Models/OptimizationContext.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/OptimizationContext.cs
@@ -22,4 +22,4 @@ public record OptimizationContext
/// The service used to download remote resources required by optimizations.
/// </summary>
public required StreamService StreamService { get; init; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Optimizations/Models/OptimizationResult.cs b/optimizerDuck/Domain/Optimizations/Models/OptimizationResult.cs
index d750db5..5ab106f 100644
--- a/optimizerDuck/Domain/Optimizations/Models/OptimizationResult.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/OptimizationResult.cs
@@ -26,4 +26,4 @@ public record OptimizationResult
/// List of steps that failed during the operation.
/// </summary>
public List<OperationStepResult> FailedSteps { get; init; } = [];
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Optimizations/Models/ScheduledTask/ScheduledTaskModel.cs b/optimizerDuck/Domain/Optimizations/Models/ScheduledTask/ScheduledTaskModel.cs
index 8e76eac..c6d8f40 100644
--- a/optimizerDuck/Domain/Optimizations/Models/ScheduledTask/ScheduledTaskModel.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/ScheduledTask/ScheduledTaskModel.cs
@@ -12,17 +12,20 @@ public partial class ScheduledTaskModel : ObservableObject
/// <summary>
/// Indicates whether the task is enabled.
/// </summary>
- [ObservableProperty] private bool _isEnabled;
+ [ObservableProperty]
+ private bool _isEnabled;
/// <summary>
/// The logo image of the task's executable.
/// </summary>
- [ObservableProperty] private ImageSource? _logoImage;
+ [ObservableProperty]
+ private ImageSource? _logoImage;
/// <summary>
/// The current state of the task (e.g., "Ready", "Running", "Disabled").
/// </summary>
- [ObservableProperty] private string _state = string.Empty;
+ [ObservableProperty]
+ private string _state = string.Empty;
/// <summary>
/// The name of the task.
@@ -82,7 +85,8 @@ public partial class ScheduledTaskModel : ObservableObject
/// <summary>
/// Indicates whether this is a Microsoft system task.
/// </summary>
- public bool IsMicrosoftTask => Path.StartsWith(@"\Microsoft\", StringComparison.OrdinalIgnoreCase);
+ public bool IsMicrosoftTask =>
+ Path.StartsWith(@"\Microsoft\", StringComparison.OrdinalIgnoreCase);
/// <summary>
/// Indicates whether the task has a logon trigger.
@@ -160,4 +164,4 @@ public partial class ScheduledTaskModel : ObservableObject
OnPropertyChanged(nameof(IsReady));
OnPropertyChanged(nameof(IsDisabledState));
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Optimizations/Models/Services/RegistryItem.cs b/optimizerDuck/Domain/Optimizations/Models/Services/RegistryItem.cs
index ae999c3..b652cdb 100644
--- a/optimizerDuck/Domain/Optimizations/Models/Services/RegistryItem.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/Services/RegistryItem.cs
@@ -95,7 +95,7 @@ public record struct RegistryItem
string => RegistryValueKind.String,
string[] => RegistryValueKind.MultiString,
byte[] => RegistryValueKind.Binary,
- _ => RegistryValueKind.Unknown
+ _ => RegistryValueKind.Unknown,
};
}
}
diff --git a/optimizerDuck/Domain/Optimizations/Models/Services/ServiceItem.cs b/optimizerDuck/Domain/Optimizations/Models/Services/ServiceItem.cs
index 1b78214..58a6301 100644
--- a/optimizerDuck/Domain/Optimizations/Models/Services/ServiceItem.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/Services/ServiceItem.cs
@@ -28,4 +28,4 @@ public readonly record struct ServiceItem
/// The desired startup type for the service.
/// </summary>
public required ServiceStartupType StartupType { get; init; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Optimizations/Models/Services/ServiceStartupType.cs b/optimizerDuck/Domain/Optimizations/Models/Services/ServiceStartupType.cs
index 23d008b..3bb89b0 100644
--- a/optimizerDuck/Domain/Optimizations/Models/Services/ServiceStartupType.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/Services/ServiceStartupType.cs
@@ -15,5 +15,5 @@ public enum ServiceStartupType
Disabled,
/// <summary>The service starts automatically after a short delay at system startup.</summary>
- AutomaticDelayedStart
-}
\ No newline at end of file
+ AutomaticDelayedStart,
+}
diff --git a/optimizerDuck/Domain/Optimizations/Models/Services/ShellResult.cs b/optimizerDuck/Domain/Optimizations/Models/Services/ShellResult.cs
index b262107..9b81354 100644
--- a/optimizerDuck/Domain/Optimizations/Models/Services/ShellResult.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/Services/ShellResult.cs
@@ -30,4 +30,4 @@ public record ShellResult
/// The total wall-clock duration of the command execution.
/// </summary>
public required TimeSpan Duration { get; init; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Optimizations/Models/StartupManager/StartupApp.cs b/optimizerDuck/Domain/Optimizations/Models/StartupManager/StartupApp.cs
index 25059c6..f09af0c 100644
--- a/optimizerDuck/Domain/Optimizations/Models/StartupManager/StartupApp.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/StartupManager/StartupApp.cs
@@ -14,7 +14,7 @@ public enum StartupAppLocation
RegistryHKCURunOnce,
RegistryHKLMRunOnce,
UserStartupFolder,
- CommonStartupFolder
+ CommonStartupFolder,
}
/// <summary>
@@ -25,29 +25,34 @@ public partial class StartupApp : ObservableObject
/// <summary>
/// The command that runs the application.
/// </summary>
- [ObservableProperty] private string _command = string.Empty;
+ [ObservableProperty]
+ private string _command = string.Empty;
private string? _filePath;
/// <summary>
/// Indicates whether this startup entry is enabled.
/// </summary>
- [ObservableProperty] private bool _isEnabled;
+ [ObservableProperty]
+ private bool _isEnabled;
/// <summary>
/// The logo image of the application.
/// </summary>
- [ObservableProperty] private ImageSource? _logoImage;
+ [ObservableProperty]
+ private ImageSource? _logoImage;
/// <summary>
/// The original value name (registry) or file name (folder).
/// </summary>
- [ObservableProperty] private string _originalValueNameOrFileName = string.Empty;
+ [ObservableProperty]
+ private string _originalValueNameOrFileName = string.Empty;
/// <summary>
/// The publisher or company name.
/// </summary>
- [ObservableProperty] private string _publisher = string.Empty;
+ [ObservableProperty]
+ private string _publisher = string.Empty;
/// <summary>
/// The display name of the startup application.
@@ -72,7 +77,8 @@ public partial class StartupApp : ObservableObject
get => _filePath;
set
{
- if (SetProperty(ref _filePath, value)) OnPropertyChanged(nameof(CanOpenLocation));
+ if (SetProperty(ref _filePath, value))
+ OnPropertyChanged(nameof(CanOpenLocation));
}
}
@@ -84,14 +90,15 @@ public partial class StartupApp : ObservableObject
/// <summary>
/// Gets a human-readable string for the location.
/// </summary>
- public string LocationDisplay => Location switch
- {
- StartupAppLocation.RegistryHKCURun => "Registry (Current User)",
- StartupAppLocation.RegistryHKLMRun => "Registry (Local Machine)",
- StartupAppLocation.RegistryHKCURunOnce => "Registry RunOnce (Current User)",
- StartupAppLocation.RegistryHKLMRunOnce => "Registry RunOnce (Local Machine)",
- StartupAppLocation.UserStartupFolder => "Startup Folder (Current User)",
- StartupAppLocation.CommonStartupFolder => "Startup Folder (All Users)",
- _ => PathOrKey
- };
-}
\ No newline at end of file
+ public string LocationDisplay =>
+ Location switch
+ {
+ StartupAppLocation.RegistryHKCURun => "Registry (Current User)",
+ StartupAppLocation.RegistryHKLMRun => "Registry (Local Machine)",
+ StartupAppLocation.RegistryHKCURunOnce => "Registry RunOnce (Current User)",
+ StartupAppLocation.RegistryHKLMRunOnce => "Registry RunOnce (Local Machine)",
+ StartupAppLocation.UserStartupFolder => "Startup Folder (Current User)",
+ StartupAppLocation.CommonStartupFolder => "Startup Folder (All Users)",
+ _ => PathOrKey,
+ };
+}
diff --git a/optimizerDuck/Domain/Optimizations/Models/StartupManager/StartupTask.cs b/optimizerDuck/Domain/Optimizations/Models/StartupManager/StartupTask.cs
index 1d651df..23724ff 100644
--- a/optimizerDuck/Domain/Optimizations/Models/StartupManager/StartupTask.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/StartupManager/StartupTask.cs
@@ -11,12 +11,14 @@ public partial class StartupTask : ObservableObject
/// <summary>
/// Indicates whether the task is enabled.
/// </summary>
- [ObservableProperty] private bool _isEnabled;
+ [ObservableProperty]
+ private bool _isEnabled;
/// <summary>
/// The logo image of the task's executable.
/// </summary>
- [ObservableProperty] private ImageSource? _logoImage;
+ [ObservableProperty]
+ private ImageSource? _logoImage;
/// <summary>
/// The name of the scheduled task.
@@ -51,5 +53,6 @@ public partial class StartupTask : ObservableObject
/// <summary>
/// Indicates whether this is a Microsoft system task.
/// </summary>
- public bool IsMicrosoftTask => TaskPath.StartsWith(@"\Microsoft\", StringComparison.OrdinalIgnoreCase);
-}
\ No newline at end of file
+ public bool IsMicrosoftTask =>
+ TaskPath.StartsWith(@"\Microsoft\", StringComparison.OrdinalIgnoreCase);
+}
diff --git a/optimizerDuck/Domain/Revert/RevertData.cs b/optimizerDuck/Domain/Revert/RevertData.cs
index dfb3f5a..0b0624e 100644
--- a/optimizerDuck/Domain/Revert/RevertData.cs
+++ b/optimizerDuck/Domain/Revert/RevertData.cs
@@ -42,4 +42,4 @@ public class RevertData
/// The list of revert steps.
/// </summary>
public List<RevertStepData> Steps { get; set; } = new();
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Revert/Steps/RegistryRevertStep.cs b/optimizerDuck/Domain/Revert/Steps/RegistryRevertStep.cs
index be4d6c0..a18dca5 100644
--- a/optimizerDuck/Domain/Revert/Steps/RegistryRevertStep.cs
+++ b/optimizerDuck/Domain/Revert/Steps/RegistryRevertStep.cs
@@ -37,7 +37,6 @@ public class RegistryRevertStep : IRevertStep
/// </summary>
public IReadOnlyList<RegistryRevertStep>? SubSteps { get; init; }
-
/// <summary>
/// The original registry value to restore.
/// </summary>
@@ -52,53 +51,66 @@ public class RegistryRevertStep : IRevertStep
public string Type => "Registry";
/// <inheritdoc />
- public string Description => Action switch
- {
- RevertAction.RestorePrevious => string.Format(Translations.Revert_Registry_Description_Restore, Path, Name ?? "(Default)"),
- RevertAction.NoPreviousValue => string.Format(Translations.Revert_Registry_Description_Delete, Path, Name ?? "(Default)"),
- RevertAction.RestoreKey => string.Format(Translations.Revert_Registry_Description_RestoreKey, Path),
- RevertAction.DeleteKey => string.Format(Translations.Revert_Registry_Description_DeleteKey, Path),
- RevertAction.RestoreKeyTree => string.Format(Translations.Revert_Registry_Description_RestoreKey, Path),
- _ => $"Revert {Path}"
- };
+ public string Description =>
+ Action switch
+ {
+ RevertAction.RestorePrevious => string.Format(
+ Translations.Revert_Registry_Description_Restore,
+ Path,
+ Name ?? "(Default)"
+ ),
+ RevertAction.NoPreviousValue => string.Format(
+ Translations.Revert_Registry_Description_Delete,
+ Path,
+ Name ?? "(Default)"
+ ),
+ RevertAction.RestoreKey => string.Format(
+ Translations.Revert_Registry_Description_RestoreKey,
+ Path
+ ),
+ RevertAction.DeleteKey => string.Format(
+ Translations.Revert_Registry_Description_DeleteKey,
+ Path
+ ),
+ RevertAction.RestoreKeyTree => string.Format(
+ Translations.Revert_Registry_Description_RestoreKey,
+ Path
+ ),
+ _ => $"Revert {Path}",
+ };
/// <inheritdoc />
public Task<bool> ExecuteAsync()
{
var result = Action switch
{
- RevertAction.NoPreviousValue =>
- RegistryService.DeleteValue(new RegistryItem(Path, Name!)),
+ RevertAction.NoPreviousValue => RegistryService.DeleteValue(
+ new RegistryItem(Path, Name!)
+ ),
- RevertAction.RestorePrevious =>
- Value == null
- ? RegistryService.DeleteValue(new RegistryItem(Path, Name!))
- : RegistryService.Write(new RegistryItem(Path, Name!, Value, Kind)),
+ RevertAction.RestorePrevious => Value == null
+ ? RegistryService.DeleteValue(new RegistryItem(Path, Name!))
+ : RegistryService.Write(new RegistryItem(Path, Name!, Value, Kind)),
- RevertAction.RestoreKey =>
- RegistryService.CreateSubKey(new RegistryItem(Path)),
+ RevertAction.RestoreKey => RegistryService.CreateSubKey(new RegistryItem(Path)),
- RevertAction.DeleteKey =>
- RegistryService.DeleteSubKeyTree(new RegistryItem(Path)),
+ RevertAction.DeleteKey => RegistryService.DeleteSubKeyTree(new RegistryItem(Path)),
- RevertAction.RestoreKeyTree =>
- ExecuteSubSteps(),
+ RevertAction.RestoreKeyTree => ExecuteSubSteps(),
- _ => false
+ _ => false,
};
if (!result)
- throw new Exception(
- string.Format(Translations
- .Service_Common_Error_AccessDenied)); // Generic for now, but better than nothing
+ throw new Exception(string.Format(Translations.Service_Common_Error_AccessDenied)); // Generic for now, but better than nothing
// Cleanup empty subkeys if they were created during apply
- if (result && CreatedSubKeys?.Count > 0) RegistryService.CleanupEmptyKeys(CreatedSubKeys);
+ if (result && CreatedSubKeys?.Count > 0)
+ RegistryService.CleanupEmptyKeys(CreatedSubKeys);
return Task.FromResult(result);
}
-
/// <inheritdoc />
public JObject ToData()
{
@@ -107,16 +119,18 @@ public class RegistryRevertStep : IRevertStep
[nameof(Action)] = Action.ToString(),
[nameof(Path)] = Path,
[nameof(Name)] = Name,
- [nameof(Kind)] = Kind.ToString()
+ [nameof(Kind)] = Kind.ToString(),
};
// Save created subkeys list
- if (CreatedSubKeys?.Count > 0) obj[nameof(CreatedSubKeys)] = new JArray(CreatedSubKeys);
+ if (CreatedSubKeys?.Count > 0)
+ obj[nameof(CreatedSubKeys)] = new JArray(CreatedSubKeys);
if (SubSteps?.Count > 0)
{
var subArray = new JArray();
- foreach (var step in SubSteps) subArray.Add(step.ToData());
+ foreach (var step in SubSteps)
+ subArray.Add(step.ToData());
obj[nameof(SubSteps)] = subArray;
}
@@ -200,7 +214,8 @@ public class RegistryRevertStep : IRevertStep
// Load created subkeys list
List<string>? createdSubKeys = null;
- if (data[nameof(CreatedSubKeys)] is JArray subKeysArray) createdSubKeys = subKeysArray.ToObject<List<string>>();
+ if (data[nameof(CreatedSubKeys)] is JArray subKeysArray)
+ createdSubKeys = subKeysArray.ToObject<List<string>>();
List<RegistryRevertStep>? subSteps = null;
if (data[nameof(SubSteps)] is JArray stepsArray)
@@ -219,17 +234,19 @@ public class RegistryRevertStep : IRevertStep
Value = value,
Kind = kind,
CreatedSubKeys = createdSubKeys,
- SubSteps = subSteps
+ SubSteps = subSteps,
};
}
private bool ExecuteSubSteps()
{
- if (SubSteps == null) return true;
+ if (SubSteps == null)
+ return true;
foreach (var step in SubSteps)
{
// Run synchronously to ensure correct nested tree creation order
- if (!step.ExecuteAsync().GetAwaiter().GetResult()) return false;
+ if (!step.ExecuteAsync().GetAwaiter().GetResult())
+ return false;
}
return true;
}
@@ -253,5 +270,5 @@ public enum RevertAction
RestoreKey,
/// <summary>The key tree existed before; recreate the entire tree including values sequentially.</summary>
- RestoreKeyTree
-}
\ No newline at end of file
+ RestoreKeyTree,
+}
diff --git a/optimizerDuck/Domain/Revert/Steps/ScheduledTaskRevertStep.cs b/optimizerDuck/Domain/Revert/Steps/ScheduledTaskRevertStep.cs
index 4086e52..c6d4a55 100644
--- a/optimizerDuck/Domain/Revert/Steps/ScheduledTaskRevertStep.cs
+++ b/optimizerDuck/Domain/Revert/Steps/ScheduledTaskRevertStep.cs
@@ -24,11 +24,13 @@ public class ScheduledTaskRevertStep : IRevertStep
public string Type => "ScheduledTask";
/// <inheritdoc />
- public string Description => string.Format(
- OriginalEnabled
- ? Translations.Revert_ScheduledTask_Description_Enable
- : Translations.Revert_ScheduledTask_Description_Disable,
- FullPath);
+ public string Description =>
+ string.Format(
+ OriginalEnabled
+ ? Translations.Revert_ScheduledTask_Description_Enable
+ : Translations.Revert_ScheduledTask_Description_Disable,
+ FullPath
+ );
/// <inheritdoc />
public async Task<bool> ExecuteAsync()
@@ -49,7 +51,7 @@ public class ScheduledTaskRevertStep : IRevertStep
return new JObject
{
[nameof(FullPath)] = FullPath,
- [nameof(OriginalEnabled)] = OriginalEnabled
+ [nameof(OriginalEnabled)] = OriginalEnabled,
};
}
@@ -63,7 +65,7 @@ public class ScheduledTaskRevertStep : IRevertStep
return new ScheduledTaskRevertStep
{
FullPath = data[nameof(FullPath)]?.ToString() ?? string.Empty,
- OriginalEnabled = data[nameof(OriginalEnabled)]?.Value<bool>() ?? true
+ OriginalEnabled = data[nameof(OriginalEnabled)]?.Value<bool>() ?? true,
};
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Revert/Steps/ServiceRevertStep.cs b/optimizerDuck/Domain/Revert/Steps/ServiceRevertStep.cs
index 8678ad1..a751896 100644
--- a/optimizerDuck/Domain/Revert/Steps/ServiceRevertStep.cs
+++ b/optimizerDuck/Domain/Revert/Steps/ServiceRevertStep.cs
@@ -25,41 +25,43 @@ public class ServiceRevertStep : IRevertStep
public string Type => "Service";
/// <inheritdoc />
- public string Description => string.Format(
- Translations.Revert_Service_Description_Restore,
- ServiceName, OriginalStartupType);
+ public string Description =>
+ string.Format(
+ Translations.Revert_Service_Description_Restore,
+ ServiceName,
+ OriginalStartupType
+ );
/// <inheritdoc />
public async Task<bool> ExecuteAsync()
{
return await Task.Run(() =>
{
- var result = ServiceProcessService.ChangeServiceStartupType(new ServiceItem
- {
- Name = ServiceName,
- StartupType = OriginalStartupType
- });
+ var result = ServiceProcessService.ChangeServiceStartupType(
+ new ServiceItem { Name = ServiceName, StartupType = OriginalStartupType }
+ );
if (!result)
throw new Exception(
- string.Format(Translations.Service_Service_Error_UpdateRegistryForStartupTypeFailed));
+ string.Format(
+ Translations.Service_Service_Error_UpdateRegistryForStartupTypeFailed
+ )
+ );
return result;
});
}
-
/// <inheritdoc />
public JObject ToData()
{
return new JObject
{
[nameof(ServiceName)] = ServiceName,
- [nameof(OriginalStartupType)] = OriginalStartupType.ToString()
+ [nameof(OriginalStartupType)] = OriginalStartupType.ToString(),
};
}
-
/// <summary>
/// Deserializes a <see cref="ServiceRevertStep" /> from JSON data.
/// </summary>
@@ -71,7 +73,8 @@ public class ServiceRevertStep : IRevertStep
{
ServiceName = data[nameof(ServiceName)]?.ToString() ?? string.Empty,
OriginalStartupType = Enum.Parse<ServiceStartupType>(
- data[nameof(OriginalStartupType)]?.ToString() ?? "Manual")
+ data[nameof(OriginalStartupType)]?.ToString() ?? "Manual"
+ ),
};
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/Revert/Steps/ShellRevertStep.cs b/optimizerDuck/Domain/Revert/Steps/ShellRevertStep.cs
index 4cc9bf4..0c7c700 100644
--- a/optimizerDuck/Domain/Revert/Steps/ShellRevertStep.cs
+++ b/optimizerDuck/Domain/Revert/Steps/ShellRevertStep.cs
@@ -25,9 +25,8 @@ public class ShellRevertStep : IRevertStep
public string Type => "Shell";
/// <inheritdoc />
- public string Description => string.Format(
- Translations.Revert_Shell_Description_Run,
- ShellType, Command);
+ public string Description =>
+ string.Format(Translations.Revert_Shell_Description_Run, ShellType, Command);
/// <inheritdoc />
public async Task<bool> ExecuteAsync()
@@ -40,15 +39,20 @@ public class ShellRevertStep : IRevertStep
ShellType.CMD => ShellService.CMD(Command),
_ => new ShellResult
{
- Command = Command, Stdout = "", Stderr = "Unknown shell type", ExitCode = 1,
- Duration = TimeSpan.Zero
- }
+ Command = Command,
+ Stdout = "",
+ Stderr = "Unknown shell type",
+ ExitCode = 1,
+ Duration = TimeSpan.Zero,
+ },
};
if (result.ExitCode != 0)
- throw new Exception(!string.IsNullOrWhiteSpace(result.Stderr)
- ? result.Stderr
- : $"Command failed with exit code {result.ExitCode}");
+ throw new Exception(
+ !string.IsNullOrWhiteSpace(result.Stderr)
+ ? result.Stderr
+ : $"Command failed with exit code {result.ExitCode}"
+ );
return result.ExitCode == 0;
});
@@ -60,7 +64,7 @@ public class ShellRevertStep : IRevertStep
return new JObject
{
[nameof(ShellType)] = ShellType.ToString(),
- [nameof(Command)] = Command
+ [nameof(Command)] = Command,
};
}
@@ -73,9 +77,8 @@ public class ShellRevertStep : IRevertStep
{
return new ShellRevertStep
{
- ShellType = Enum.Parse<ShellType>(
- data[nameof(ShellType)]?.ToString() ?? "PowerShell"),
- Command = data[nameof(Command)]?.ToString() ?? string.Empty
+ ShellType = Enum.Parse<ShellType>(data[nameof(ShellType)]?.ToString() ?? "PowerShell"),
+ Command = data[nameof(Command)]?.ToString() ?? string.Empty,
};
}
}
@@ -89,5 +92,5 @@ public enum ShellType
PowerShell,
/// <summary>Command Prompt (cmd.exe).</summary>
- CMD
-}
\ No newline at end of file
+ CMD,
+}
diff --git a/optimizerDuck/Domain/UI/FeatureCategoryOrder.cs b/optimizerDuck/Domain/UI/FeatureCategoryOrder.cs
index df66b9d..f3d6d88 100644
--- a/optimizerDuck/Domain/UI/FeatureCategoryOrder.cs
+++ b/optimizerDuck/Domain/UI/FeatureCategoryOrder.cs
@@ -5,5 +5,5 @@ public enum FeatureCategoryOrder
System,
Desktop,
UserExperience,
- Gaming
-}
\ No newline at end of file
+ Gaming,
+}
diff --git a/optimizerDuck/Domain/UI/LanguageOption.cs b/optimizerDuck/Domain/UI/LanguageOption.cs
index 8b9cca4..5304040 100644
--- a/optimizerDuck/Domain/UI/LanguageOption.cs
+++ b/optimizerDuck/Domain/UI/LanguageOption.cs
@@ -16,4 +16,4 @@ public record LanguageOption
/// The <see cref="CultureInfo" /> associated with this language option.
/// </summary>
public required CultureInfo Culture { get; init; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/UI/OptimizationCategoryOrder.cs b/optimizerDuck/Domain/UI/OptimizationCategoryOrder.cs
index 5be6bb6..98282b7 100644
--- a/optimizerDuck/Domain/UI/OptimizationCategoryOrder.cs
+++ b/optimizerDuck/Domain/UI/OptimizationCategoryOrder.cs
@@ -21,5 +21,5 @@ public enum OptimizationCategoryOrder
BloatwareAndServices,
/// <summary>User experience and visual optimizations.</summary>
- UserExperience
-}
\ No newline at end of file
+ UserExperience,
+}
diff --git a/optimizerDuck/Domain/UI/OptimizationRisk.cs b/optimizerDuck/Domain/UI/OptimizationRisk.cs
index b586a75..d8e2dbb 100644
--- a/optimizerDuck/Domain/UI/OptimizationRisk.cs
+++ b/optimizerDuck/Domain/UI/OptimizationRisk.cs
@@ -12,5 +12,5 @@ public enum OptimizationRisk
Moderate,
/// <summary>High risk; may cause system instability or data loss. Use with caution.</summary>
- Risky
-}
\ No newline at end of file
+ Risky,
+}
diff --git a/optimizerDuck/Domain/UI/OptimizationState.cs b/optimizerDuck/Domain/UI/OptimizationState.cs
index 2f3c093..d75210a 100644
--- a/optimizerDuck/Domain/UI/OptimizationState.cs
+++ b/optimizerDuck/Domain/UI/OptimizationState.cs
@@ -19,22 +19,26 @@ public partial class OptimizationState : ObservableObject
/// <summary>
/// The date and time when the optimization was applied.
/// </summary>
- [ObservableProperty] private DateTime? appliedAt;
+ [ObservableProperty]
+ private DateTime? appliedAt;
/// <summary>
/// Indicates whether the optimization is currently applied.
/// </summary>
- [ObservableProperty] private bool isApplied;
+ [ObservableProperty]
+ private bool isApplied;
/// <summary>
/// A human-readable relative time string (e.g., "5 minutes ago").
/// </summary>
- [ObservableProperty] private string? relativeTime = string.Empty;
+ [ObservableProperty]
+ private string? relativeTime = string.Empty;
/// <summary>
/// The risk level of the optimization.
/// </summary>
- [ObservableProperty] private OptimizationRisk risk;
+ [ObservableProperty]
+ private OptimizationRisk risk;
static OptimizationState()
{
@@ -78,24 +82,35 @@ public partial class OptimizationState : ObservableObject
var ts = DateTime.UtcNow - AppliedAt.Value.ToUniversalTime();
var totalSeconds = (int)Math.Floor(ts.TotalSeconds);
- if (totalSeconds == _lastDisplayedSeconds) return;
+ if (totalSeconds == _lastDisplayedSeconds)
+ return;
_lastDisplayedSeconds = totalSeconds;
RelativeTime = ts switch
{
_ when totalSeconds < 15 => Translations.Common_AppliedJustNow,
- _ when totalSeconds < 60 =>
- string.Format(Translations.Common_AppliedSecondsAgo, totalSeconds),
- _ when ts.TotalMinutes < 60 =>
- string.Format(Translations.Common_AppliedMinutesAgo, (int)Math.Floor(ts.TotalMinutes)),
- _ when ts.TotalHours < 24 =>
- string.Format(Translations.Common_AppliedHoursAgo, (int)Math.Floor(ts.TotalHours)),
- _ when ts.TotalDays < 30 =>
- string.Format(Translations.Common_AppliedDaysAgo, (int)Math.Floor(ts.TotalDays)),
- _ when ts.TotalDays < 365 =>
- string.Format(Translations.Common_AppliedMonthsAgo, (int)(ts.TotalDays / 30)),
- _ => string.Format(Translations.Common_AppliedYearsAgo, (int)(ts.TotalDays / 365))
+ _ when totalSeconds < 60 => string.Format(
+ Translations.Common_AppliedSecondsAgo,
+ totalSeconds
+ ),
+ _ when ts.TotalMinutes < 60 => string.Format(
+ Translations.Common_AppliedMinutesAgo,
+ (int)Math.Floor(ts.TotalMinutes)
+ ),
+ _ when ts.TotalHours < 24 => string.Format(
+ Translations.Common_AppliedHoursAgo,
+ (int)Math.Floor(ts.TotalHours)
+ ),
+ _ when ts.TotalDays < 30 => string.Format(
+ Translations.Common_AppliedDaysAgo,
+ (int)Math.Floor(ts.TotalDays)
+ ),
+ _ when ts.TotalDays < 365 => string.Format(
+ Translations.Common_AppliedMonthsAgo,
+ (int)(ts.TotalDays / 30)
+ ),
+ _ => string.Format(Translations.Common_AppliedYearsAgo, (int)(ts.TotalDays / 365)),
};
}
@@ -104,4 +119,4 @@ public partial class OptimizationState : ObservableObject
_lastDisplayedSeconds = -1;
UpdateRelativeTime();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/UI/OptimizationSuccessResult.cs b/optimizerDuck/Domain/UI/OptimizationSuccessResult.cs
index 88b3783..2cbe170 100644
--- a/optimizerDuck/Domain/UI/OptimizationSuccessResult.cs
+++ b/optimizerDuck/Domain/UI/OptimizationSuccessResult.cs
@@ -12,5 +12,5 @@ public enum OptimizationSuccessResult
PartialSuccess,
/// <summary>The operation failed entirely.</summary>
- Failed
-}
\ No newline at end of file
+ Failed,
+}
diff --git a/optimizerDuck/Domain/UI/OptimizationTags.cs b/optimizerDuck/Domain/UI/OptimizationTags.cs
index 65452a9..83063d6 100644
--- a/optimizerDuck/Domain/UI/OptimizationTags.cs
+++ b/optimizerDuck/Domain/UI/OptimizationTags.cs
@@ -39,7 +39,7 @@ public enum OptimizationTags
// Performance
Performance = 1 << 14,
- Latency = 1 << 15
+ Latency = 1 << 15,
}
/// <summary>
@@ -75,100 +75,100 @@ public static class OptimizationTagsToDisplay
OptimizationTags.Ram => new OptimizationTagDisplay
{
Icon = SymbolRegular.Memory16,
- Display = Translations.Optimizer_UI_Tags_Ram
+ Display = Translations.Optimizer_UI_Tags_Ram,
},
OptimizationTags.Disk => new OptimizationTagDisplay
{
Icon = SymbolRegular.HardDrive20,
- Display = Translations.Optimizer_UI_Tags_Disk
+ Display = Translations.Optimizer_UI_Tags_Disk,
},
OptimizationTags.Latency => new OptimizationTagDisplay
{
Icon = SymbolRegular.Clock24,
- Display = Translations.Optimizer_UI_Tags_Latency
+ Display = Translations.Optimizer_UI_Tags_Latency,
},
OptimizationTags.Visual => new OptimizationTagDisplay
{
Icon = SymbolRegular.VideoClip24,
- Display = Translations.Optimizer_UI_Tags_Visual
+ Display = Translations.Optimizer_UI_Tags_Visual,
},
OptimizationTags.Display => new OptimizationTagDisplay
{
Icon = SymbolRegular.VideoClip24,
- Display = Translations.Optimizer_UI_Tags_Display
+ Display = Translations.Optimizer_UI_Tags_Display,
},
OptimizationTags.Network => new OptimizationTagDisplay
{
Icon = SymbolRegular.NetworkAdapter16,
- Display = Translations.Optimizer_UI_Tags_Network
+ Display = Translations.Optimizer_UI_Tags_Network,
},
OptimizationTags.Performance => new OptimizationTagDisplay
{
Icon = SymbolRegular.Gauge24,
- Display = Translations.Optimizer_UI_Tags_Performance
+ Display = Translations.Optimizer_UI_Tags_Performance,
},
OptimizationTags.Privacy => new OptimizationTagDisplay
{
Icon = SymbolRegular.LockOpen24,
- Display = Translations.Optimizer_UI_Tags_Privacy
+ Display = Translations.Optimizer_UI_Tags_Privacy,
},
OptimizationTags.Audio => new OptimizationTagDisplay
{
Icon = SymbolRegular.Headphones24,
- Display = Translations.Optimizer_UI_Tags_Audio
+ Display = Translations.Optimizer_UI_Tags_Audio,
},
OptimizationTags.System => new OptimizationTagDisplay
{
Icon = SymbolRegular.Desktop24,
- Display = Translations.Optimizer_UI_Tags_System
+ Display = Translations.Optimizer_UI_Tags_System,
},
OptimizationTags.Security => new OptimizationTagDisplay
{
Icon = SymbolRegular.LockClosed24,
- Display = Translations.Optimizer_UI_Tags_Security
+ Display = Translations.Optimizer_UI_Tags_Security,
},
OptimizationTags.NetworkRequired => new OptimizationTagDisplay
{
Icon = SymbolRegular.Wifi120,
- Display = Translations.Optimizer_UI_Tags_NetworkRequired
+ Display = Translations.Optimizer_UI_Tags_NetworkRequired,
},
OptimizationTags.Nvidia => new OptimizationTagDisplay
{
Icon = SymbolRegular.VideoClip24,
- Display = Translations.Optimizer_UI_Tags_Nvidia
+ Display = Translations.Optimizer_UI_Tags_Nvidia,
},
OptimizationTags.Amd => new OptimizationTagDisplay
{
Icon = SymbolRegular.VideoClip24,
- Display = Translations.Optimizer_UI_Tags_Amd
+ Display = Translations.Optimizer_UI_Tags_Amd,
},
OptimizationTags.Intel => new OptimizationTagDisplay
{
Icon = SymbolRegular.VideoClip24,
- Display = Translations.Optimizer_UI_Tags_Intel
+ Display = Translations.Optimizer_UI_Tags_Intel,
},
OptimizationTags.Power => new OptimizationTagDisplay
{
Icon = SymbolRegular.BatteryCharge24,
- Display = Translations.Optimizer_UI_Tags_Power
+ Display = Translations.Optimizer_UI_Tags_Power,
},
- _ => throw new ArgumentOutOfRangeException(nameof(tags))
+ _ => throw new ArgumentOutOfRangeException(nameof(tags)),
};
}
}
@@ -188,4 +188,4 @@ public readonly record struct OptimizationTagDisplay
/// The localized display text for the tag.
/// </summary>
public required string Display { get; init; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/UI/ProcessingProgress.cs b/optimizerDuck/Domain/UI/ProcessingProgress.cs
index b01d094..b5a940d 100644
--- a/optimizerDuck/Domain/UI/ProcessingProgress.cs
+++ b/optimizerDuck/Domain/UI/ProcessingProgress.cs
@@ -24,4 +24,4 @@ public record ProcessingProgress
/// The total number of steps or items.
/// </summary>
public int Total { get; init; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Domain/UI/RiskVisual.cs b/optimizerDuck/Domain/UI/RiskVisual.cs
index 2ee6e14..cda378c 100644
--- a/optimizerDuck/Domain/UI/RiskVisual.cs
+++ b/optimizerDuck/Domain/UI/RiskVisual.cs
@@ -16,4 +16,4 @@ public class RiskVisual
/// The icon symbol to display for the risk level.
/// </summary>
public SymbolRegular Icon { get; init; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Services/Configuration/ConfigManager.cs b/optimizerDuck/Services/Configuration/ConfigManager.cs
index 951438a..3e8deaa 100644
--- a/optimizerDuck/Services/Configuration/ConfigManager.cs
+++ b/optimizerDuck/Services/Configuration/ConfigManager.cs
@@ -1,11 +1,11 @@
-using Microsoft.Extensions.Configuration;
+using System.IO;
+using System.Linq.Expressions;
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using optimizerDuck.Common.Helpers;
using optimizerDuck.Domain.Configuration;
-using System.IO;
-using System.Linq.Expressions;
namespace optimizerDuck.Services.Managers;
@@ -51,7 +51,11 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
var properties = typeof(AppSettings).GetProperties();
foreach (var prop in properties)
{
- if (prop.PropertyType.IsClass && !prop.PropertyType.IsPrimitive && prop.PropertyType != typeof(string))
+ if (
+ prop.PropertyType.IsClass
+ && !prop.PropertyType.IsPrimitive
+ && prop.PropertyType != typeof(string)
+ )
{
var nestedObj = prop.GetValue(defaults);
if (nestedObj != null)
@@ -61,16 +65,26 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
{
var key = $"{prop.Name}:{nestedProp.Name}";
var value = nestedProp.GetValue(nestedObj);
- if (value == null) continue;
+ if (value == null)
+ continue;
// Check both flat key and nested object format
var existsFlat = GetTokenIgnoreCase(_cache, key) != null;
- var existsNested = CheckNestedExists(_cache, prop.Name, nestedProp.Name);
+ var existsNested = CheckNestedExists(
+ _cache,
+ prop.Name,
+ nestedProp.Name
+ );
if (!existsFlat && !existsNested)
{
// Add as nested object format (proper structure)
- EnsureNestedValue(_cache, prop.Name, nestedProp.Name, value.ToString() ?? "");
+ EnsureNestedValue(
+ _cache,
+ prop.Name,
+ nestedProp.Name,
+ value.ToString() ?? ""
+ );
addedKeys.Add($"{key} = {value}");
}
}
@@ -83,7 +97,11 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
// Clean up any duplicate flat keys that may have been added previously
CleanupDuplicateKeys(_cache);
await SaveConfigAsync();
- logger.LogInformation("Added {Count} missing config keys: {Keys}", addedKeys.Count, string.Join(", ", addedKeys));
+ logger.LogInformation(
+ "Added {Count} missing config keys: {Keys}",
+ addedKeys.Count,
+ string.Join(", ", addedKeys)
+ );
}
}
finally
@@ -98,7 +116,8 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
private static bool CheckNestedExists(JObject root, string section, string key)
{
var sectionToken = GetTokenIgnoreCase(root, section);
- if (sectionToken is not JObject sectionObj) return false;
+ if (sectionToken is not JObject sectionObj)
+ return false;
return GetTokenIgnoreCase(sectionObj, key) != null;
}
@@ -121,7 +140,11 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
foreach (var prop in properties)
{
- if (prop.PropertyType.IsClass && !prop.PropertyType.IsPrimitive && prop.PropertyType != typeof(string))
+ if (
+ prop.PropertyType.IsClass
+ && !prop.PropertyType.IsPrimitive
+ && prop.PropertyType != typeof(string)
+ )
{
var nestedProps = prop.PropertyType.GetProperties();
foreach (var nestedProp in nestedProps)
@@ -158,8 +181,7 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
public async Task SetAsync<T>(Expression<Func<AppSettings, T>> property, T value)
{
Expression expression = property.Body;
- if (expression is UnaryExpression unary &&
- unary.NodeType == ExpressionType.Convert)
+ if (expression is UnaryExpression unary && unary.NodeType == ExpressionType.Convert)
{
expression = unary.Operand;
}
@@ -167,7 +189,8 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
if (expression is not MemberExpression member)
throw new ArgumentException(
$"The property expression '{property}' must be a simple member access expression such as 'x => x.App.Language'.",
- nameof(property));
+ nameof(property)
+ );
// Build key from property path (e.g., App.Language -> "App:Language")
var keyParts = new List<string>();
var expr = member;
@@ -176,7 +199,8 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
keyParts.Insert(0, expr.Member.Name);
if (expr.Expression is MemberExpression next)
expr = next;
- else break;
+ else
+ break;
}
var key = string.Join(":", keyParts);
@@ -223,7 +247,8 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
for (var i = 0; i < parts.Length - 1; i++)
{
var next = GetTokenIgnoreCase(current, parts[i]);
- if (next is not JObject nextObj) return;
+ if (next is not JObject nextObj)
+ return;
current = nextObj;
}
@@ -276,9 +301,7 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
/// </summary>
private async Task SaveConfigAsync()
{
- await File.WriteAllTextAsync(
- _configPath,
- _cache.ToString(Formatting.Indented));
+ await File.WriteAllTextAsync(_configPath, _cache.ToString(Formatting.Indented));
(configuration as IConfigurationRoot)?.Reload();
}
@@ -310,11 +333,14 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
foreach (var p in current.Properties())
if (string.Equals(p.Name, key, StringComparison.OrdinalIgnoreCase))
{
- if (first == null) first = p;
- else extraNames.Add(p.Name);
+ if (first == null)
+ first = p;
+ else
+ extraNames.Add(p.Name);
}
- foreach (var name in extraNames) current.Remove(name);
+ foreach (var name in extraNames)
+ current.Remove(name);
if (first?.Value is JObject existing)
return existing;
@@ -340,7 +366,8 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
private static void SetValueIgnoreCase(JObject current, string key, string value)
{
// Remove all case-insensitive matches
- var toRemove = current.Properties()
+ var toRemove = current
+ .Properties()
.Where(p => string.Equals(p.Name, key, StringComparison.OrdinalIgnoreCase))
.Select(p => p.Name)
.ToList();
@@ -364,7 +391,8 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
if (string.Equals(p.Name, key, StringComparison.OrdinalIgnoreCase))
toRemove.Add(p.Name);
- foreach (var name in toRemove) current.Remove(name);
+ foreach (var name in toRemove)
+ current.Remove(name);
}
/// <summary>
@@ -388,4 +416,4 @@ public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager>
File.WriteAllText(configPath, "{}");
}
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Services/Configuration/LanguageManager.cs b/optimizerDuck/Services/Configuration/LanguageManager.cs
index a2c0219..b8eb3be 100644
--- a/optimizerDuck/Services/Configuration/LanguageManager.cs
+++ b/optimizerDuck/Services/Configuration/LanguageManager.cs
@@ -34,4 +34,4 @@ public class Loc
{
Translations.Culture = culture;
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Services/Features/Bloatware/BloatwareService.cs b/optimizerDuck/Services/Features/Bloatware/BloatwareService.cs
index 4a7fbfb..7d7f379 100644
--- a/optimizerDuck/Services/Features/Bloatware/BloatwareService.cs
+++ b/optimizerDuck/Services/Features/Bloatware/BloatwareService.cs
@@ -18,11 +18,22 @@ namespace optimizerDuck.Services;
/// <summary>
/// Provides services for discovering and removing AppX bloatware packages.
/// </summary>
-public class BloatwareService(ILogger<BloatwareService> logger, IOptionsMonitor<AppSettings> appOptionsMonitor)
+public class BloatwareService(
+ ILogger<BloatwareService> logger,
+ IOptionsMonitor<AppSettings> appOptionsMonitor
+)
{
- private static readonly ConcurrentDictionary<string, string?> LogoCache = new(StringComparer.OrdinalIgnoreCase);
- private static readonly Regex ScaleRegex = new(@"(?:^|[._])scale-(\d+)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
- private static readonly Regex TargetSizeRegex = new(@"(?:^|[._])targetsize-(\d+)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
+ private static readonly ConcurrentDictionary<string, string?> LogoCache = new(
+ StringComparer.OrdinalIgnoreCase
+ );
+ private static readonly Regex ScaleRegex = new(
+ @"(?:^|[._])scale-(\d+)",
+ RegexOptions.IgnoreCase | RegexOptions.Compiled
+ );
+ private static readonly Regex TargetSizeRegex = new(
+ @"(?:^|[._])targetsize-(\d+)",
+ RegexOptions.IgnoreCase | RegexOptions.Compiled
+ );
private static readonly string[] SupportedImageExtensions = [".png", ".jpg", ".jpeg"];
/// <summary>
@@ -36,39 +47,43 @@ public class BloatwareService(ILogger<BloatwareService> logger, IOptionsMonitor<
var safePattern = string.Join("|", Shared.SafeApps.Select(Regex.Escape));
var cautionPattern = string.Join("|", Shared.CautionApps.Select(Regex.Escape));
- var result = await ShellService.PowerShellAsync($$"""
- $safeRegex = '{{safePattern}}'
- $cautionRegex = '{{cautionPattern}}'
-
- Get-AppxPackage |
- Where-Object {
- $_.NonRemovable -eq $false -and
- $_.IsFramework -eq $false
- } |
- ForEach-Object {
- $risk = "Unknown"
-
- if ($_.Name -match $safeRegex) { $risk = "Safe" }
- elseif ($_.Name -match $cautionRegex) { $risk = "Caution" }
-
- [PSCustomObject]@{
- Name = $_.Name
- PackageFullName = $_.PackageFullName
- Publisher = $_.Publisher
- Version = $_.Version.ToString()
- InstallLocation = if ($_.InstallLocation) { $_.InstallLocation } else { "" }
- Risk = $risk
- }
- } | ConvertTo-Json -Depth 2
- """);
+ var result = await ShellService.PowerShellAsync(
+ $$"""
+ $safeRegex = '{{safePattern}}'
+ $cautionRegex = '{{cautionPattern}}'
+
+ Get-AppxPackage |
+ Where-Object {
+ $_.NonRemovable -eq $false -and
+ $_.IsFramework -eq $false
+ } |
+ ForEach-Object {
+ $risk = "Unknown"
+
+ if ($_.Name -match $safeRegex) { $risk = "Safe" }
+ elseif ($_.Name -match $cautionRegex) { $risk = "Caution" }
+
+ [PSCustomObject]@{
+ Name = $_.Name
+ PackageFullName = $_.PackageFullName
+ Publisher = $_.Publisher
+ Version = $_.Version.ToString()
+ InstallLocation = if ($_.InstallLocation) { $_.InstallLocation } else { "" }
+ Risk = $risk
+ }
+ } | ConvertTo-Json -Depth 2
+ """
+ );
var options = new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true,
- Converters = { new JsonStringEnumConverter() }
+ Converters = { new JsonStringEnumConverter() },
};
- var apps = JsonSerializer.Deserialize<List<AppXPackage>>(result.Stdout, options)!.OrderBy(a => a.Name)
+ var apps = JsonSerializer
+ .Deserialize<List<AppXPackage>>(result.Stdout, options)!
+ .OrderBy(a => a.Name)
.ToList();
foreach (var app in apps)
@@ -110,62 +125,68 @@ public class BloatwareService(ILogger<BloatwareService> logger, IOptionsMonitor<
{
if (string.IsNullOrWhiteSpace(appXPackage.PackageFullName))
{
- logger.LogWarning("Skip removing app because PackageFullName is empty: {Name}", appXPackage.Name);
+ logger.LogWarning(
+ "Skip removing app because PackageFullName is empty: {Name}",
+ appXPackage.Name
+ );
return;
}
- logger.LogInformation("Removing AppX package {Name} ({Package})",
- appXPackage.Name, appXPackage.PackageFullName);
+ logger.LogInformation(
+ "Removing AppX package {Name} ({Package})",
+ appXPackage.Name,
+ appXPackage.PackageFullName
+ );
var script = $$"""
- $pkgFull = "{{appXPackage.PackageFullName}}"
- $name = "{{appXPackage.Name}}"
-
- $installed = Get-AppxPackage -PackageTypeFilter Main,Bundle,Resource |
- Where-Object { $_.PackageFullName -eq $pkgFull -or $_.Name -eq $name }
-
- if (-not $installed) {
- Write-Output "No installed package found for $name"
- } else {
- foreach ($p in $installed) {
- try {
- Remove-AppxPackage -Package $p.PackageFullName -ErrorAction Stop
- Write-Output "Removed: $($p.PackageFullName)"
- } catch {
- Write-Output "Failed: $($p.PackageFullName). Error: $($_.Exception.Message)"
- }
- }
- }
-
- """;
+ $pkgFull = "{{appXPackage.PackageFullName}}"
+ $name = "{{appXPackage.Name}}"
+
+ $installed = Get-AppxPackage -PackageTypeFilter Main,Bundle,Resource |
+ Where-Object { $_.PackageFullName -eq $pkgFull -or $_.Name -eq $name }
+
+ if (-not $installed) {
+ Write-Output "No installed package found for $name"
+ } else {
+ foreach ($p in $installed) {
+ try {
+ Remove-AppxPackage -Package $p.PackageFullName -ErrorAction Stop
+ Write-Output "Removed: $($p.PackageFullName)"
+ } catch {
+ Write-Output "Failed: $($p.PackageFullName). Error: $($_.Exception.Message)"
+ }
+ }
+ }
+
+ """;
if (appOptionsMonitor.CurrentValue.Bloatware.RemoveProvisioned)
script += """
- Write-Output "Searching provisioned package..."
-
- $prov = Get-AppxProvisionedPackage -Online |
- Where-Object { $_.DisplayName -eq $name }
-
- if (-not $prov) {
- Write-Output "Provisioned package not found"
- }
- else {
- foreach ($p in $prov) {
- try {
- Remove-AppxProvisionedPackage -Online -PackageName $p.PackageName -ErrorAction Stop | Out-Null
- Write-Output "Removed provisioned package: $($p.PackageName)"
- }
- catch {
- Write-Output "Failed removing provisioned package: $($p.PackageName). Error: $($_.Exception.Message)"
- }
- }
- }
-
- """;
+ Write-Output "Searching provisioned package..."
+
+ $prov = Get-AppxProvisionedPackage -Online |
+ Where-Object { $_.DisplayName -eq $name }
+
+ if (-not $prov) {
+ Write-Output "Provisioned package not found"
+ }
+ else {
+ foreach ($p in $prov) {
+ try {
+ Remove-AppxProvisionedPackage -Online -PackageName $p.PackageName -ErrorAction Stop | Out-Null
+ Write-Output "Removed provisioned package: $($p.PackageName)"
+ }
+ catch {
+ Write-Output "Failed removing provisioned package: $($p.PackageName). Error: $($_.Exception.Message)"
+ }
+ }
+ }
+
+ """;
else
script += """
- Write-Output "Skipping provisioned package removal (disabled by user)"
- """;
+ Write-Output "Skipping provisioned package removal (disabled by user)"
+ """;
var result = await ShellService.PowerShellAsync(script);
@@ -200,8 +221,11 @@ public class BloatwareService(ILogger<BloatwareService> logger, IOptionsMonitor<
var candidateResources = GetManifestLogoCandidates(installLocation);
foreach (var candidate in candidateResources)
{
- var bestFromCandidate = ResolveBestQualifiedVariant(installLocation, candidate,
- includeThemeSpecific: true);
+ var bestFromCandidate = ResolveBestQualifiedVariant(
+ installLocation,
+ candidate,
+ includeThemeSpecific: true
+ );
if (!string.IsNullOrWhiteSpace(bestFromCandidate))
return bestFromCandidate;
}
@@ -219,13 +243,16 @@ public class BloatwareService(ILogger<BloatwareService> logger, IOptionsMonitor<
@"Assets\MedTile.png",
@"Assets\Square150x150Logo.png",
@"Assets\Logo.png",
- @"Assets\StoreLogo.png"
+ @"Assets\StoreLogo.png",
};
foreach (var fallbackCandidate in fallbackCandidates)
{
- var bestFallback = ResolveBestQualifiedVariant(installLocation, fallbackCandidate,
- includeThemeSpecific: true);
+ var bestFallback = ResolveBestQualifiedVariant(
+ installLocation,
+ fallbackCandidate,
+ includeThemeSpecific: true
+ );
if (!string.IsNullOrWhiteSpace(bestFallback))
return bestFallback;
}
@@ -251,7 +278,8 @@ public class BloatwareService(ILogger<BloatwareService> logger, IOptionsMonitor<
return candidates;
var ns = root.Name.Namespace;
- var visualElements = root.Descendants().FirstOrDefault(e => e.Name.LocalName == "VisualElements");
+ var visualElements = root.Descendants()
+ .FirstOrDefault(e => e.Name.LocalName == "VisualElements");
var defaultTile = root.Descendants().FirstOrDefault(e => e.Name.LocalName == "DefaultTile");
var properties = root.Element(ns + "Properties");
@@ -282,8 +310,11 @@ public class BloatwareService(ILogger<BloatwareService> logger, IOptionsMonitor<
.ToList();
}
- private static string? ResolveBestQualifiedVariant(string installLocation, string resourcePath,
- bool includeThemeSpecific)
+ private static string? ResolveBestQualifiedVariant(
+ string installLocation,
+ string resourcePath,
+ bool includeThemeSpecific
+ )
{
var normalizedResource = resourcePath.Replace('/', '\\').TrimStart('\\');
if (string.IsNullOrWhiteSpace(normalizedResource))
@@ -299,21 +330,32 @@ public class BloatwareService(ILogger<BloatwareService> logger, IOptionsMonitor<
var resourceFileName = Path.GetFileName(normalizedResource);
var extension = Path.GetExtension(resourceFileName);
- if (!string.IsNullOrWhiteSpace(extension) &&
- !SupportedImageExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
+ if (
+ !string.IsNullOrWhiteSpace(extension)
+ && !SupportedImageExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase)
+ )
return null;
var baseResourceName = Path.GetFileNameWithoutExtension(resourceFileName);
var baseNameWithoutQualifiers = StripKnownQualifiers(baseResourceName);
var preferredLogicalSize = GuessLogicalBaseSize(baseNameWithoutQualifiers);
- var files = Directory.EnumerateFiles(candidateDirectory, "*.*", SearchOption.TopDirectoryOnly)
- .Where(path => SupportedImageExtensions.Contains(Path.GetExtension(path), StringComparer.OrdinalIgnoreCase))
+ var files = Directory
+ .EnumerateFiles(candidateDirectory, "*.*", SearchOption.TopDirectoryOnly)
+ .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);
+ return stripped.Equals(
+ baseNameWithoutQualifiers,
+ StringComparison.OrdinalIgnoreCase
+ );
})
.Select(path => new LogoVariant(path, preferredLogicalSize, includeThemeSpecific))
.OrderByDescending(v => v.SortScore)
@@ -324,30 +366,41 @@ public class BloatwareService(ILogger<BloatwareService> logger, IOptionsMonitor<
private static string StripKnownQualifiers(string fileNameWithoutExtension)
{
- return Regex.Replace(
- fileNameWithoutExtension,
- @"(?:[._](?:scale|targetsize)-\d+|_[^._]+)+$",
- string.Empty,
- RegexOptions.IgnoreCase).TrimEnd('.', '_');
+ return Regex
+ .Replace(
+ fileNameWithoutExtension,
+ @"(?:[._](?:scale|targetsize)-\d+|_[^._]+)+$",
+ string.Empty,
+ RegexOptions.IgnoreCase
+ )
+ .TrimEnd('.', '_');
}
private static int GuessLogicalBaseSize(string baseName)
{
- if (baseName.Contains("applist", StringComparison.OrdinalIgnoreCase) ||
- baseName.Contains("square44x44", StringComparison.OrdinalIgnoreCase) ||
- baseName.Contains("smalltile", StringComparison.OrdinalIgnoreCase))
+ if (
+ baseName.Contains("applist", StringComparison.OrdinalIgnoreCase)
+ || baseName.Contains("square44x44", StringComparison.OrdinalIgnoreCase)
+ || baseName.Contains("smalltile", StringComparison.OrdinalIgnoreCase)
+ )
return 44;
- if (baseName.Contains("medtile", StringComparison.OrdinalIgnoreCase) ||
- baseName.Contains("square150x150", StringComparison.OrdinalIgnoreCase))
+ if (
+ baseName.Contains("medtile", StringComparison.OrdinalIgnoreCase)
+ || baseName.Contains("square150x150", StringComparison.OrdinalIgnoreCase)
+ )
return 150;
- if (baseName.Contains("widetile", StringComparison.OrdinalIgnoreCase) ||
- baseName.Contains("wide310x150", StringComparison.OrdinalIgnoreCase))
+ if (
+ baseName.Contains("widetile", StringComparison.OrdinalIgnoreCase)
+ || baseName.Contains("wide310x150", StringComparison.OrdinalIgnoreCase)
+ )
return 150;
- if (baseName.Contains("large", StringComparison.OrdinalIgnoreCase) ||
- baseName.Contains("square310x310", StringComparison.OrdinalIgnoreCase))
+ if (
+ baseName.Contains("large", StringComparison.OrdinalIgnoreCase)
+ || baseName.Contains("square310x310", StringComparison.OrdinalIgnoreCase)
+ )
return 310;
if (baseName.Contains("storelogo", StringComparison.OrdinalIgnoreCase))
@@ -366,7 +419,8 @@ public class BloatwareService(ILogger<BloatwareService> logger, IOptionsMonitor<
var targetSize = TryGetQualifierNumber(TargetSizeRegex, fileNameWithoutExtension);
var scale = TryGetQualifierNumber(ScaleRegex, fileNameWithoutExtension);
- var resolvedPixelSize = targetSize
+ var resolvedPixelSize =
+ targetSize
?? (scale.HasValue ? logicalBaseSize * scale.Value / 100 : logicalBaseSize);
var score = 0;
@@ -383,9 +437,19 @@ public class BloatwareService(ILogger<BloatwareService> logger, IOptionsMonitor<
if (includeThemeSpecific)
{
- if (fileNameWithoutExtension.Contains("_altform-unplated", StringComparison.OrdinalIgnoreCase))
+ if (
+ fileNameWithoutExtension.Contains(
+ "_altform-unplated",
+ StringComparison.OrdinalIgnoreCase
+ )
+ )
score += 120;
- if (fileNameWithoutExtension.Contains("_altform-lightunplated", StringComparison.OrdinalIgnoreCase))
+ if (
+ fileNameWithoutExtension.Contains(
+ "_altform-lightunplated",
+ StringComparison.OrdinalIgnoreCase
+ )
+ )
score += 110;
}
diff --git a/optimizerDuck/Services/Features/DiskCleanup/DiskCleanupService.cs b/optimizerDuck/Services/Features/DiskCleanup/DiskCleanupService.cs
index 421b477..a5d82ea 100644
--- a/optimizerDuck/Services/Features/DiskCleanup/DiskCleanupService.cs
+++ b/optimizerDuck/Services/Features/DiskCleanup/DiskCleanupService.cs
@@ -1,7 +1,7 @@
-using Microsoft.Extensions.Logging;
+using System.IO;
+using Microsoft.Extensions.Logging;
using optimizerDuck.Resources.Languages;
using optimizerDuck.Services.OptimizationServices;
-using System.IO;
using Wpf.Ui.Controls;
using CleanupItem = optimizerDuck.Domain.Optimizations.Models.Cleanup.CleanupItem;
@@ -19,10 +19,11 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
public static List<CleanupItem> GetCleanupItems()
{
var windowsDir = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
- var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
+ var localAppData = Environment.GetFolderPath(
+ Environment.SpecialFolder.LocalApplicationData
+ );
var systemDrive = Path.GetPathRoot(windowsDir) ?? "C:\\";
-
return
[
new CleanupItem
@@ -31,7 +32,7 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
Name = Translations.DiskCleanup_Item_TempFiles,
Description = Translations.DiskCleanup_Item_TempFiles_Description,
Path = Path.GetTempPath(),
- Icon = SymbolRegular.Document24
+ Icon = SymbolRegular.Document24,
},
new CleanupItem
{
@@ -39,7 +40,7 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
Name = Translations.DiskCleanup_Item_SystemTemp,
Description = Translations.DiskCleanup_Item_SystemTemp_Description,
Path = Path.Combine(windowsDir, "Temp"),
- Icon = SymbolRegular.DocumentError24
+ Icon = SymbolRegular.DocumentError24,
},
new CleanupItem
{
@@ -47,7 +48,7 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
Name = Translations.DiskCleanup_Item_WindowsUpdate,
Description = Translations.DiskCleanup_Item_WindowsUpdate_Description,
Path = Path.Combine(windowsDir, @"SoftwareDistribution\Download"),
- Icon = SymbolRegular.ArrowDownload24
+ Icon = SymbolRegular.ArrowDownload24,
},
new CleanupItem
{
@@ -55,7 +56,7 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
Name = Translations.DiskCleanup_Item_Prefetch,
Description = Translations.DiskCleanup_Item_Prefetch_Description,
Path = Path.Combine(windowsDir, "Prefetch"),
- Icon = SymbolRegular.Flash24
+ Icon = SymbolRegular.Flash24,
},
new CleanupItem
{
@@ -63,7 +64,7 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
Name = Translations.DiskCleanup_Item_Thumbnails,
Description = Translations.DiskCleanup_Item_Thumbnails_Description,
Path = Path.Combine(localAppData, @"Microsoft\Windows\Explorer"),
- Icon = SymbolRegular.Image24
+ Icon = SymbolRegular.Image24,
},
new CleanupItem
{
@@ -72,7 +73,7 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
Description = Translations.DiskCleanup_Item_RecycleBin_Description,
Path = "Clear-RecycleBin -Force -ErrorAction SilentlyContinue",
Icon = SymbolRegular.Delete24,
- IsCommand = true
+ IsCommand = true,
},
new CleanupItem
{
@@ -80,7 +81,7 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
Name = Translations.DiskCleanup_Item_ErrorReports,
Description = Translations.DiskCleanup_Item_ErrorReports_Description,
Path = Path.Combine(localAppData, "CrashDumps"),
- Icon = SymbolRegular.Bug24
+ Icon = SymbolRegular.Bug24,
},
new CleanupItem
{
@@ -88,8 +89,8 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
Name = Translations.DiskCleanup_Item_OldWindowsInstallation,
Description = Translations.DiskCleanup_Item_OldWindowsInstallation_Description,
Path = Path.Combine(systemDrive, "Windows.old"),
- Icon = SymbolRegular.Building24
- }
+ Icon = SymbolRegular.Building24,
+ },
];
}
@@ -107,19 +108,22 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
// For RecycleBin, estimate size via PowerShell
if (item.Id == "RecycleBin")
{
- var script = "$items = (New-Object -ComObject Shell.Application).NameSpace(0xA).Items(); " +
- "if ($null -ne $items) { " +
- " $measure = $items | Measure-Object -Property Size -Sum; " +
- " $sum = if ($null -ne $measure.Sum) { $measure.Sum } else { 0 }; " +
- " $count = if ($null -ne $items.Count) { $items.Count } else { 0 }; " +
- " Write-Output \"$sum|$count\" " +
- "} else { Write-Output '0|0' }";
+ var script =
+ "$items = (New-Object -ComObject Shell.Application).NameSpace(0xA).Items(); "
+ + "if ($null -ne $items) { "
+ + " $measure = $items | Measure-Object -Property Size -Sum; "
+ + " $sum = if ($null -ne $measure.Sum) { $measure.Sum } else { 0 }; "
+ + " $count = if ($null -ne $items.Count) { $items.Count } else { 0 }; "
+ + " Write-Output \"$sum|$count\" "
+ + "} else { Write-Output '0|0' }";
var result = await ShellService.PowerShellAsync(script);
var parts = result.Stdout.Trim().Split('|');
- if (parts.Length == 2 &&
- long.TryParse(parts[0], out var size) &&
- long.TryParse(parts[1], out var count))
+ if (
+ parts.Length == 2
+ && long.TryParse(parts[0], out var size)
+ && long.TryParse(parts[1], out var count)
+ )
{
item.SizeBytes = size;
item.FileCount = count;
@@ -179,15 +183,21 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
var sizeBefore = item.SizeBytes;
await ShellService.PowerShellAsync(item.Path);
freedBytes = sizeBefore;
- logger.LogInformation("Cleaned {ItemId} via command, freed ~{Size}",
- item.Id, CleanupItem.FormatBytes(freedBytes));
+ logger.LogInformation(
+ "Cleaned {ItemId} via command, freed ~{Size}",
+ item.Id,
+ CleanupItem.FormatBytes(freedBytes)
+ );
}
else
{
freedBytes = await Task.Run(() => DeleteFilesInDirectory(item.Path, item.Id));
item.SizeBytes = Math.Max(0, item.SizeBytes - freedBytes);
- logger.LogInformation("Cleaned {ItemId}, freed {Size}",
- item.Id, CleanupItem.FormatBytes(freedBytes));
+ logger.LogInformation(
+ "Cleaned {ItemId}, freed {Size}",
+ item.Id,
+ CleanupItem.FormatBytes(freedBytes)
+ );
}
}
catch (Exception ex)
@@ -230,12 +240,13 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
{
IgnoreInaccessible = true,
RecurseSubdirectories = itemId != "Thumbnails",
- ReturnSpecialDirectories = false
+ ReturnSpecialDirectories = false,
};
var dirInfo = new DirectoryInfo(path);
- var dotNetTempPath = Path.GetFullPath(Path.Combine(Path.GetTempPath(), ".net"))
- .TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;
+ var dotNetTempPath =
+ Path.GetFullPath(Path.Combine(Path.GetTempPath(), ".net"))
+ .TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;
foreach (var fileInfo in dirInfo.EnumerateFiles(searchPattern, options))
try
@@ -244,9 +255,16 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
if (options.RecurseSubdirectories)
{
var fullDirPath = fileInfo.DirectoryName ?? string.Empty;
- fullDirPath = fullDirPath.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;
+ fullDirPath =
+ fullDirPath.TrimEnd(Path.DirectorySeparatorChar)
+ + Path.DirectorySeparatorChar;
- if (fullDirPath.StartsWith(dotNetTempPath, StringComparison.OrdinalIgnoreCase))
+ if (
+ fullDirPath.StartsWith(
+ dotNetTempPath,
+ StringComparison.OrdinalIgnoreCase
+ )
+ )
continue;
}
@@ -273,14 +291,15 @@ 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 dotNetTempPath =
+ Path.GetFullPath(Path.Combine(Path.GetTempPath(), ".net"))
+ .TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;
var searchPattern = itemId == "Thumbnails" ? "thumbcache_*" : "*";
var options = new EnumerationOptions
{
IgnoreInaccessible = true,
RecurseSubdirectories = itemId != "Thumbnails",
- ReturnSpecialDirectories = false
+ ReturnSpecialDirectories = false,
};
var dirInfo = new DirectoryInfo(path);
@@ -292,7 +311,9 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
if (options.RecurseSubdirectories)
{
var fullDirPath = fileInfo.DirectoryName ?? string.Empty;
- fullDirPath = fullDirPath.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;
+ fullDirPath =
+ fullDirPath.TrimEnd(Path.DirectorySeparatorChar)
+ + Path.DirectorySeparatorChar;
if (fullDirPath.StartsWith(dotNetTempPath, StringComparison.OrdinalIgnoreCase))
continue;
@@ -314,18 +335,21 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
{
IgnoreInaccessible = true,
RecurseSubdirectories = true,
- ReturnSpecialDirectories = false
+ ReturnSpecialDirectories = false,
};
// Order by descending length to process deepest children first
- var dirs = dirInfo.EnumerateDirectories("*", dirOptions)
+ var dirs = dirInfo
+ .EnumerateDirectories("*", dirOptions)
.OrderByDescending(d => d.FullName.Length)
.ToList();
foreach (var dir in dirs)
try
{
- var fullDir = dir.FullName.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;
+ var fullDir =
+ dir.FullName.TrimEnd(Path.DirectorySeparatorChar)
+ + Path.DirectorySeparatorChar;
if (fullDir.StartsWith(dotNetTempPath, StringComparison.OrdinalIgnoreCase))
continue;
@@ -339,4 +363,4 @@ public class DiskCleanupService(ILogger<DiskCleanupService> logger)
return freed;
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Services/Features/FeatureRegistry.cs b/optimizerDuck/Services/Features/FeatureRegistry.cs
index 8683d9c..1d492ca 100644
--- a/optimizerDuck/Services/Features/FeatureRegistry.cs
+++ b/optimizerDuck/Services/Features/FeatureRegistry.cs
@@ -38,8 +38,10 @@ public class FeatureRegistry
var instance = (IFeatureCategory)Activator.CreateInstance(t)!;
- var featuresProp = t.GetProperty(nameof(IFeatureCategory.Features),
- BindingFlags.Public | BindingFlags.Instance);
+ var featuresProp = t.GetProperty(
+ nameof(IFeatureCategory.Features),
+ BindingFlags.Public | BindingFlags.Instance
+ );
if (featuresProp != null && featuresProp.CanWrite)
featuresProp.SetValue(instance, features);
@@ -55,13 +57,18 @@ public class FeatureRegistry
public IEnumerable<NavigationViewItem> GetNavigationItems()
{
- if (Categories.Length == 0) RegisterCategories();
+ if (Categories.Length == 0)
+ RegisterCategories();
- return Categories.Select(c => new NavigationViewItem
- {
- Content = c.Name,
- TargetPageType = c.GetType().GetCustomAttribute<FeatureCategoryAttribute>()?.PageType,
- TargetPageTag = c.GetType().Name
- }).Where(item => item.TargetPageType != null);
+ return Categories
+ .Select(c => new NavigationViewItem
+ {
+ Content = c.Name,
+ TargetPageType = c.GetType()
+ .GetCustomAttribute<FeatureCategoryAttribute>()
+ ?.PageType,
+ TargetPageTag = c.GetType().Name,
+ })
+ .Where(item => item.TargetPageType != null);
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Services/Features/StartupManager/StartupManagerService.cs b/optimizerDuck/Services/Features/StartupManager/StartupManagerService.cs
index f8615a5..bf32592 100644
--- a/optimizerDuck/Services/Features/StartupManager/StartupManagerService.cs
+++ b/optimizerDuck/Services/Features/StartupManager/StartupManagerService.cs
@@ -22,14 +22,30 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
await Task.Run(() =>
{
// 1. Registry
- ScanRegistryKey(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Run",
- StartupAppLocation.RegistryHKCURun, apps);
- ScanRegistryKey(Registry.LocalMachine, @"Software\Microsoft\Windows\CurrentVersion\Run",
- StartupAppLocation.RegistryHKLMRun, apps);
- ScanRegistryKey(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\RunOnce",
- StartupAppLocation.RegistryHKCURunOnce, apps);
- ScanRegistryKey(Registry.LocalMachine, @"Software\Microsoft\Windows\CurrentVersion\RunOnce",
- StartupAppLocation.RegistryHKLMRunOnce, apps);
+ ScanRegistryKey(
+ Registry.CurrentUser,
+ @"Software\Microsoft\Windows\CurrentVersion\Run",
+ StartupAppLocation.RegistryHKCURun,
+ apps
+ );
+ ScanRegistryKey(
+ Registry.LocalMachine,
+ @"Software\Microsoft\Windows\CurrentVersion\Run",
+ StartupAppLocation.RegistryHKLMRun,
+ apps
+ );
+ ScanRegistryKey(
+ Registry.CurrentUser,
+ @"Software\Microsoft\Windows\CurrentVersion\RunOnce",
+ StartupAppLocation.RegistryHKCURunOnce,
+ apps
+ );
+ ScanRegistryKey(
+ Registry.LocalMachine,
+ @"Software\Microsoft\Windows\CurrentVersion\RunOnce",
+ StartupAppLocation.RegistryHKLMRunOnce,
+ apps
+ );
// 2. Startup Folders
var userStartup = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
@@ -39,35 +55,50 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
ScanDirectory(commonStartup, StartupAppLocation.CommonStartupFolder, apps);
// Parallel fetch expensive info (Icons, File version info)
- Parallel.ForEach(apps, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }, app =>
- {
- var appInfo = GetAppInfo(app.Command);
- var publisher = !string.IsNullOrWhiteSpace(appInfo.Publisher) ? appInfo.Publisher : appInfo.Description;
- if (string.IsNullOrWhiteSpace(publisher))
- publisher = app.Location is StartupAppLocation.UserStartupFolder
- or StartupAppLocation.CommonStartupFolder
- ? "Folder Shortcut"
- : "Registry";
-
- app.Publisher = publisher;
- app.FilePath = appInfo.FilePath;
- app.LogoImage = ExtractIcon(app.Command);
- });
+ Parallel.ForEach(
+ apps,
+ new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount },
+ app =>
+ {
+ var appInfo = GetAppInfo(app.Command);
+ var publisher = !string.IsNullOrWhiteSpace(appInfo.Publisher)
+ ? appInfo.Publisher
+ : appInfo.Description;
+ if (string.IsNullOrWhiteSpace(publisher))
+ publisher = app.Location
+ is StartupAppLocation.UserStartupFolder
+ or StartupAppLocation.CommonStartupFolder
+ ? "Folder Shortcut"
+ : "Registry";
+
+ app.Publisher = publisher;
+ app.FilePath = appInfo.FilePath;
+ app.LogoImage = ExtractIcon(app.Command);
+ }
+ );
});
return apps.OrderBy(a => a.Name).ToList();
}
- private void ScanRegistryKey(RegistryKey rootKey, string subKeyPath, StartupAppLocation location,
- List<StartupApp> apps)
+ private void ScanRegistryKey(
+ RegistryKey rootKey,
+ string subKeyPath,
+ StartupAppLocation location,
+ List<StartupApp> apps
+ )
{
try
{
using var key = rootKey.OpenSubKey(subKeyPath);
- if (key == null) return;
+ if (key == null)
+ return;
// Determine the StartupApproved path based on Run vs RunOnce
- var approvedSubKeyPath = subKeyPath.Contains("RunOnce", StringComparison.OrdinalIgnoreCase)
+ var approvedSubKeyPath = subKeyPath.Contains(
+ "RunOnce",
+ StringComparison.OrdinalIgnoreCase
+ )
? @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\RunOnce"
: @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run";
@@ -78,15 +109,17 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
var command = key.GetValue(valueName)?.ToString() ?? string.Empty;
var isEnabled = IsStartupApproved(approvedKey, valueName);
- apps.Add(new StartupApp
- {
- Name = valueName,
- Command = command,
- Location = location,
- PathOrKey = $@"{rootKey.Name}\{subKeyPath}",
- OriginalValueNameOrFileName = valueName,
- IsEnabled = isEnabled
- });
+ apps.Add(
+ new StartupApp
+ {
+ Name = valueName,
+ Command = command,
+ Location = location,
+ PathOrKey = $@"{rootKey.Name}\{subKeyPath}",
+ OriginalValueNameOrFileName = valueName,
+ IsEnabled = isEnabled,
+ }
+ );
}
}
catch (Exception ex)
@@ -102,7 +135,8 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
/// </summary>
private static bool IsStartupApproved(RegistryKey? approvedKey, string valueName)
{
- if (approvedKey == null) return true;
+ if (approvedKey == null)
+ return true;
try
{
@@ -120,14 +154,16 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
private void ScanDirectory(string dirPath, StartupAppLocation location, List<StartupApp> apps)
{
- if (string.IsNullOrWhiteSpace(dirPath) || !Directory.Exists(dirPath)) return;
+ if (string.IsNullOrWhiteSpace(dirPath) || !Directory.Exists(dirPath))
+ return;
try
{
// Determine registry root key based on folder location
- var rootKey = location == StartupAppLocation.CommonStartupFolder
- ? Registry.LocalMachine
- : Registry.CurrentUser;
+ var rootKey =
+ location == StartupAppLocation.CommonStartupFolder
+ ? Registry.LocalMachine
+ : Registry.CurrentUser;
const string approvedSubKeyPath =
@"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\StartupFolder";
@@ -138,20 +174,23 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
var fileName = Path.GetFileName(file);
// Hide pure .ini files like desktop.ini
- if (fileName.Equals("desktop.ini", StringComparison.OrdinalIgnoreCase)) continue;
+ if (fileName.Equals("desktop.ini", StringComparison.OrdinalIgnoreCase))
+ continue;
var isEnabled = IsStartupApproved(approvedKey, fileName);
var name = Path.GetFileNameWithoutExtension(fileName);
- apps.Add(new StartupApp
- {
- Name = string.IsNullOrWhiteSpace(name) ? fileName : name,
- Command = file,
- Location = location,
- PathOrKey = dirPath,
- OriginalValueNameOrFileName = fileName,
- IsEnabled = isEnabled
- });
+ apps.Add(
+ new StartupApp
+ {
+ Name = string.IsNullOrWhiteSpace(name) ? fileName : name,
+ Command = file,
+ Location = location,
+ PathOrKey = dirPath,
+ OriginalValueNameOrFileName = fileName,
+ IsEnabled = isEnabled,
+ }
+ );
}
}
catch (Exception ex)
@@ -166,8 +205,13 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
{
try
{
- if (app.Location is StartupAppLocation.RegistryHKCURun or StartupAppLocation.RegistryHKLMRun
- or StartupAppLocation.RegistryHKCURunOnce or StartupAppLocation.RegistryHKLMRunOnce)
+ if (
+ app.Location
+ is StartupAppLocation.RegistryHKCURun
+ or StartupAppLocation.RegistryHKLMRun
+ or StartupAppLocation.RegistryHKCURunOnce
+ or StartupAppLocation.RegistryHKLMRunOnce
+ )
ToggleRegistryStartupApp(app, enable);
else // Folders
ToggleFolderStartupApp(app, enable);
@@ -185,26 +229,31 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
{
// Parse RootKey and SubKey from app.PathOrKey
var firstSlash = app.PathOrKey.IndexOf('\\');
- if (firstSlash < 0) return;
+ if (firstSlash < 0)
+ return;
var rootKeyStr = app.PathOrKey[..firstSlash];
var rootKey = rootKeyStr switch
{
"HKEY_CURRENT_USER" => Registry.CurrentUser,
"HKEY_LOCAL_MACHINE" => Registry.LocalMachine,
- _ => null
+ _ => null,
};
- if (rootKey == null) return;
+ if (rootKey == null)
+ return;
// Write enable/disable to StartupApproved\Run
var isRunOnce =
- app.Location is StartupAppLocation.RegistryHKCURunOnce or StartupAppLocation.RegistryHKLMRunOnce;
+ app.Location
+ is StartupAppLocation.RegistryHKCURunOnce
+ or StartupAppLocation.RegistryHKLMRunOnce;
var approvedSubKeyPath = isRunOnce
? @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\RunOnce"
: @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run";
- using var approvedKey = rootKey.OpenSubKey(approvedSubKeyPath, true)
- ?? rootKey.CreateSubKey(approvedSubKeyPath, true);
+ using var approvedKey =
+ rootKey.OpenSubKey(approvedSubKeyPath, true)
+ ?? rootKey.CreateSubKey(approvedSubKeyPath, true);
// Binary format: 12 bytes. First 4 bytes = status flag, rest = timestamp (zeros for manual toggle)
var data = new byte[12];
@@ -214,14 +263,16 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
private static void ToggleFolderStartupApp(StartupApp app, bool enable)
{
- var rootKey = app.Location == StartupAppLocation.CommonStartupFolder
- ? Registry.LocalMachine
- : Registry.CurrentUser;
+ var rootKey =
+ app.Location == StartupAppLocation.CommonStartupFolder
+ ? Registry.LocalMachine
+ : Registry.CurrentUser;
const string approvedSubKeyPath =
@"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\StartupFolder";
- using var approvedKey = rootKey.OpenSubKey(approvedSubKeyPath, true)
- ?? rootKey.CreateSubKey(approvedSubKeyPath, true);
+ using var approvedKey =
+ rootKey.OpenSubKey(approvedSubKeyPath, true)
+ ?? rootKey.CreateSubKey(approvedSubKeyPath, true);
var data = new byte[12];
data[0] = enable ? (byte)0x02 : (byte)0x03;
@@ -235,24 +286,30 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
try
{
var models = ScheduledTaskService.GetStartupTasks();
- var tasks = models.Select(m => new StartupTask
- {
- TaskName = m.Name,
- TaskPath = m.Path,
- Description = m.Description,
- TriggerSummary = m.TriggerSummary,
- TriggerTypes = [.. m.TriggerTypes],
- ActionSummary = m.ActionSummary,
- IsEnabled = m.IsEnabled
- }).OrderBy(t => t.TaskName).ToList();
+ var tasks = models
+ .Select(m => new StartupTask
+ {
+ TaskName = m.Name,
+ TaskPath = m.Path,
+ Description = m.Description,
+ TriggerSummary = m.TriggerSummary,
+ TriggerTypes = [.. m.TriggerTypes],
+ ActionSummary = m.ActionSummary,
+ IsEnabled = m.IsEnabled,
+ })
+ .OrderBy(t => t.TaskName)
+ .ToList();
// Extract icons from task commands
- Parallel.ForEach(tasks, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount },
+ Parallel.ForEach(
+ tasks,
+ new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount },
task =>
{
if (!string.IsNullOrWhiteSpace(task.ActionSummary))
task.LogoImage = ExtractIcon(task.ActionSummary);
- });
+ }
+ );
return tasks;
}
@@ -299,7 +356,8 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
// shortcut/command paths using them can be resolved to the actual executable for icon extraction.
path = Environment.ExpandEnvironmentVariables(path);
var exeIdx = path.IndexOf(".exe", StringComparison.OrdinalIgnoreCase);
- if (exeIdx > 0) path = path[..(exeIdx + 4)].Trim('\"', ' ', '\'');
+ if (exeIdx > 0)
+ path = path[..(exeIdx + 4)].Trim('\"', ' ', '\'');
if (!File.Exists(path))
{
@@ -322,7 +380,8 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
var imageSource = Imaging.CreateBitmapSourceFromHIcon(
icon.Handle,
Int32Rect.Empty,
- BitmapSizeOptions.FromEmptyOptions());
+ BitmapSizeOptions.FromEmptyOptions()
+ );
imageSource.Freeze(); // Crucial for cross-thread access
return imageSource;
}
@@ -360,7 +419,8 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
{
var path = command.Trim('\"');
var exeIdx = path.IndexOf(".exe", StringComparison.OrdinalIgnoreCase);
- if (exeIdx > 0) path = path[..(exeIdx + 4)].Trim('\"', ' ', '\'');
+ if (exeIdx > 0)
+ path = path[..(exeIdx + 4)].Trim('\"', ' ', '\'');
if (!File.Exists(path))
if (!path.Contains('\\') && !path.Contains('/'))
@@ -379,4 +439,4 @@ public class StartupManagerService(ILogger<StartupManagerService> logger)
return (null, null, null);
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Services/Optimization/OptimizationRegistry.cs b/optimizerDuck/Services/Optimization/OptimizationRegistry.cs
index 5e7d8f8..0946575 100644
--- a/optimizerDuck/Services/Optimization/OptimizationRegistry.cs
+++ b/optimizerDuck/Services/Optimization/OptimizationRegistry.cs
@@ -38,8 +38,10 @@ public class OptimizationRegistry(ILoggerFactory loggerFactory)
var instance = (IOptimizationCategory)Activator.CreateInstance(t)!;
- var optProp = t.GetProperty(nameof(IOptimizationCategory.Optimizations),
- BindingFlags.Public | BindingFlags.Instance);
+ var optProp = t.GetProperty(
+ nameof(IOptimizationCategory.Optimizations),
+ BindingFlags.Public | BindingFlags.Instance
+ );
if (optProp != null && optProp.CanWrite)
optProp.SetValue(instance, optimizations);
@@ -50,11 +52,15 @@ public class OptimizationRegistry(ILoggerFactory loggerFactory)
.OrderBy(c => c.Order)
.ToArray();
- _logger.LogInformation("Total {CategoryCount} categories and {OptimizationCount} optimizations found",
- optimizationCategories.Length, optimizationCategories.Sum(c => c.Optimizations.Count));
-
- await OptimizationService.UpdateOptimizationStateAsync(optimizationCategories.SelectMany(c => c.Optimizations));
+ _logger.LogInformation(
+ "Total {CategoryCount} categories and {OptimizationCount} optimizations found",
+ optimizationCategories.Length,
+ optimizationCategories.Sum(c => c.Optimizations.Count)
+ );
+ await OptimizationService.UpdateOptimizationStateAsync(
+ optimizationCategories.SelectMany(c => c.Optimizations)
+ );
OptimizationCategories = optimizationCategories;
}
@@ -63,4 +69,4 @@ public class OptimizationRegistry(ILoggerFactory loggerFactory)
{
return OptimizationCategories.First(c => c.GetType() == type);
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Services/Optimization/OptimizationService.cs b/optimizerDuck/Services/Optimization/OptimizationService.cs
index f62a59b..7e21053 100644
--- a/optimizerDuck/Services/Optimization/OptimizationService.cs
+++ b/optimizerDuck/Services/Optimization/OptimizationService.cs
@@ -10,8 +10,8 @@ using optimizerDuck.Domain.UI;
using optimizerDuck.Resources.Languages;
using optimizerDuck.Services.Managers;
using optimizerDuck.Services.OptimizationServices;
-using optimizerDuck.UI.ViewModels.Dialogs;
using optimizerDuck.UI.Dialogs;
+using optimizerDuck.UI.ViewModels.Dialogs;
using Wpf.Ui;
using Wpf.Ui.Controls;
@@ -23,7 +23,8 @@ public class OptimizationService(
SystemInfoService systemInfoService,
StreamService streamService,
IContentDialogService contentDialogService,
- ILogger<OptimizationService> logger)
+ ILogger<OptimizationService> logger
+)
{
private readonly ILogger _logger = logger;
@@ -38,26 +39,33 @@ public class OptimizationService(
{
Title = Translations.RestorePoint_Title,
Content = dialogContent,
- IsFooterVisible = false
+ IsFooterVisible = false,
};
_ = contentDialogService.ShowAsync(dialog, CancellationToken.None);
try
{
- dialogViewModel.ProgressReporter.Report(new ProcessingProgress
- {
- Message = Translations.RestorePoint_Progress_Creating,
- IsIndeterminate = true
- });
+ dialogViewModel.ProgressReporter.Report(
+ new ProcessingProgress
+ {
+ Message = Translations.RestorePoint_Progress_Creating,
+ IsIndeterminate = true,
+ }
+ );
using var scope = ExecutionScope.BeginForLogging(_logger);
var result = await ShellService.PowerShellAsync(
- $"Checkpoint-Computer -Description \"{Shared.RestorePointName}\" -RestorePointType MODIFY_SETTINGS");
-
- if (result.Stderr.Contains("already been created within the past",
- StringComparison.OrdinalIgnoreCase))
+ $"Checkpoint-Computer -Description \"{Shared.RestorePointName}\" -RestorePointType MODIFY_SETTINGS"
+ );
+
+ if (
+ result.Stderr.Contains(
+ "already been created within the past",
+ StringComparison.OrdinalIgnoreCase
+ )
+ )
{
_logger.LogWarning("Restore point creation skipped: frequency limit reached.");
return RestorePointResult.FrequencyLimitReached;
@@ -66,32 +74,57 @@ public class OptimizationService(
if (result.ExitCode == 0)
return RestorePointResult.Success;
- if (!Regex.IsMatch(result.Stderr,
+ if (
+ !Regex.IsMatch(
+ result.Stderr,
@"\b(is\s+disabled|system\s+restore\s+is\s+disabled|disabled\s+by\s+group\s+policy|disableconfig|disablesr|protection\s+is\s+off)\b",
- RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
+ RegexOptions.IgnoreCase | RegexOptions.CultureInvariant
+ )
+ )
{
_logger.LogError("Failed to create restore point: {Message}", result.Stderr);
return RestorePointResult.Failed;
}
_logger.LogInformation("Enabling System Protection...");
- dialogViewModel.ProgressReporter.Report(new ProcessingProgress
- { Message = Translations.RestorePoint_Progress_Enabling, IsIndeterminate = true });
+ dialogViewModel.ProgressReporter.Report(
+ new ProcessingProgress
+ {
+ Message = Translations.RestorePoint_Progress_Enabling,
+ IsIndeterminate = true,
+ }
+ );
- var enableResult = await ShellService.PowerShellAsync("Enable-ComputerRestore -Drive \"$env:SystemDrive\"");
+ var enableResult = await ShellService.PowerShellAsync(
+ "Enable-ComputerRestore -Drive \"$env:SystemDrive\""
+ );
if (enableResult.ExitCode != 0)
{
- _logger.LogError("Failed to enable System Protection: {Message}", enableResult.Stderr);
+ _logger.LogError(
+ "Failed to enable System Protection: {Message}",
+ enableResult.Stderr
+ );
return RestorePointResult.Failed;
}
- dialogViewModel.ProgressReporter.Report(new ProcessingProgress
- { Message = Translations.RestorePoint_Progress_Retrying, IsIndeterminate = true });
+ dialogViewModel.ProgressReporter.Report(
+ new ProcessingProgress
+ {
+ Message = Translations.RestorePoint_Progress_Retrying,
+ IsIndeterminate = true,
+ }
+ );
result = await ShellService.PowerShellAsync(
- $"Checkpoint-Computer -Description \"{Shared.RestorePointName}\" -RestorePointType MODIFY_SETTINGS");
-
- if (result.Stderr.Contains("already been created within the past", StringComparison.OrdinalIgnoreCase))
+ $"Checkpoint-Computer -Description \"{Shared.RestorePointName}\" -RestorePointType MODIFY_SETTINGS"
+ );
+
+ if (
+ result.Stderr.Contains(
+ "already been created within the past",
+ StringComparison.OrdinalIgnoreCase
+ )
+ )
return RestorePointResult.FrequencyLimitReached;
return result.ExitCode == 0 ? RestorePointResult.Success : RestorePointResult.Failed;
@@ -102,34 +135,53 @@ public class OptimizationService(
}
}
- public async Task<OptimizationResult> ApplyAsync(IOptimization optimization, IProgress<ProcessingProgress> progress)
+ public async Task<OptimizationResult> ApplyAsync(
+ IOptimization optimization,
+ IProgress<ProcessingProgress> progress
+ )
{
var optLogger = loggerFactory.CreateLogger(optimization.GetType());
using var scope = ExecutionScope.Begin(optimization, optLogger);
- progress.Report(new ProcessingProgress
- { Message = Translations.Optimization_Apply_Processing, IsIndeterminate = true });
+ progress.Report(
+ new ProcessingProgress
+ {
+ Message = Translations.Optimization_Apply_Processing,
+ IsIndeterminate = true,
+ }
+ );
try
{
var applyResult = await Task.Run(async () =>
- await optimization.ApplyAsync(progress, new OptimizationContext
- {
- Logger = optLogger,
- Snapshot = systemInfoService.Snapshot,
- StreamService = streamService
- }));
+ await optimization.ApplyAsync(
+ progress,
+ new OptimizationContext
+ {
+ Logger = optLogger,
+ Snapshot = systemInfoService.Snapshot,
+ StreamService = streamService,
+ }
+ )
+ );
if (!string.IsNullOrWhiteSpace(applyResult.Message))
return new OptimizationResult
{
Status = OptimizationSuccessResult.Failed,
Message = applyResult.Message,
- FailedSteps = scope.GetStepResults().Where(step => !step.Success).ToList()
+ FailedSteps = scope.GetStepResults().Where(step => !step.Success).ToList(),
};
- progress.Report(new ProcessingProgress
- { Message = Translations.Optimization_Apply_Completed, IsIndeterminate = false, Value = 1, Total = 1 });
+ progress.Report(
+ new ProcessingProgress
+ {
+ Message = Translations.Optimization_Apply_Completed,
+ IsIndeterminate = false,
+ Value = 1,
+ Total = 1,
+ }
+ );
var result = scope.ToResult();
await TrySaveRevertDataAsync(scope, optimization);
@@ -146,9 +198,12 @@ public class OptimizationService(
var result = new OptimizationResult
{
Status = status,
- Message = string.Format(Translations.Optimization_Apply_Error_Failed, optimization.Name),
+ Message = string.Format(
+ Translations.Optimization_Apply_Error_Failed,
+ optimization.Name
+ ),
Exception = ex,
- FailedSteps = failedSteps
+ FailedSteps = failedSteps,
};
await TrySaveRevertDataAsync(scope, optimization);
@@ -157,14 +212,28 @@ public class OptimizationService(
}
}
- public async Task<RevertResult> RevertAsync(IOptimization optimization,
- IProgress<ProcessingProgress>? progress = null)
+ public async Task<RevertResult> RevertAsync(
+ IOptimization optimization,
+ IProgress<ProcessingProgress>? progress = null
+ )
{
- progress?.Report(new ProcessingProgress
- { Message = Translations.Optimization_Revert_Reverting, IsIndeterminate = true });
+ progress?.Report(
+ new ProcessingProgress
+ {
+ Message = Translations.Optimization_Revert_Reverting,
+ IsIndeterminate = true,
+ }
+ );
var result = await revertManager.RevertAsync(optimization, progress);
- progress?.Report(new ProcessingProgress
- { Message = result.Message, IsIndeterminate = false, Value = 1, Total = 1 });
+ progress?.Report(
+ new ProcessingProgress
+ {
+ Message = result.Message,
+ IsIndeterminate = false,
+ Value = 1,
+ Total = 1,
+ }
+ );
return result;
}
@@ -175,12 +244,14 @@ public class OptimizationService(
public static async Task UpdateOptimizationStateAsync(params IOptimization[] optimizations)
{
- await Task.WhenAll(optimizations.Select(async opt =>
- {
- var data = await RevertManager.GetRevertDataAsync(opt.Id);
- opt.State.IsApplied = data != null;
- opt.State.AppliedAt = data?.AppliedAt;
- }));
+ await Task.WhenAll(
+ optimizations.Select(async opt =>
+ {
+ var data = await RevertManager.GetRevertDataAsync(opt.Id);
+ opt.State.IsApplied = data != null;
+ opt.State.AppliedAt = data?.AppliedAt;
+ })
+ );
}
public static Task UpdateOptimizationStateAsync(IEnumerable<IOptimization> optimizations)
@@ -189,38 +260,60 @@ public class OptimizationService(
}
public static async Task<List<OperationStepResult>> RetryFailedStepsAsync(
- IReadOnlyList<OperationStepResult> failedSteps, bool reverseOrder, ILogger logger,
- IProgress<ProcessingProgress>? progress = null)
+ IReadOnlyList<OperationStepResult> failedSteps,
+ bool reverseOrder,
+ ILogger logger,
+ IProgress<ProcessingProgress>? progress = null
+ )
{
- return (await RetryFailedStepsWithResultsAsync(failedSteps, reverseOrder, logger, progress)).FailedSteps;
+ return (
+ await RetryFailedStepsWithResultsAsync(failedSteps, reverseOrder, logger, progress)
+ ).FailedSteps;
}
public static async Task<RetryFailedStepsResult> RetryFailedStepsWithResultsAsync(
- IReadOnlyList<OperationStepResult> failedSteps, bool reverseOrder, ILogger logger,
- IProgress<ProcessingProgress>? progress = null)
+ IReadOnlyList<OperationStepResult> failedSteps,
+ bool reverseOrder,
+ ILogger logger,
+ IProgress<ProcessingProgress>? progress = null
+ )
{
- if (failedSteps.Count == 0) return new RetryFailedStepsResult([], []);
+ if (failedSteps.Count == 0)
+ return new RetryFailedStepsResult([], []);
var remainingFailedSteps = new List<OperationStepResult>();
var recoveredSteps = new List<OperationStepResult>();
- var orderedSteps =
- reverseOrder ? failedSteps.OrderByDescending(s => s.Index) : failedSteps.OrderBy(s => s.Index);
+ var orderedSteps = reverseOrder
+ ? failedSteps.OrderByDescending(s => s.Index)
+ : failedSteps.OrderBy(s => s.Index);
var total = failedSteps.Count;
var processedCount = 0;
- progress?.Report(new ProcessingProgress
- { Message = Translations.Optimization_Retry_Processing, IsIndeterminate = true });
+ progress?.Report(
+ new ProcessingProgress
+ {
+ Message = Translations.Optimization_Retry_Processing,
+ IsIndeterminate = true,
+ }
+ );
foreach (var step in orderedSteps)
{
processedCount++;
- progress?.Report(new ProcessingProgress
- {
- Message = string.Format(Translations.Optimization_RetryStep_Processing, step.Name, processedCount, total),
- IsIndeterminate = false,
- Value = processedCount,
- Total = total
- });
+ progress?.Report(
+ new ProcessingProgress
+ {
+ Message = string.Format(
+ Translations.Optimization_RetryStep_Processing,
+ step.Name,
+ processedCount,
+ total
+ ),
+ IsIndeterminate = false,
+ Value = processedCount,
+ Total = total,
+ }
+ );
if (step.RetryAction == null)
{
@@ -238,18 +331,23 @@ public class OptimizationService(
if (success)
{
var retriedStep = retryScope.SuccessfulSteps.LastOrDefault();
- recoveredSteps.Add(retriedStep == null
- ? step with { Error = null }
- : new OperationStepResult
- {
- Index = step.Index,
- Name = retriedStep.Name,
- Description = retriedStep.Description,
- Success = true,
- Error = null,
- RetryAction = null,
- RevertStep = retriedStep.RevertStep
- });
+ recoveredSteps.Add(
+ retriedStep == null
+ ? step with
+ {
+ Error = null,
+ }
+ : new OperationStepResult
+ {
+ Index = step.Index,
+ Name = retriedStep.Name,
+ Description = retriedStep.Description,
+ Success = true,
+ Error = null,
+ RetryAction = null,
+ RevertStep = retriedStep.RevertStep,
+ }
+ );
}
}
catch (Exception ex)
@@ -259,7 +357,9 @@ public class OptimizationService(
}
if (!success)
- remainingFailedSteps.Add(error != null ? step with { Error = error.Message } : step);
+ remainingFailedSteps.Add(
+ error != null ? step with { Error = error.Message } : step
+ );
}
return new RetryFailedStepsResult(remainingFailedSteps, recoveredSteps);
@@ -276,13 +376,18 @@ public class OptimizationService(
}
catch (Exception ex)
{
- _logger.LogError(ex, "Failed to save revert data for {Name}", optimization.OptimizationKey);
+ _logger.LogError(
+ ex,
+ "Failed to save revert data for {Name}",
+ optimization.OptimizationKey
+ );
}
}
public static void ClearResources(ILogger logger)
{
- if (!Directory.Exists(Shared.ResourcesDirectory)) return;
+ if (!Directory.Exists(Shared.ResourcesDirectory))
+ return;
foreach (var f in Directory.GetFiles(Shared.ResourcesDirectory))
try
{
@@ -299,9 +404,10 @@ public enum RestorePointResult
{
Success,
Failed,
- FrequencyLimitReached
+ FrequencyLimitReached,
}
public sealed record RetryFailedStepsResult(
List<OperationStepResult> FailedSteps,
- List<OperationStepResult> RecoveredSteps);
+ List<OperationStepResult> RecoveredSteps
+);
diff --git a/optimizerDuck/Services/Optimization/Providers/RegistryService.cs b/optimizerDuck/Services/Optimization/Providers/RegistryService.cs
index 6996b8b..5544f0d 100644
--- a/optimizerDuck/Services/Optimization/Providers/RegistryService.cs
+++ b/optimizerDuck/Services/Optimization/Providers/RegistryService.cs
@@ -13,30 +13,32 @@ namespace optimizerDuck.Services.OptimizationServices;
public static class RegistryService
{
- private static readonly Dictionary<string, RegistryKey> RootKeysMap =
- new(StringComparer.OrdinalIgnoreCase)
- {
- ["HKLM"] = Registry.LocalMachine,
- ["HKLM:"] = Registry.LocalMachine,
- ["HKEY_LOCAL_MACHINE"] = Registry.LocalMachine,
- ["HKCU"] = Registry.CurrentUser,
- ["HKCU:"] = Registry.CurrentUser,
- ["HKEY_CURRENT_USER"] = Registry.CurrentUser,
- ["HKCR"] = Registry.ClassesRoot,
- ["HKCR:"] = Registry.ClassesRoot,
- ["HKEY_CLASSES_ROOT"] = Registry.ClassesRoot,
- ["HKU"] = Registry.Users,
- ["HKU:"] = Registry.Users,
- ["HKEY_USERS"] = Registry.Users,
- ["HKCC"] = Registry.CurrentConfig,
- ["HKCC:"] = Registry.CurrentConfig,
- ["HKEY_CURRENT_CONFIG"] = Registry.CurrentConfig
- };
+ private static readonly Dictionary<string, RegistryKey> RootKeysMap = new(
+ StringComparer.OrdinalIgnoreCase
+ )
+ {
+ ["HKLM"] = Registry.LocalMachine,
+ ["HKLM:"] = Registry.LocalMachine,
+ ["HKEY_LOCAL_MACHINE"] = Registry.LocalMachine,
+ ["HKCU"] = Registry.CurrentUser,
+ ["HKCU:"] = Registry.CurrentUser,
+ ["HKEY_CURRENT_USER"] = Registry.CurrentUser,
+ ["HKCR"] = Registry.ClassesRoot,
+ ["HKCR:"] = Registry.ClassesRoot,
+ ["HKEY_CLASSES_ROOT"] = Registry.ClassesRoot,
+ ["HKU"] = Registry.Users,
+ ["HKU:"] = Registry.Users,
+ ["HKEY_USERS"] = Registry.Users,
+ ["HKCC"] = Registry.CurrentConfig,
+ ["HKCC:"] = Registry.CurrentConfig,
+ ["HKEY_CURRENT_CONFIG"] = Registry.CurrentConfig,
+ };
private static bool TryParsePath(
string fullPath,
[NotNullWhen(true)] out RegistryKey? rootKey,
- [NotNullWhen(true)] out string? subPath)
+ [NotNullWhen(true)] out string? subPath
+ )
{
rootKey = null;
subPath = null;
@@ -70,7 +72,8 @@ public static class RegistryService
out bool shouldDispose,
bool writable,
bool createIfMissing,
- List<string>? createdSubKeys)
+ List<string>? createdSubKeys
+ )
{
key = null;
shouldDispose = false;
@@ -86,9 +89,10 @@ public static class RegistryService
var opened = rootKey.OpenSubKey(subPath, writable);
if (opened == null && writable && createIfMissing)
- opened = createdSubKeys != null
- ? CreateSubKeyTrack(rootKey, subPath, createdSubKeys)
- : rootKey.CreateSubKey(subPath);
+ opened =
+ createdSubKeys != null
+ ? CreateSubKeyTrack(rootKey, subPath, createdSubKeys)
+ : rootKey.CreateSubKey(subPath);
if (opened != null)
{
@@ -101,32 +105,61 @@ public static class RegistryService
}
catch (SecurityException ex)
{
- TrackRegistryError(Translations.Service_Registry_Error_AccessDeniedProtectedHive,
- "Access denied (protected hive)", rootKey, subPath, ex);
+ TrackRegistryError(
+ Translations.Service_Registry_Error_AccessDeniedProtectedHive,
+ "Access denied (protected hive)",
+ rootKey,
+ subPath,
+ ex
+ );
return false;
}
catch (UnauthorizedAccessException ex)
{
- TrackRegistryError(Translations.Service_Registry_Error_UnauthorizedAccess, "Unauthorized access", rootKey,
- subPath, ex);
+ TrackRegistryError(
+ Translations.Service_Registry_Error_UnauthorizedAccess,
+ "Unauthorized access",
+ rootKey,
+ subPath,
+ ex
+ );
return false;
}
catch (Exception ex)
{
- TrackRegistryError(Translations.Service_Registry_Error_CreateOrOpenSubkeyFailed,
- "Failed to create/open subkey", rootKey, subPath, ex);
+ TrackRegistryError(
+ Translations.Service_Registry_Error_CreateOrOpenSubkeyFailed,
+ "Failed to create/open subkey",
+ rootKey,
+ subPath,
+ ex
+ );
return false;
}
}
- private static T? WithKey<T>(RegistryItem item, Func<RegistryKey, T?> action, bool writable = false,
- bool createIfMissing = false, List<string>? createdSubKeys = null)
+ private static T? WithKey<T>(
+ RegistryItem item,
+ Func<RegistryKey, T?> action,
+ bool writable = false,
+ bool createIfMissing = false,
+ List<string>? createdSubKeys = null
+ )
{
if (!TryParsePath(item.Path, out var rootKey, out var subPath))
return default;
- if (!TryOpenSubKey(rootKey, subPath, out var subKey, out var shouldDispose, writable, createIfMissing,
- createdSubKeys))
+ if (
+ !TryOpenSubKey(
+ rootKey,
+ subPath,
+ out var subKey,
+ out var shouldDispose,
+ writable,
+ createIfMissing,
+ createdSubKeys
+ )
+ )
return default;
try
@@ -152,137 +185,262 @@ public static class RegistryService
public static T? Read<T>(RegistryItem item)
{
- return WithKey(item, key =>
- {
- try
- {
- var valueName = NormalizeValueName(item.Name);
- var value = key.GetValue(valueName, null, RegistryValueOptions.DoNotExpandEnvironmentNames);
- if (value is null) return default;
-
- var result = ConvertRegistryValue<T>(value);
- ExecutionScope.LogInfo("Read registry {Path}:{Name} = {Value}", item.Path, item.Name!,
- result?.ToString() ?? "<null>");
- return result;
- }
- catch (Exception ex)
+ return WithKey(
+ item,
+ key =>
{
- ExecutionScope.LogError(ex, "Failed to read registry {Path}:{Name}", item.Path, item.Name!);
- return default;
+ try
+ {
+ var valueName = NormalizeValueName(item.Name);
+ var value = key.GetValue(
+ valueName,
+ null,
+ RegistryValueOptions.DoNotExpandEnvironmentNames
+ );
+ if (value is null)
+ return default;
+
+ var result = ConvertRegistryValue<T>(value);
+ ExecutionScope.LogInfo(
+ "Read registry {Path}:{Name} = {Value}",
+ item.Path,
+ item.Name!,
+ result?.ToString() ?? "<null>"
+ );
+ return result;
+ }
+ catch (Exception ex)
+ {
+ ExecutionScope.LogError(
+ ex,
+ "Failed to read registry {Path}:{Name}",
+ item.Path,
+ item.Name!
+ );
+ return default;
+ }
}
- });
+ );
}
public static bool Write(RegistryItem item)
{
if (item.Value == null)
{
- ExecutionScope.LogError(null, "Value can't be null when writing {Path}:{Name}", item.Path, item.Name!);
+ ExecutionScope.LogError(
+ null,
+ "Value can't be null when writing {Path}:{Name}",
+ item.Path,
+ item.Name!
+ );
ExecutionScope.Track(nameof(Write), false);
return false;
}
var createdSubKeys = new List<string>();
- return WithKey(item, key =>
- {
- var description = string.Format(Translations.Service_Registry_Description_Write, item.Path, item.Name);
- try
+ return WithKey(
+ item,
+ key =>
{
- var valueName = NormalizeValueName(item.Name);
- var backupValue = key.GetValue(valueName, null, RegistryValueOptions.DoNotExpandEnvironmentNames);
- var valueExists = backupValue != null ||
- key.GetValueNames().Contains(valueName, StringComparer.OrdinalIgnoreCase);
- var backupKind = valueExists ? key.GetValueKind(valueName) : RegistryValueKind.Unknown;
-
- key.SetValue(valueName, item.Value, item.Kind);
-
- var revertStep = new RegistryRevertStep
+ var description = string.Format(
+ Translations.Service_Registry_Description_Write,
+ item.Path,
+ item.Name
+ );
+ try
{
- Action = valueExists ? RevertAction.RestorePrevious : RevertAction.NoPreviousValue,
- Path = item.Path,
- Name = item.Name,
- Value = backupValue,
- Kind = backupKind,
- CreatedSubKeys = createdSubKeys
- };
-
- ExecutionScope.LogInfo("Wrote {Path}:{Name}[{Kind}] = {Value}", item.Path, item.Name!, item.Kind,
- item.Value);
- ExecutionScope.Track(nameof(Write), true);
- ExecutionScope.RecordStep(Translations.Service_Registry_Name, description, true, revertStep);
- return true;
- }
- catch (UnauthorizedAccessException)
- {
- ExecutionScope.LogError(null, "Access denied writing {Path}:{Name}", item.Path, item.Name!);
- ExecutionScope.Track(nameof(Write), false);
- ExecutionScope.RecordStep(Translations.Service_Registry_Name, description, false, null,
- Translations.Service_Common_Error_AccessDenied, () => Task.FromResult(Write(item)));
- return false;
- }
- catch (Exception ex)
- {
- ExecutionScope.LogError(ex, "Failed to write registry {Path}:{Name}", item.Path, item.Name!);
- ExecutionScope.Track(nameof(Write), false);
- ExecutionScope.RecordStep(Translations.Service_Registry_Name, description, false, null, ex.Message,
- () => Task.FromResult(Write(item)));
- return false;
- }
- }, true, true, createdSubKeys);
+ var valueName = NormalizeValueName(item.Name);
+ var backupValue = key.GetValue(
+ valueName,
+ null,
+ RegistryValueOptions.DoNotExpandEnvironmentNames
+ );
+ var valueExists =
+ backupValue != null
+ || key.GetValueNames()
+ .Contains(valueName, StringComparer.OrdinalIgnoreCase);
+ var backupKind = valueExists
+ ? key.GetValueKind(valueName)
+ : RegistryValueKind.Unknown;
+
+ key.SetValue(valueName, item.Value, item.Kind);
+
+ var revertStep = new RegistryRevertStep
+ {
+ Action = valueExists
+ ? RevertAction.RestorePrevious
+ : RevertAction.NoPreviousValue,
+ Path = item.Path,
+ Name = item.Name,
+ Value = backupValue,
+ Kind = backupKind,
+ CreatedSubKeys = createdSubKeys,
+ };
+
+ ExecutionScope.LogInfo(
+ "Wrote {Path}:{Name}[{Kind}] = {Value}",
+ item.Path,
+ item.Name!,
+ item.Kind,
+ item.Value
+ );
+ ExecutionScope.Track(nameof(Write), true);
+ ExecutionScope.RecordStep(
+ Translations.Service_Registry_Name,
+ description,
+ true,
+ revertStep
+ );
+ return true;
+ }
+ catch (UnauthorizedAccessException)
+ {
+ ExecutionScope.LogError(
+ null,
+ "Access denied writing {Path}:{Name}",
+ item.Path,
+ item.Name!
+ );
+ ExecutionScope.Track(nameof(Write), false);
+ ExecutionScope.RecordStep(
+ Translations.Service_Registry_Name,
+ description,
+ false,
+ null,
+ Translations.Service_Common_Error_AccessDenied,
+ () => Task.FromResult(Write(item))
+ );
+ return false;
+ }
+ catch (Exception ex)
+ {
+ ExecutionScope.LogError(
+ ex,
+ "Failed to write registry {Path}:{Name}",
+ item.Path,
+ item.Name!
+ );
+ ExecutionScope.Track(nameof(Write), false);
+ ExecutionScope.RecordStep(
+ Translations.Service_Registry_Name,
+ description,
+ false,
+ null,
+ ex.Message,
+ () => Task.FromResult(Write(item))
+ );
+ return false;
+ }
+ },
+ true,
+ true,
+ createdSubKeys
+ );
}
public static bool DeleteValue(RegistryItem item)
{
- return WithKey(item, key =>
- {
- var description = string.Format(Translations.Service_Registry_Description_Delete, item.Path, item.Name ?? "(Default)");
- try
+ return WithKey(
+ item,
+ key =>
{
- var valueName = NormalizeValueName(item.Name);
- var backupValue = key.GetValue(valueName, null, RegistryValueOptions.DoNotExpandEnvironmentNames);
- if (backupValue == null && !key.GetValueNames().Contains(valueName, StringComparer.OrdinalIgnoreCase))
+ var description = string.Format(
+ Translations.Service_Registry_Description_Delete,
+ item.Path,
+ item.Name ?? "(Default)"
+ );
+ try
{
- ExecutionScope.LogInfo("Skip delete registry {Path}:{Name} (not found)", item.Path, item.Name!);
+ var valueName = NormalizeValueName(item.Name);
+ var backupValue = key.GetValue(
+ valueName,
+ null,
+ RegistryValueOptions.DoNotExpandEnvironmentNames
+ );
+ if (
+ backupValue == null
+ && !key.GetValueNames()
+ .Contains(valueName, StringComparer.OrdinalIgnoreCase)
+ )
+ {
+ ExecutionScope.LogInfo(
+ "Skip delete registry {Path}:{Name} (not found)",
+ item.Path,
+ item.Name!
+ );
+ ExecutionScope.Track(nameof(DeleteValue), true);
+ ExecutionScope.RecordStep(
+ Translations.Service_Registry_Name,
+ description,
+ true
+ );
+ return true;
+ }
+
+ var backupKind = key.GetValueKind(valueName);
+ key.DeleteValue(valueName, false);
+
+ var revertStep = new RegistryRevertStep
+ {
+ Action = RevertAction.RestorePrevious,
+ Path = item.Path,
+ Name = item.Name,
+ Value = backupValue,
+ Kind = backupKind,
+ };
+
+ ExecutionScope.LogInfo("Deleted registry {Path}:{Name}", item.Path, item.Name!);
ExecutionScope.Track(nameof(DeleteValue), true);
- ExecutionScope.RecordStep(Translations.Service_Registry_Name, description, true);
+ ExecutionScope.RecordStep(
+ Translations.Service_Registry_Name,
+ description,
+ true,
+ revertStep
+ );
return true;
}
-
- var backupKind = key.GetValueKind(valueName);
- key.DeleteValue(valueName, false);
-
- var revertStep = new RegistryRevertStep
+ catch (UnauthorizedAccessException)
{
- Action = RevertAction.RestorePrevious,
- Path = item.Path,
- Name = item.Name,
- Value = backupValue,
- Kind = backupKind
- };
-
- ExecutionScope.LogInfo("Deleted registry {Path}:{Name}", item.Path, item.Name!);
- ExecutionScope.Track(nameof(DeleteValue), true);
- ExecutionScope.RecordStep(Translations.Service_Registry_Name, description, true, revertStep);
- return true;
- }
- catch (UnauthorizedAccessException)
- {
- ExecutionScope.LogError(null, "Access denied deleting {Path}:{Name}", item.Path, item.Name!);
- ExecutionScope.Track(nameof(DeleteValue), false);
- ExecutionScope.RecordStep(Translations.Service_Registry_Name, description, false, null,
- Translations.Service_Common_Error_AccessDenied, () => Task.FromResult(DeleteValue(item)));
- return false;
- }
- catch (Exception ex)
- {
- ExecutionScope.LogError(ex, "Failed to delete registry {Path}:{Name}", item.Path, item.Name!);
- ExecutionScope.Track(nameof(DeleteValue), false);
- ExecutionScope.RecordStep(Translations.Service_Registry_Name, description, false, null, ex.Message,
- () => Task.FromResult(DeleteValue(item)));
- return false;
- }
- }, true);
+ ExecutionScope.LogError(
+ null,
+ "Access denied deleting {Path}:{Name}",
+ item.Path,
+ item.Name!
+ );
+ ExecutionScope.Track(nameof(DeleteValue), false);
+ ExecutionScope.RecordStep(
+ Translations.Service_Registry_Name,
+ description,
+ false,
+ null,
+ Translations.Service_Common_Error_AccessDenied,
+ () => Task.FromResult(DeleteValue(item))
+ );
+ return false;
+ }
+ catch (Exception ex)
+ {
+ ExecutionScope.LogError(
+ ex,
+ "Failed to delete registry {Path}:{Name}",
+ item.Path,
+ item.Name!
+ );
+ ExecutionScope.Track(nameof(DeleteValue), false);
+ ExecutionScope.RecordStep(
+ Translations.Service_Registry_Name,
+ description,
+ false,
+ null,
+ ex.Message,
+ () => Task.FromResult(DeleteValue(item))
+ );
+ return false;
+ }
+ },
+ true
+ );
}
public static bool CreateSubKey(RegistryItem item)
@@ -290,7 +448,10 @@ public static class RegistryService
if (!TryParsePath(item.Path, out var rootKey, out var subPath))
return false;
- var description = string.Format(Translations.Service_Registry_Description_CreateKey, item.Path);
+ var description = string.Format(
+ Translations.Service_Registry_Description_CreateKey,
+ item.Path
+ );
var createdSubKeys = new List<string>();
try
@@ -310,28 +471,45 @@ public static class RegistryService
Action = RevertAction.NoPreviousValue,
Path = item.Path,
Name = null,
- CreatedSubKeys = createdSubKeys
+ CreatedSubKeys = createdSubKeys,
};
ExecutionScope.LogInfo("Created registry key {Path}", item.Path);
ExecutionScope.Track(nameof(CreateSubKey), true);
- ExecutionScope.RecordStep(Translations.Service_Registry_Name, description, true, revertStep);
+ ExecutionScope.RecordStep(
+ Translations.Service_Registry_Name,
+ description,
+ true,
+ revertStep
+ );
return true;
}
catch (UnauthorizedAccessException)
{
ExecutionScope.LogError(null, "Access denied creating {Path}", item.Path);
ExecutionScope.Track(nameof(CreateSubKey), false);
- ExecutionScope.RecordStep(Translations.Service_Registry_Name, description, false, null,
- Translations.Service_Common_Error_AccessDenied, () => Task.FromResult(CreateSubKey(item)));
+ ExecutionScope.RecordStep(
+ Translations.Service_Registry_Name,
+ description,
+ false,
+ null,
+ Translations.Service_Common_Error_AccessDenied,
+ () => Task.FromResult(CreateSubKey(item))
+ );
return false;
}
catch (Exception ex)
{
ExecutionScope.LogError(ex, "Failed to create registry {Path}", item.Path);
ExecutionScope.Track(nameof(CreateSubKey), false);
- ExecutionScope.RecordStep(Translations.Service_Registry_Name, description, false, null, ex.Message,
- () => Task.FromResult(CreateSubKey(item)));
+ ExecutionScope.RecordStep(
+ Translations.Service_Registry_Name,
+ description,
+ false,
+ null,
+ ex.Message,
+ () => Task.FromResult(CreateSubKey(item))
+ );
return false;
}
}
@@ -341,7 +519,10 @@ public static class RegistryService
if (!TryParsePath(item.Path, out var rootKey, out var subPath))
return false;
- var description = string.Format(Translations.Service_Registry_Description_DeleteKey, item.Path);
+ var description = string.Format(
+ Translations.Service_Registry_Description_DeleteKey,
+ item.Path
+ );
try
{
@@ -361,29 +542,45 @@ public static class RegistryService
{
Action = RevertAction.RestoreKeyTree,
Path = item.Path,
- SubSteps = subSteps
+ SubSteps = subSteps,
};
ExecutionScope.LogInfo("Deleted registry key tree {Path}", item.Path);
ExecutionScope.Track(nameof(DeleteSubKeyTree), true);
- ExecutionScope.RecordStep(Translations.Service_Registry_Name, description, true, revertStep);
+ ExecutionScope.RecordStep(
+ Translations.Service_Registry_Name,
+ description,
+ true,
+ revertStep
+ );
return true;
}
catch (UnauthorizedAccessException)
{
ExecutionScope.LogError(null, "Access denied deleting {Path}", item.Path);
ExecutionScope.Track(nameof(DeleteSubKeyTree), false);
- ExecutionScope.RecordStep(Translations.Service_Registry_Name, description, false, null,
+ ExecutionScope.RecordStep(
+ Translations.Service_Registry_Name,
+ description,
+ false,
+ null,
Translations.Service_Registry_Error_AccessDeniedProtectedHive,
- () => Task.FromResult(DeleteSubKeyTree(item)));
+ () => Task.FromResult(DeleteSubKeyTree(item))
+ );
return false;
}
catch (Exception ex)
{
ExecutionScope.LogError(ex, "Failed to delete subkey tree {Path}", item.Path);
ExecutionScope.Track(nameof(DeleteSubKeyTree), false);
- ExecutionScope.RecordStep(Translations.Service_Registry_Name, description, false, null, ex.Message,
- () => Task.FromResult(DeleteSubKeyTree(item)));
+ ExecutionScope.RecordStep(
+ Translations.Service_Registry_Name,
+ description,
+ false,
+ null,
+ ex.Message,
+ () => Task.FromResult(DeleteSubKeyTree(item))
+ );
return false;
}
}
@@ -395,12 +592,22 @@ public static class RegistryService
return steps;
}
- private static void BackupRegistryTreeRecursive(RegistryKey key, string keyPath, List<RegistryRevertStep> steps, int depth)
+ private static void BackupRegistryTreeRecursive(
+ RegistryKey key,
+ string keyPath,
+ List<RegistryRevertStep> steps,
+ int depth
+ )
{
// Guard against massive trees (e.g., HKCR\CLSID) to prevent OOM and giant JSON files
if (depth > 15 || steps.Count > 5000)
{
- ExecutionScope.LogWarning("Skipping full backup of subtree {Path} (depth: {Depth}, items: {Count})", keyPath, depth, steps.Count);
+ ExecutionScope.LogWarning(
+ "Skipping full backup of subtree {Path} (depth: {Depth}, items: {Count})",
+ keyPath,
+ depth,
+ steps.Count
+ );
return;
}
@@ -408,33 +615,44 @@ public static class RegistryService
foreach (var valueName in key.GetValueNames())
{
- if (steps.Count > 5000) break;
- steps.Add(new RegistryRevertStep
- {
- Action = RevertAction.RestorePrevious,
- Path = keyPath,
- Name = string.IsNullOrEmpty(valueName) ? null : valueName,
- Value = key.GetValue(valueName, null, RegistryValueOptions.DoNotExpandEnvironmentNames),
- Kind = key.GetValueKind(valueName)
- });
+ if (steps.Count > 5000)
+ break;
+ steps.Add(
+ new RegistryRevertStep
+ {
+ Action = RevertAction.RestorePrevious,
+ Path = keyPath,
+ Name = string.IsNullOrEmpty(valueName) ? null : valueName,
+ Value = key.GetValue(
+ valueName,
+ null,
+ RegistryValueOptions.DoNotExpandEnvironmentNames
+ ),
+ Kind = key.GetValueKind(valueName),
+ }
+ );
}
foreach (var subKeyName in key.GetSubKeyNames())
{
- if (steps.Count > 5000) break;
+ if (steps.Count > 5000)
+ break;
using var subKey = key.OpenSubKey(subKeyName, false);
if (subKey != null)
BackupRegistryTreeRecursive(subKey, $@"{keyPath}\{subKeyName}", steps, depth + 1);
}
}
+
public static void Write(params RegistryItem[] items)
{
- foreach (var item in items.Distinct()) Write(item);
+ foreach (var item in items.Distinct())
+ Write(item);
}
public static void DeleteValue(params RegistryItem[] items)
{
- foreach (var item in items.Distinct()) DeleteValue(item);
+ foreach (var item in items.Distinct())
+ DeleteValue(item);
}
#region Helpers
@@ -442,7 +660,8 @@ public static class RegistryService
private static T? ConvertRegistryValue<T>(object value)
{
// Fast path
- if (value is T t) return t;
+ if (value is T t)
+ return t;
var tType = typeof(T);
var targetType = Nullable.GetUnderlyingType(tType) ?? tType;
@@ -461,7 +680,7 @@ public static class RegistryService
int i => (T)(object)(i != 0),
long l => (T)(object)(l != 0),
string s when bool.TryParse(s, out var b) => (T)(object)b,
- _ => default
+ _ => default,
};
// Enum: supports both string and numeric
@@ -485,17 +704,12 @@ public static class RegistryService
string logReason,
RegistryKey root,
string? subPath,
- Exception ex)
+ Exception ex
+ )
{
- var path = string.IsNullOrEmpty(subPath)
- ? root.Name
- : $"{root.Name}\\{subPath}";
+ var path = string.IsNullOrEmpty(subPath) ? root.Name : $"{root.Name}\\{subPath}";
- ExecutionScope.LogError(
- ex,
- "{Reason}: {Path}",
- logReason,
- path);
+ ExecutionScope.LogError(ex, "{Reason}: {Path}", logReason, path);
ExecutionScope.Track(nameof(RegistryService), false);
@@ -508,7 +722,8 @@ public static class RegistryService
private static RegistryKey CreateSubKeyTrack(
RegistryKey root,
string subPath,
- List<string> createdSubKeys)
+ List<string> createdSubKeys
+ )
{
var parts = subPath.Split('\\', StringSplitOptions.RemoveEmptyEntries);
@@ -520,21 +735,22 @@ public static class RegistryService
{
foreach (var part in parts)
{
- currentPath = currentPath.Length == 0
- ? part
- : $"{currentPath}\\{part}";
+ currentPath = currentPath.Length == 0 ? part : $"{currentPath}\\{part}";
var next = current.OpenSubKey(part, true);
if (next == null)
{
- next = current.CreateSubKey(part, true)
- ?? throw new InvalidOperationException(
- $"Failed to create registry key: {root.Name}\\{currentPath}");
+ next =
+ current.CreateSubKey(part, true)
+ ?? throw new InvalidOperationException(
+ $"Failed to create registry key: {root.Name}\\{currentPath}"
+ );
createdSubKeys.Add($"{root.Name}\\{currentPath}");
ExecutionScope.LogDebug(
"Created registry subkey: {Path}",
- $"{root.Name}\\{currentPath}");
+ $"{root.Name}\\{currentPath}"
+ );
}
// dispose old key if we opened it
@@ -556,7 +772,6 @@ public static class RegistryService
}
}
-
/// <summary>
/// Safely cleanup empty registry keys that were created during apply operation
/// Only deletes keys that:
@@ -610,12 +825,18 @@ public static class RegistryService
// Key is not empty, don't delete it
ExecutionScope.LogDebug(
"Skipped cleanup of registry key {Path} (has {SubKeyCount} subkeys and {ValueCount} values)",
- fullPath, key.SubKeyCount, key.ValueCount);
+ fullPath,
+ key.SubKeyCount,
+ key.ValueCount
+ );
}
}
catch (UnauthorizedAccessException)
{
- ExecutionScope.LogWarning("Access denied cleaning up registry key: {Path}", fullPath);
+ ExecutionScope.LogWarning(
+ "Access denied cleaning up registry key: {Path}",
+ fullPath
+ );
}
catch (IOException ex)
{
diff --git a/optimizerDuck/Services/Optimization/Providers/ScheduledTaskService.cs b/optimizerDuck/Services/Optimization/Providers/ScheduledTaskService.cs
index 5eb7744..5addefc 100644
--- a/optimizerDuck/Services/Optimization/Providers/ScheduledTaskService.cs
+++ b/optimizerDuck/Services/Optimization/Providers/ScheduledTaskService.cs
@@ -23,7 +23,11 @@ public static class ScheduledTaskService
}
catch (Exception ex)
{
- ExecutionScope.LogDebug("Failed to check task enabled state {Path}: {Error}", fullPath, ex.Message);
+ ExecutionScope.LogDebug(
+ "Failed to check task enabled state {Path}: {Error}",
+ fullPath,
+ ex.Message
+ );
return false;
}
}
@@ -33,13 +37,18 @@ public static class ScheduledTaskService
/// </summary>
public static bool DisableTask(string fullPath)
{
- var description = string.Format(Translations.Service_ScheduledTask_Description_Disable, fullPath);
+ var description = string.Format(
+ Translations.Service_ScheduledTask_Description_Disable,
+ fullPath
+ );
try
{
using var ts = new TaskService();
- var task = ts.GetTask(fullPath) ??
- throw new InvalidOperationException(string.Format(Translations.ScheduledTasks_Error_TaskNotFound,
- fullPath));
+ var task =
+ ts.GetTask(fullPath)
+ ?? throw new InvalidOperationException(
+ string.Format(Translations.ScheduledTasks_Error_TaskNotFound, fullPath)
+ );
var wasEnabled = task.Enabled;
task.Enabled = false;
@@ -50,7 +59,7 @@ public static class ScheduledTaskService
revertStep = new ScheduledTaskRevertStep
{
FullPath = fullPath,
- OriginalEnabled = true
+ OriginalEnabled = true,
};
ExecutionScope.LogInfo("Disabled task {Path}", fullPath);
@@ -59,7 +68,8 @@ public static class ScheduledTaskService
Translations.Service_ScheduledTask_Name,
description,
true,
- revertStep);
+ revertStep
+ );
return true;
}
catch (UnauthorizedAccessException)
@@ -72,7 +82,8 @@ public static class ScheduledTaskService
false,
null,
Translations.Service_Common_Error_AccessDenied,
- () => System.Threading.Tasks.Task.FromResult(DisableTask(fullPath)));
+ () => System.Threading.Tasks.Task.FromResult(DisableTask(fullPath))
+ );
return false;
}
catch (Exception ex)
@@ -85,7 +96,8 @@ public static class ScheduledTaskService
false,
null,
ex.Message,
- () => System.Threading.Tasks.Task.FromResult(DisableTask(fullPath)));
+ () => System.Threading.Tasks.Task.FromResult(DisableTask(fullPath))
+ );
return false;
}
}
@@ -95,13 +107,18 @@ public static class ScheduledTaskService
/// </summary>
public static bool EnableTask(string fullPath)
{
- var description = string.Format(Translations.Service_ScheduledTask_Description_Enable, fullPath);
+ var description = string.Format(
+ Translations.Service_ScheduledTask_Description_Enable,
+ fullPath
+ );
try
{
using var ts = new TaskService();
- var task = ts.GetTask(fullPath) ??
- throw new InvalidOperationException(string.Format(Translations.ScheduledTasks_Error_TaskNotFound,
- fullPath));
+ var task =
+ ts.GetTask(fullPath)
+ ?? throw new InvalidOperationException(
+ string.Format(Translations.ScheduledTasks_Error_TaskNotFound, fullPath)
+ );
var wasEnabled = task.Enabled;
task.Enabled = true;
@@ -112,7 +129,7 @@ public static class ScheduledTaskService
revertStep = new ScheduledTaskRevertStep
{
FullPath = fullPath,
- OriginalEnabled = false
+ OriginalEnabled = false,
};
ExecutionScope.LogInfo("Enabled task {Path}", fullPath);
@@ -121,7 +138,8 @@ public static class ScheduledTaskService
Translations.Service_ScheduledTask_Name,
description,
true,
- revertStep);
+ revertStep
+ );
return true;
}
catch (UnauthorizedAccessException)
@@ -134,7 +152,8 @@ public static class ScheduledTaskService
false,
null,
Translations.Service_Common_Error_AccessDenied,
- () => System.Threading.Tasks.Task.FromResult(EnableTask(fullPath)));
+ () => System.Threading.Tasks.Task.FromResult(EnableTask(fullPath))
+ );
return false;
}
catch (Exception ex)
@@ -147,7 +166,8 @@ public static class ScheduledTaskService
false,
null,
ex.Message,
- () => System.Threading.Tasks.Task.FromResult(EnableTask(fullPath)));
+ () => System.Threading.Tasks.Task.FromResult(EnableTask(fullPath))
+ );
return false;
}
}
@@ -164,12 +184,15 @@ public static class ScheduledTaskService
CollectTasks(ts.RootFolder, results);
// Extract icons from task commands
- Parallel.ForEach(results, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount },
+ Parallel.ForEach(
+ results,
+ new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount },
task =>
{
if (!string.IsNullOrWhiteSpace(task.ActionSummary))
task.LogoImage = StartupManagerService.ExtractIcon(task.ActionSummary);
- });
+ }
+ );
}
catch (Exception ex)
{
@@ -195,8 +218,11 @@ public static class ScheduledTaskService
try
{
using var ts = new TaskService();
- var task = ts.GetTask(fullPath) ?? throw new InvalidOperationException(
- string.Format(Translations.ScheduledTasks_Error_TaskNotFound, fullPath));
+ var task =
+ ts.GetTask(fullPath)
+ ?? throw new InvalidOperationException(
+ string.Format(Translations.ScheduledTasks_Error_TaskNotFound, fullPath)
+ );
task.Run();
ExecutionScope.LogInfo("Started task {Path}", fullPath);
}
@@ -212,8 +238,11 @@ public static class ScheduledTaskService
try
{
using var ts = new TaskService();
- var task = ts.GetTask(fullPath) ?? throw new InvalidOperationException(
- string.Format(Translations.ScheduledTasks_Error_TaskNotFound, fullPath));
+ var task =
+ ts.GetTask(fullPath)
+ ?? throw new InvalidOperationException(
+ string.Format(Translations.ScheduledTasks_Error_TaskNotFound, fullPath)
+ );
task.Stop();
ExecutionScope.LogInfo("Stopped task {Path}", fullPath);
}
@@ -237,7 +266,11 @@ public static class ScheduledTaskService
}
catch (Exception ex)
{
- ExecutionScope.LogDebug("Failed to get state for task {Path}: {Error}", fullPath, ex.Message);
+ ExecutionScope.LogDebug(
+ "Failed to get state for task {Path}: {Error}",
+ fullPath,
+ ex.Message
+ );
return null;
}
}
@@ -247,8 +280,11 @@ public static class ScheduledTaskService
try
{
using var ts = new TaskService();
- var task = ts.GetTask(fullPath) ?? throw new InvalidOperationException(
- string.Format(Translations.ScheduledTasks_Error_TaskNotFound, fullPath));
+ var task =
+ ts.GetTask(fullPath)
+ ?? throw new InvalidOperationException(
+ string.Format(Translations.ScheduledTasks_Error_TaskNotFound, fullPath)
+ );
var folderPath = task.Folder.Path;
ts.GetFolder(folderPath).DeleteTask(task.Name);
ExecutionScope.LogInfo("Deleted task {Path}", fullPath);
@@ -305,7 +341,9 @@ public static class ScheduledTaskService
if (model.HasRegistrationTrigger)
td.Triggers.Add(new RegistrationTrigger());
if (model.HasDailyTrigger)
- td.Triggers.Add(new DailyTrigger { StartBoundary = DateTime.Today + model.DailyTriggerTime });
+ td.Triggers.Add(
+ new DailyTrigger { StartBoundary = DateTime.Today + model.DailyTriggerTime }
+ );
// Ensure folder exists
var folder = ts.RootFolder;
@@ -320,11 +358,20 @@ public static class ScheduledTaskService
}
folder.RegisterTaskDefinition(model.Name, td);
- ExecutionScope.LogInfo("Registered task {Name} in folder {Folder}", model.Name, folderPath);
+ ExecutionScope.LogInfo(
+ "Registered task {Name} in folder {Folder}",
+ model.Name,
+ folderPath
+ );
}
catch (Exception ex)
{
- ExecutionScope.LogError(ex, "Failed to register task {Name} in {Folder}", model.Name, folderPath);
+ ExecutionScope.LogError(
+ ex,
+ "Failed to register task {Name} in {Folder}",
+ model.Name,
+ folderPath
+ );
throw;
}
}
@@ -342,7 +389,11 @@ public static class ScheduledTaskService
}
catch (Exception ex)
{
- ExecutionScope.LogDebug("Failed to map task {Name}: {Error}", task.Name, ex.Message);
+ ExecutionScope.LogDebug(
+ "Failed to map task {Name}: {Error}",
+ task.Name,
+ ex.Message
+ );
}
foreach (var subFolder in folder.SubFolders)
@@ -350,7 +401,11 @@ public static class ScheduledTaskService
}
catch (Exception ex)
{
- ExecutionScope.LogDebug("Failed to enumerate folder {Path}: {Error}", folder.Path, ex.Message);
+ ExecutionScope.LogDebug(
+ "Failed to enumerate folder {Path}: {Error}",
+ folder.Path,
+ ex.Message
+ );
}
}
@@ -389,9 +444,9 @@ public static class ScheduledTaskService
NextRunTime = task.NextRunTime == DateTime.MinValue ? null : task.NextRunTime,
LastRunResult = task.LastTaskResult,
HasLogonTrigger = hasLogon,
- HasBootTrigger = hasBoot
+ HasBootTrigger = hasBoot,
};
}
#endregion Helpers
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Services/Optimization/Providers/ServiceProcessService.cs b/optimizerDuck/Services/Optimization/Providers/ServiceProcessService.cs
index cf40298..9945065 100644
--- a/optimizerDuck/Services/Optimization/Providers/ServiceProcessService.cs
+++ b/optimizerDuck/Services/Optimization/Providers/ServiceProcessService.cs
@@ -24,27 +24,39 @@ public static class ServiceProcessService
if (start == 2)
{
- var isDelayed = RegistryService.Read<int>(new RegistryItem(serviceKey, "DelayedAutoStart"));
- return isDelayed == 1 ? ServiceStartupType.AutomaticDelayedStart : ServiceStartupType.Automatic;
+ var isDelayed = RegistryService.Read<int>(
+ new RegistryItem(serviceKey, "DelayedAutoStart")
+ );
+ return isDelayed == 1
+ ? ServiceStartupType.AutomaticDelayedStart
+ : ServiceStartupType.Automatic;
}
return start switch
{
3 => ServiceStartupType.Manual,
4 => ServiceStartupType.Disabled,
- _ => null
+ _ => null,
};
}
catch (Exception ex)
{
- ExecutionScope.LogError(ex, "Failed to get startup type for {ServiceName}", serviceName);
+ ExecutionScope.LogError(
+ ex,
+ "Failed to get startup type for {ServiceName}",
+ serviceName
+ );
return null;
}
}
public static bool ChangeServiceStartupType(ServiceItem item)
{
- var description = string.Format(Translations.Service_Service_Description_Change, item.Name, item.StartupType);
+ var description = string.Format(
+ Translations.Service_Service_Description_Change,
+ item.Name,
+ item.StartupType
+ );
var sw = Stopwatch.StartNew();
try
@@ -57,18 +69,22 @@ public static class ServiceProcessService
ServiceStartupType.Automatic or ServiceStartupType.AutomaticDelayedStart => 2,
ServiceStartupType.Manual => 3,
ServiceStartupType.Disabled => 4,
- _ => 3
+ _ => 3,
};
var serviceKey = $@"HKLM\SYSTEM\CurrentControlSet\Services\{item.Name}";
// 1. Change the main 'Start' value
- var mainSuccess = RegistryService.Write(new RegistryItem(serviceKey, "Start", startValue));
+ var mainSuccess = RegistryService.Write(
+ new RegistryItem(serviceKey, "Start", startValue)
+ );
// 2. Handle 'DelayedAutoStart' if necessary
var delayedSuccess = true;
if (item.StartupType == ServiceStartupType.AutomaticDelayedStart)
- delayedSuccess = RegistryService.Write(new RegistryItem(serviceKey, "DelayedAutoStart", 1));
+ delayedSuccess = RegistryService.Write(
+ new RegistryItem(serviceKey, "DelayedAutoStart", 1)
+ );
else
// Always try to delete for consistency, but don't fail if it doesn't exist
RegistryService.DeleteValue(new RegistryItem(serviceKey, "DelayedAutoStart"));
@@ -83,7 +99,7 @@ public static class ServiceProcessService
revertStep = new ServiceRevertStep
{
ServiceName = item.Name,
- OriginalStartupType = originalStartupType.Value
+ OriginalStartupType = originalStartupType.Value,
};
ExecutionScope.LogInfo(
@@ -94,26 +110,53 @@ public static class ServiceProcessService
);
ExecutionScope.Track(nameof(ChangeServiceStartupType), true);
- ExecutionScope.RecordStep(Translations.Service_Service_Name, description, true, revertStep);
+ ExecutionScope.RecordStep(
+ Translations.Service_Service_Name,
+ description,
+ true,
+ revertStep
+ );
return true;
}
- ExecutionScope.LogInfo("[SERVICE][{Name}][FAIL][D={Duration}] startup -> {StartupType}", item.Name,
- sw.Elapsed.FormatTime(), item.StartupType);
+ ExecutionScope.LogInfo(
+ "[SERVICE][{Name}][FAIL][D={Duration}] startup -> {StartupType}",
+ item.Name,
+ sw.Elapsed.FormatTime(),
+ item.StartupType
+ );
ExecutionScope.Track(nameof(ChangeServiceStartupType), false);
- ExecutionScope.RecordStep(Translations.Service_Service_Name, description, false, null,
+ ExecutionScope.RecordStep(
+ Translations.Service_Service_Name,
+ description,
+ false,
+ null,
Translations.Service_Service_Error_UpdateRegistryForStartupTypeFailed,
- () => Task.FromResult(ChangeServiceStartupType(item)));
+ () => Task.FromResult(ChangeServiceStartupType(item))
+ );
return false;
}
catch (Exception ex)
{
- ExecutionScope.LogError(ex, "[SERVICE][{Name}][FAIL][EXCEPTION] startup -> {StartupType}", item.Name,
- item.StartupType);
+ ExecutionScope.LogError(
+ ex,
+ "[SERVICE][{Name}][FAIL][EXCEPTION] startup -> {StartupType}",
+ item.Name,
+ item.StartupType
+ );
ExecutionScope.Track(nameof(ChangeServiceStartupType), false);
- ExecutionScope.RecordStep(Translations.Service_Service_Name, description, false, null,
- string.Format(Translations.Service_Service_Error_ExceptionOccurred, item.Name, ex.Message),
- () => Task.FromResult(ChangeServiceStartupType(item)));
+ ExecutionScope.RecordStep(
+ Translations.Service_Service_Name,
+ description,
+ false,
+ null,
+ string.Format(
+ Translations.Service_Service_Error_ExceptionOccurred,
+ item.Name,
+ ex.Message
+ ),
+ () => Task.FromResult(ChangeServiceStartupType(item))
+ );
return false;
}
}
@@ -123,4 +166,4 @@ public static class ServiceProcessService
foreach (var item in items)
ChangeServiceStartupType(item);
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Services/Optimization/Providers/ShellService.cs b/optimizerDuck/Services/Optimization/Providers/ShellService.cs
index 99c7b98..1297f7f 100644
--- a/optimizerDuck/Services/Optimization/Providers/ShellService.cs
+++ b/optimizerDuck/Services/Optimization/Providers/ShellService.cs
@@ -17,18 +17,22 @@ public sealed class ShellPolicy
public Func<ShellResult, bool> IsSuccess { get; init; } = r => r.ExitCode == 0;
public Func<ShellResult, string?> ErrorFactory { get; init; } =
- r => r.ExitCode == -1 // if timed out use Error.TimedOut
- ? Translations.Service_Shell_Error_TimedOut
+ r =>
+ r.ExitCode == -1 // if timed out use Error.TimedOut
+ ? Translations.Service_Shell_Error_TimedOut
: string.IsNullOrWhiteSpace(r.Stderr) // else check stderr, if empty use exitcode, else use raw stderr
? string.Format(Translations.Service_Shell_Error_ExitCode, r.ExitCode)
- : r.Stderr;
+ : r.Stderr;
- public static ShellPolicy From(Func<ShellResult, bool> isSuccess, Func<ShellResult, string?>? errorFactory = null)
+ public static ShellPolicy From(
+ Func<ShellResult, bool> isSuccess,
+ Func<ShellResult, string?>? errorFactory = null
+ )
{
return new ShellPolicy
{
IsSuccess = isSuccess,
- ErrorFactory = errorFactory ?? Default.ErrorFactory
+ ErrorFactory = errorFactory ?? Default.ErrorFactory,
};
}
@@ -53,16 +57,22 @@ public static class ShellService
}
private static (string commandForUser, string fullCommandForUser) SanitizeCommandForUser(
- string fileName, string arguments, string command)
+ string fileName,
+ string arguments,
+ string command
+ )
{
- var commandForUser = (arguments.Contains("-EncodedCommand", StringComparison.OrdinalIgnoreCase)
+ var commandForUser = (
+ arguments.Contains("-EncodedCommand", StringComparison.OrdinalIgnoreCase)
? command.DecodeBase64()
- : command)
+ : command
+ )
.Replace("$ProgressPreference='SilentlyContinue'; ", "")
.Replace("[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; ", "")
.Replace(
"$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8; ",
- "")
+ ""
+ )
.Replace("chcp 65001 > nul & ", "");
var fullCommandForUser =
@@ -77,16 +87,16 @@ public static class ShellService
string command,
string serviceName,
ShellRevertStep? revertStep,
- ShellPolicy? policy = null)
+ ShellPolicy? policy = null
+ )
{
policy ??= ShellPolicy.Default;
var (_, fullCommandForUser) = SanitizeCommandForUser(fileName, arguments, command);
var processArgs =
- fileName.Equals("cmd.exe", StringComparison.OrdinalIgnoreCase) &&
- !arguments.Contains(
- "chcp 65001") // try best effort to ensure UTF-8 codepage for cmd, but better use PowerShell if possible
+ fileName.Equals("cmd.exe", StringComparison.OrdinalIgnoreCase)
+ && !arguments.Contains("chcp 65001") // try best effort to ensure UTF-8 codepage for cmd, but better use PowerShell if possible
? $"{arguments} chcp 65001 > nul & {command}"
: $"{arguments} {command}";
@@ -99,7 +109,7 @@ public static class ShellService
StandardOutputEncoding = Encoding.UTF8,
StandardErrorEncoding = Encoding.UTF8,
UseShellExecute = false,
- CreateNoWindow = true
+ CreateNoWindow = true,
};
try
@@ -112,13 +122,15 @@ public static class ShellService
process.OutputDataReceived += (_, e) =>
{
- if (e.Data == null) return;
+ if (e.Data == null)
+ return;
stdoutBuilder.AppendLine(e.Data);
};
process.ErrorDataReceived += (_, e) =>
{
- if (e.Data == null) return;
+ if (e.Data == null)
+ return;
stderrBuilder.AppendLine(e.Data);
};
var sw = Stopwatch.StartNew();
@@ -127,8 +139,9 @@ public static class ShellService
process.BeginOutputReadLine();
process.BeginErrorReadLine();
- var exited =
- process.WaitForExit(_options?.CurrentValue.Optimize.ShellTimeoutMs ?? 120000); // fallback to 2 minutes
+ var exited = process.WaitForExit(
+ _options?.CurrentValue.Optimize.ShellTimeoutMs ?? 120000
+ ); // fallback to 2 minutes
var timedOut = !exited;
if (timedOut)
@@ -156,25 +169,31 @@ public static class ShellService
Stdout = stdout,
Stderr = stderr,
ExitCode = timedOut ? -1 : process.ExitCode, // use -1 error code for timed out
- Duration = duration
+ Duration = duration,
};
var success = policy.IsSuccess(result);
ExecutionScope.Track(serviceName, success);
- ExecutionScope.LogInfo("[{Service}][{Status}][EC={ExitCode}][D={Duration}] {Command}",
+ ExecutionScope.LogInfo(
+ "[{Service}][{Status}][EC={ExitCode}][D={Duration}] {Command}",
serviceName,
- timedOut ? "TIMEOUT" : success ? "OK" : "FAIL",
+ timedOut ? "TIMEOUT"
+ : success ? "OK"
+ : "FAIL",
result.ExitCode,
duration.FormatTime(),
- fullCommandForUser);
+ fullCommandForUser
+ );
- ExecutionScope.LogTrace("[{Service}][STDOUT] {Stdout}",
+ ExecutionScope.LogTrace(
+ "[{Service}][STDOUT] {Stdout}",
serviceName,
string.IsNullOrWhiteSpace(stdout) ? "N/A" : stdout
);
- ExecutionScope.LogTrace("[{Service}][STDERR] {Stderr}",
+ ExecutionScope.LogTrace(
+ "[{Service}][STDERR] {Stderr}",
serviceName,
string.IsNullOrWhiteSpace(stderr) ? "N/A" : stderr
);
@@ -189,17 +208,24 @@ public static class ShellService
error,
success
? null
- : () => Task.Run(() =>
- policy.IsSuccess(Run(fileName, arguments, command, serviceName, revertStep, policy))
- )
+ : () =>
+ Task.Run(() =>
+ policy.IsSuccess(
+ Run(fileName, arguments, command, serviceName, revertStep, policy)
+ )
+ )
);
return result;
}
catch (Exception ex)
{
- ExecutionScope.LogError(ex, "[{Service}][FAIL][EXCEPTION] {Command}",
- serviceName, fullCommandForUser);
+ ExecutionScope.LogError(
+ ex,
+ "[{Service}][FAIL][EXCEPTION] {Command}",
+ serviceName,
+ fullCommandForUser
+ );
ExecutionScope.Track(serviceName, false);
var result = new ShellResult
@@ -208,7 +234,7 @@ public static class ShellService
Stdout = string.Empty,
Stderr = ex.Message,
ExitCode = -2,
- Duration = TimeSpan.Zero
+ Duration = TimeSpan.Zero,
};
ExecutionScope.RecordStep(
@@ -217,9 +243,12 @@ public static class ShellService
false,
revertStep,
ex.Message,
- () => Task.Run(() =>
- policy.IsSuccess(Run(fileName, arguments, command, serviceName, revertStep, policy))
- )
+ () =>
+ Task.Run(() =>
+ policy.IsSuccess(
+ Run(fileName, arguments, command, serviceName, revertStep, policy)
+ )
+ )
);
return result;
@@ -233,7 +262,8 @@ public static class ShellService
string serviceName,
ShellRevertStep? revertStep,
ShellPolicy? policy = null,
- CancellationToken ct = default)
+ CancellationToken ct = default
+ )
{
policy ??= ShellPolicy.Default;
@@ -248,7 +278,7 @@ public static class ShellService
StandardOutputEncoding = Encoding.UTF8,
StandardErrorEncoding = Encoding.UTF8,
UseShellExecute = false,
- CreateNoWindow = true
+ CreateNoWindow = true,
};
try
@@ -261,12 +291,14 @@ public static class ShellService
process.OutputDataReceived += (_, e) =>
{
- if (e.Data != null) stdoutBuilder.AppendLine(e.Data);
+ if (e.Data != null)
+ stdoutBuilder.AppendLine(e.Data);
};
process.ErrorDataReceived += (_, e) =>
{
- if (e.Data != null) stderrBuilder.AppendLine(e.Data);
+ if (e.Data != null)
+ stderrBuilder.AppendLine(e.Data);
};
var sw = Stopwatch.StartNew();
@@ -278,7 +310,10 @@ public static class ShellService
var timeout = _options?.CurrentValue.Optimize.ShellTimeoutMs ?? 120000;
using var timeoutCts = new CancellationTokenSource(timeout);
- using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(timeoutCts.Token, ct);
+ using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
+ timeoutCts.Token,
+ ct
+ );
try
{
@@ -290,9 +325,7 @@ public static class ShellService
{
process.Kill(true);
}
- catch
- {
- }
+ catch { }
}
sw.Stop();
@@ -310,27 +343,35 @@ public static class ShellService
Stdout = stdout,
Stderr = stderr,
ExitCode = timedOut ? -1 : process.ExitCode,
- Duration = sw.Elapsed
+ Duration = sw.Elapsed,
};
var success = policy.IsSuccess(result);
ExecutionScope.Track(serviceName, success);
- ExecutionScope.LogInfo("[{Service}][{Status}][EC={ExitCode}][D={Duration}] {Command}",
+ ExecutionScope.LogInfo(
+ "[{Service}][{Status}][EC={ExitCode}][D={Duration}] {Command}",
serviceName,
- timedOut ? "TIMEOUT" : success ? "OK" : "FAIL",
+ timedOut ? "TIMEOUT"
+ : success ? "OK"
+ : "FAIL",
result.ExitCode,
sw.Elapsed.FormatTime(),
- fullCommandForUser);
+ fullCommandForUser
+ );
- ExecutionScope.LogTrace("[{Service}][STDOUT] {Stdout}",
+ ExecutionScope.LogTrace(
+ "[{Service}][STDOUT] {Stdout}",
serviceName,
- string.IsNullOrWhiteSpace(stdout) ? "N/A" : stdout);
+ string.IsNullOrWhiteSpace(stdout) ? "N/A" : stdout
+ );
- ExecutionScope.LogTrace("[{Service}][STDERR] {Stderr}",
+ ExecutionScope.LogTrace(
+ "[{Service}][STDERR] {Stderr}",
serviceName,
- string.IsNullOrWhiteSpace(stderr) ? "N/A" : stderr);
+ string.IsNullOrWhiteSpace(stderr) ? "N/A" : stderr
+ );
var error = success ? null : policy.ErrorFactory(result);
@@ -343,16 +384,29 @@ public static class ShellService
success
? null
: async () =>
- policy.IsSuccess(await RunAsync(fileName, arguments, command, serviceName, revertStep, policy,
- ct))
+ policy.IsSuccess(
+ await RunAsync(
+ fileName,
+ arguments,
+ command,
+ serviceName,
+ revertStep,
+ policy,
+ ct
+ )
+ )
);
return result;
}
catch (Exception ex)
{
- ExecutionScope.LogError(ex, "[{Service}][FAIL][EXCEPTION] {Command}",
- serviceName, fullCommandForUser);
+ ExecutionScope.LogError(
+ ex,
+ "[{Service}][FAIL][EXCEPTION] {Command}",
+ serviceName,
+ fullCommandForUser
+ );
ExecutionScope.Track(serviceName, false);
var result = new ShellResult
@@ -361,7 +415,7 @@ public static class ShellService
Stdout = string.Empty,
Stderr = ex.Message,
ExitCode = -2,
- Duration = TimeSpan.Zero
+ Duration = TimeSpan.Zero,
};
ExecutionScope.RecordStep(
@@ -370,8 +424,19 @@ public static class ShellService
false,
revertStep,
ex.Message,
- async () => policy.IsSuccess(await RunAsync(fileName, arguments, command, serviceName, revertStep,
- policy, ct)));
+ async () =>
+ policy.IsSuccess(
+ await RunAsync(
+ fileName,
+ arguments,
+ command,
+ serviceName,
+ revertStep,
+ policy,
+ ct
+ )
+ )
+ );
return result;
}
@@ -386,7 +451,11 @@ public static class ShellService
/// <param name="revertStep">The revert step to record.</param>
/// <param name="policy">The policy to use for determining success.</param>
/// <returns>The result of the command execution.</returns>
- public static ShellResult CMD(string command, ShellRevertStep? revertStep = null, ShellPolicy? policy = null)
+ public static ShellResult CMD(
+ string command,
+ ShellRevertStep? revertStep = null,
+ ShellPolicy? policy = null
+ )
{
return Run("cmd.exe", "/c", command, nameof(CMD), revertStep, policy);
}
@@ -403,16 +472,10 @@ public static class ShellService
string command,
ShellRevertStep? revertStep = null,
ShellPolicy? policy = null,
- CancellationToken ct = default)
+ CancellationToken ct = default
+ )
{
- return RunAsync(
- "cmd.exe",
- "/c",
- command,
- nameof(CMD),
- revertStep,
- policy,
- ct);
+ return RunAsync("cmd.exe", "/c", command, nameof(CMD), revertStep, policy, ct);
}
/// <summary>
@@ -424,11 +487,11 @@ public static class ShellService
/// <returns>The result of the command execution.</returns>
public static ShellResult CMD(string command, string revertCommand, ShellPolicy? policy = null)
{
- return CMD(command, new ShellRevertStep
- {
- ShellType = ShellType.CMD,
- Command = revertCommand
- }, policy);
+ return CMD(
+ command,
+ new ShellRevertStep { ShellType = ShellType.CMD, Command = revertCommand },
+ policy
+ );
}
/// <summary>
@@ -438,13 +501,17 @@ public static class ShellService
/// <param name="revertCommand">The command to execute for reverting.</param>
/// <param name="policy">The policy to use for determining success.</param>
/// <returns>The result of the command execution.</returns>
- public static ShellResult CMD(string command, Func<string> revertCommand, ShellPolicy? policy = null)
+ public static ShellResult CMD(
+ string command,
+ Func<string> revertCommand,
+ ShellPolicy? policy = null
+ )
{
- return CMD(command, new ShellRevertStep
- {
- ShellType = ShellType.CMD,
- Command = revertCommand()
- }, policy);
+ return CMD(
+ command,
+ new ShellRevertStep { ShellType = ShellType.CMD, Command = revertCommand() },
+ policy
+ );
}
#endregion Command Prompt methods
@@ -458,19 +525,25 @@ public static class ShellService
/// <param name="revertStep">The revert step to record.</param>
/// <param name="policy">The policy to use for determining success.</param>
/// <returns>The result of the command execution.</returns>
- public static ShellResult PowerShell(string command, ShellRevertStep? revertStep = null, ShellPolicy? policy = null)
+ public static ShellResult PowerShell(
+ string command,
+ ShellRevertStep? revertStep = null,
+ ShellPolicy? policy = null
+ )
{
command =
- "$ProgressPreference='SilentlyContinue'; " +
- "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; " +
- "$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8; " +
- command;
- return Run("powershell.exe",
+ "$ProgressPreference='SilentlyContinue'; "
+ + "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; "
+ + "$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8; "
+ + command;
+ return Run(
+ "powershell.exe",
"-NonInteractive -NoLogo -NoProfile -ExecutionPolicy Bypass -EncodedCommand",
command.EncodeBase64(),
nameof(PowerShell),
revertStep,
- policy);
+ policy
+ );
}
/// <summary>
@@ -485,20 +558,23 @@ public static class ShellService
string command,
ShellRevertStep? revertStep = null,
ShellPolicy? policy = null,
- CancellationToken ct = default)
+ CancellationToken ct = default
+ )
{
command =
- "$ProgressPreference='SilentlyContinue'; " +
- "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; " +
- "$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8; " +
- command;
- return RunAsync("powershell.exe",
+ "$ProgressPreference='SilentlyContinue'; "
+ + "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; "
+ + "$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8; "
+ + command;
+ return RunAsync(
+ "powershell.exe",
"-NonInteractive -NoLogo -NoProfile -ExecutionPolicy Bypass -EncodedCommand",
command.EncodeBase64(),
nameof(PowerShell),
revertStep,
policy,
- ct);
+ ct
+ );
}
/// <summary>
@@ -508,13 +584,17 @@ public static class ShellService
/// <param name="revertCommand">The command to execute for reverting.</param>
/// <param name="policy">The policy to use for determining success.</param>
/// <returns>The result of the command execution.</returns>
- public static ShellResult PowerShell(string command, string revertCommand, ShellPolicy? policy = null)
+ public static ShellResult PowerShell(
+ string command,
+ string revertCommand,
+ ShellPolicy? policy = null
+ )
{
- return PowerShell(command, new ShellRevertStep
- {
- ShellType = ShellType.PowerShell,
- Command = revertCommand
- }, policy);
+ return PowerShell(
+ command,
+ new ShellRevertStep { ShellType = ShellType.PowerShell, Command = revertCommand },
+ policy
+ );
}
/// <summary>
@@ -524,14 +604,18 @@ public static class ShellService
/// <param name="revertCommand">The command to execute for reverting.</param>
/// <param name="policy">The policy to use for determining success.</param>
/// <returns>The result of the command execution.</returns>
- public static ShellResult PowerShell(string command, Func<string> revertCommand, ShellPolicy? policy = null)
+ public static ShellResult PowerShell(
+ string command,
+ Func<string> revertCommand,
+ ShellPolicy? policy = null
+ )
{
- return PowerShell(command, new ShellRevertStep
- {
- ShellType = ShellType.PowerShell,
- Command = revertCommand()
- }, policy);
+ return PowerShell(
+ command,
+ new ShellRevertStep { ShellType = ShellType.PowerShell, Command = revertCommand() },
+ policy
+ );
}
#endregion PowerShell methods
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Services/Revert/RevertManager.cs b/optimizerDuck/Services/Revert/RevertManager.cs
index f1d067f..a58920a 100644
--- a/optimizerDuck/Services/Revert/RevertManager.cs
+++ b/optimizerDuck/Services/Revert/RevertManager.cs
@@ -16,15 +16,18 @@ namespace optimizerDuck.Services.Managers;
public class RevertManager(ILogger<RevertManager> logger, ILoggerFactory loggerFactory)
{
- private static readonly Dictionary<string, Func<JObject, IRevertStep>> _stepRegistry = BuildStepRegistry();
+ private static readonly Dictionary<string, Func<JObject, IRevertStep>> _stepRegistry =
+ BuildStepRegistry();
private static readonly ConcurrentDictionary<Guid, SemaphoreSlim> _fileLocks = new();
public async Task SaveRevertDataAsync(ExecutionScope scope)
{
var maxIndex = scope.ExecutedSteps.Count == 0 ? 0 : scope.ExecutedSteps.Max(s => s.Index);
- if (maxIndex == 0) return;
+ if (maxIndex == 0)
+ return;
- var steps = Enumerable.Range(0, maxIndex)
+ var steps = Enumerable
+ .Range(0, maxIndex)
.Select(_ => new RevertStepData { Type = "Unknown", Data = new JObject() })
.ToList();
var hasRevertStep = false;
@@ -34,31 +37,48 @@ public class RevertManager(ILogger<RevertManager> logger, ILoggerFactory loggerF
if (step.RevertStep == null)
continue;
- steps[step.Index - 1] = new RevertStepData { Type = step.RevertStep.Type, Data = step.RevertStep.ToData() };
+ steps[step.Index - 1] = new RevertStepData
+ {
+ Type = step.RevertStep.Type,
+ Data = step.RevertStep.ToData(),
+ };
hasRevertStep = true;
}
- if (!hasRevertStep) return;
+ if (!hasRevertStep)
+ return;
- await WriteJsonAsync(GetFilePath(scope.OptimizationId!.Value), new RevertData
- {
- OptimizationId = scope.OptimizationId!.Value,
- OptimizationName = scope.OptimizationKey!,
- AppliedAt = DateTime.Now,
- Steps = steps
- });
+ await WriteJsonAsync(
+ GetFilePath(scope.OptimizationId!.Value),
+ new RevertData
+ {
+ OptimizationId = scope.OptimizationId!.Value,
+ OptimizationName = scope.OptimizationKey!,
+ AppliedAt = DateTime.Now,
+ Steps = steps,
+ }
+ );
}
- public async Task<RevertResult> RevertAsync(IOptimization optimization,
- IProgress<ProcessingProgress>? progress = null)
+ public async Task<RevertResult> RevertAsync(
+ IOptimization optimization,
+ IProgress<ProcessingProgress>? progress = null
+ )
{
var operationLogger = loggerFactory.CreateLogger<RevertManager>();
- using var scope = ExecutionScope.BeginForLogging(optimization.Id, optimization.OptimizationKey, operationLogger);
+ using var scope = ExecutionScope.BeginForLogging(
+ optimization.Id,
+ optimization.OptimizationKey,
+ operationLogger
+ );
var steps = await LoadStepsAsync(optimization.Id);
if (steps.Count == 0)
return new RevertResult
- { Success = false, Message = string.Format(Translations.Revert_Error_NoDataFound, optimization.Name) };
+ {
+ Success = false,
+ Message = string.Format(Translations.Revert_Error_NoDataFound, optimization.Name),
+ };
var failedSteps = new List<OperationStepResult>();
var total = steps.Count;
@@ -66,23 +86,38 @@ public class RevertManager(ILogger<RevertManager> logger, ILoggerFactory loggerF
for (var i = total - 1; i >= 0; i--)
{
var (idx, step) = steps[i];
- progress?.Report(new ProcessingProgress
- {
- Message = string.Format(Translations.Optimization_Revert_ExecutingStep, idx, total, step.Type),
- Value = idx, Total = total
- });
+ progress?.Report(
+ new ProcessingProgress
+ {
+ Message = string.Format(
+ Translations.Optimization_Revert_ExecutingStep,
+ idx,
+ total,
+ step.Type
+ ),
+ Value = idx,
+ Total = total,
+ }
+ );
try
{
- if (!await step.ExecuteAsync()) throw new Exception(Translations.Revert_Error_StepFailed);
+ if (!await step.ExecuteAsync())
+ throw new Exception(Translations.Revert_Error_StepFailed);
}
catch (Exception ex)
{
- failedSteps.Add(new OperationStepResult
- {
- Index = idx, Name = step.Type, Description = step.Description, Success = false, Error = ex.Message,
- RetryAction = () => step.ExecuteAsync()
- });
+ failedSteps.Add(
+ new OperationStepResult
+ {
+ Index = idx,
+ Name = step.Type,
+ Description = step.Description,
+ Success = false,
+ Error = ex.Message,
+ RetryAction = () => step.ExecuteAsync(),
+ }
+ );
}
}
@@ -93,17 +128,29 @@ public class RevertManager(ILogger<RevertManager> logger, ILoggerFactory loggerF
{
Success = failedSteps.Count == 0,
AllStepsFailed = failedSteps.Count == total,
- Message = failedSteps.Count == total
- ? string.Format(Translations.Optimization_Revert_Error_Failed, optimization.Name)
+ Message =
+ failedSteps.Count == total
+ ? string.Format(
+ Translations.Optimization_Revert_Error_Failed,
+ optimization.Name
+ )
: failedSteps.Count > 0
- ? string.Format(Translations.Optimization_Revert_Error_FailedWithSteps, optimization.Name,
- failedSteps.Count)
- : string.Format(Translations.Optimization_Revert_Success, optimization.Name),
- FailedSteps = failedSteps
+ ? string.Format(
+ Translations.Optimization_Revert_Error_FailedWithSteps,
+ optimization.Name,
+ failedSteps.Count
+ )
+ : string.Format(Translations.Optimization_Revert_Success, optimization.Name),
+ FailedSteps = failedSteps,
};
}
- public async Task UpsertRevertStepAtIndexAsync(Guid id, string name, int stepIndex, IRevertStep step)
+ public async Task UpsertRevertStepAtIndexAsync(
+ Guid id,
+ string name,
+ int stepIndex,
+ IRevertStep step
+ )
{
var filePath = GetFilePath(id);
var lockObj = _fileLocks.GetOrAdd(id, _ => new SemaphoreSlim(1, 1));
@@ -111,13 +158,23 @@ public class RevertManager(ILogger<RevertManager> logger, ILoggerFactory loggerF
await lockObj.WaitAsync();
try
{
- var data = await LoadAsync(filePath) ?? new RevertData
- { OptimizationId = id, OptimizationName = name, Steps = [] };
+ var data =
+ await LoadAsync(filePath)
+ ?? new RevertData
+ {
+ OptimizationId = id,
+ OptimizationName = name,
+ Steps = [],
+ };
while (data.Steps.Count < stepIndex)
data.Steps.Add(new RevertStepData { Type = "Unknown", Data = new JObject() });
- data.Steps[stepIndex - 1] = new RevertStepData { Type = step.Type, Data = step.ToData() };
+ data.Steps[stepIndex - 1] = new RevertStepData
+ {
+ Type = step.Type,
+ Data = step.ToData(),
+ };
await WriteJsonAsync(filePath, data);
}
finally
@@ -138,7 +195,8 @@ public class RevertManager(ILogger<RevertManager> logger, ILoggerFactory loggerF
public static void ClearAllRevertData(ILogger logger)
{
- if (!Directory.Exists(Shared.RevertDirectory)) return;
+ if (!Directory.Exists(Shared.RevertDirectory))
+ return;
foreach (var f in Directory.GetFiles(Shared.RevertDirectory))
try
{
@@ -159,7 +217,8 @@ public class RevertManager(ILogger<RevertManager> logger, ILoggerFactory loggerF
private static async Task<RevertData?> LoadAsync(string path)
{
- if (!File.Exists(path)) return null;
+ if (!File.Exists(path))
+ return null;
try
{
return JsonConvert.DeserializeObject<RevertData>(await File.ReadAllTextAsync(path));
@@ -184,13 +243,15 @@ public class RevertManager(ILogger<RevertManager> logger, ILoggerFactory loggerF
private async Task<List<(int Index, IRevertStep Step)>> LoadStepsAsync(Guid id)
{
var data = await LoadAsync(GetFilePath(id));
- if (data == null || data.Steps.Count == 0) return [];
+ if (data == null || data.Steps.Count == 0)
+ return [];
var result = new List<(int, IRevertStep)>();
for (var i = 0; i < data.Steps.Count; i++)
{
var step = DeserializeStep(data.Steps[i].Type, data.Steps[i].Data);
- if (step != null) result.Add((i + 1, step));
+ if (step != null)
+ result.Add((i + 1, step));
}
return result;
@@ -221,18 +282,18 @@ public class RevertManager(ILogger<RevertManager> logger, ILoggerFactory loggerF
{
var instance = (IRevertStep)Activator.CreateInstance(type)!;
var method = type.GetMethod("FromData", BindingFlags.Static | BindingFlags.Public);
- if (method != null) dict[instance.Type] = data => (IRevertStep)method.Invoke(null, [data])!;
- }
- catch
- {
+ if (method != null)
+ dict[instance.Type] = data => (IRevertStep)method.Invoke(null, [data])!;
}
+ catch { }
return dict;
}
private IRevertStep? DeserializeStep(string type, JToken data)
{
- if (data is not JObject obj) return null;
+ if (data is not JObject obj)
+ return null;
return _stepRegistry.TryGetValue(type, out var factory) ? factory(obj) : null;
}
diff --git a/optimizerDuck/Services/System/StreamService.cs b/optimizerDuck/Services/System/StreamService.cs
index 24f06cc..79380d0 100644
--- a/optimizerDuck/Services/System/StreamService.cs
+++ b/optimizerDuck/Services/System/StreamService.cs
@@ -11,7 +11,8 @@ public class StreamService(ILogger<StreamService> logger)
public async Task<(bool Success, string? FilePath)> TryDownloadAsync(
string url,
- string fileName)
+ string fileName
+ )
{
var filePath = Path.Combine(Shared.ResourcesDirectory, fileName);
@@ -27,12 +28,21 @@ public class StreamService(ILogger<StreamService> logger)
response.EnsureSuccessStatusCode();
- await using var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.None);
+ await using var fs = new FileStream(
+ filePath,
+ FileMode.Create,
+ FileAccess.Write,
+ FileShare.None
+ );
await response.Content.CopyToAsync(fs).ConfigureAwait(false);
var length = fs.Length;
- logger.LogInformation("Successfully downloaded {Length} bytes from {Url} to {FilePath}", length, url,
- filePath);
+ logger.LogInformation(
+ "Successfully downloaded {Length} bytes from {Url} to {FilePath}",
+ length,
+ url,
+ filePath
+ );
return (true, filePath);
}
@@ -57,4 +67,4 @@ public class StreamService(ILogger<StreamService> logger)
return (false, null);
}
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Services/System/SystemInfoService.cs b/optimizerDuck/Services/System/SystemInfoService.cs
index 447d067..83c0b18 100644
--- a/optimizerDuck/Services/System/SystemInfoService.cs
+++ b/optimizerDuck/Services/System/SystemInfoService.cs
@@ -28,7 +28,7 @@ public enum GpuVendor
AMD,
/// <summary>Intel Corporation.</summary>
- Intel
+ Intel,
}
/// <summary>
@@ -43,7 +43,7 @@ public sealed record GpuInfo
{
Name = Translations.Common_Unknown,
DriverVersion = Translations.Common_Unknown,
- Vendor = GpuVendor.Unknown
+ Vendor = GpuVendor.Unknown,
};
/// <summary>
@@ -79,8 +79,7 @@ public sealed record GpuInfo
/// <inheritdoc />
public override string ToString()
{
- return
- $"GPU: {Name}, Driver: {DriverVersion}, Vendor: {Vendor}, Memory: {MemoryMB} MB, DeviceId: {DeviceId}, PnpDeviceId: {PnpDeviceId}";
+ return $"GPU: {Name}, Driver: {DriverVersion}, Vendor: {Vendor}, Memory: {MemoryMB} MB, DeviceId: {DeviceId}, PnpDeviceId: {PnpDeviceId}";
}
}
@@ -103,7 +102,7 @@ public sealed record CpuInfo
MaxClockMHz = 0,
CurrentClockMHz = 0,
L2CacheKB = 0,
- L3CacheKB = 0
+ L3CacheKB = 0,
};
/// <summary>
@@ -284,7 +283,15 @@ public sealed record RamInfo
/// A sentinel value representing unknown RAM information.
/// </summary>
public static readonly RamInfo Unknown = new()
- { TotalGB = 0, TotalMB = 0, TotalKB = 0, AvailableGB = 0, UsedPercent = 0, UsedGB = 0, Modules = [] };
+ {
+ TotalGB = 0,
+ TotalMB = 0,
+ TotalKB = 0,
+ AvailableGB = 0,
+ UsedPercent = 0,
+ UsedGB = 0,
+ Modules = [],
+ };
/// <summary>
/// The total installed RAM in gigabytes.
@@ -339,7 +346,7 @@ public sealed record OsInfo
Architecture = Translations.Common_Unknown,
DeviceType = Translations.Common_Unknown,
InstallDate = Translations.Common_Unknown,
- LastBootUpTime = Translations.Common_Unknown
+ LastBootUpTime = Translations.Common_Unknown,
};
/// <summary>
@@ -397,7 +404,7 @@ public sealed record BiosInfo
Version = Translations.Common_Unknown,
ReleaseDate = Translations.Common_Unknown,
SmbiosVersion = Translations.Common_Unknown,
- SerialNumber = Translations.Common_Unknown
+ SerialNumber = Translations.Common_Unknown,
};
/// <summary>
@@ -442,7 +449,7 @@ public sealed record SystemSnapshot
Bios = BiosInfo.Unknown,
Gpus = [],
PrimaryGpu = null,
- Disk = DiskInfo.Unknown
+ Disk = DiskInfo.Unknown,
};
/// <summary>
@@ -487,7 +494,9 @@ public sealed record SystemSnapshot
internal static class WmiHelper
{
- private static readonly Dictionary<string, ManagementScope> ScopeCache = new(StringComparer.OrdinalIgnoreCase);
+ private static readonly Dictionary<string, ManagementScope> ScopeCache = new(
+ StringComparer.OrdinalIgnoreCase
+ );
private static readonly Lock ScopeLock = new();
/// <summary>
@@ -507,7 +516,10 @@ internal static class WmiHelper
}
}
- public static IEnumerable<ManagementObject> Query(string query, string namespacePath = @"root\cimv2")
+ public static IEnumerable<ManagementObject> Query(
+ string query,
+ string namespacePath = @"root\cimv2"
+ )
{
try
{
@@ -538,7 +550,7 @@ internal static class WmiHelper
{
null => fallback,
string[] arr => arr.Length > 0 ? arr[0].Trim() : fallback,
- _ => value.ToString()?.Trim() ?? fallback
+ _ => value.ToString()?.Trim() ?? fallback,
};
}
catch
@@ -646,13 +658,17 @@ internal static class CpuProvider
var manufacturer = Translations.Common_Unknown;
var currentMHz = 0;
- using (var cpuKey = Registry.LocalMachine.OpenSubKey(
- @"HARDWARE\DESCRIPTION\System\CentralProcessor\0"))
+ using (
+ var cpuKey = Registry.LocalMachine.OpenSubKey(
+ @"HARDWARE\DESCRIPTION\System\CentralProcessor\0"
+ )
+ )
{
if (cpuKey != null)
{
name = cpuKey.GetValue("ProcessorNameString")?.ToString()?.Trim() ?? name;
- manufacturer = cpuKey.GetValue("VendorIdentifier")?.ToString()?.Trim() ?? manufacturer;
+ manufacturer =
+ cpuKey.GetValue("VendorIdentifier")?.ToString()?.Trim() ?? manufacturer;
currentMHz = cpuKey.GetValue("~MHz") is int mhz ? mhz : 0;
}
}
@@ -667,7 +683,8 @@ internal static class CpuProvider
var l3kb = 0;
var cpu = WmiHelper.GetFirst(
- "SELECT NumberOfCores, MaxClockSpeed, L2CacheSize, L3CacheSize FROM Win32_Processor");
+ "SELECT NumberOfCores, MaxClockSpeed, L2CacheSize, L3CacheSize FROM Win32_Processor"
+ );
if (cpu != null)
{
cores = WmiHelper.GetInt(cpu, "NumberOfCores");
@@ -676,7 +693,8 @@ internal static class CpuProvider
l3kb = WmiHelper.GetInt(cpu, "L3CacheSize");
}
- if (cores == 0) cores = threads; // fallback
+ if (cores == 0)
+ cores = threads; // fallback
var vendor = DetectCpuVendor(manufacturer);
var architecture = Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit";
@@ -692,7 +710,7 @@ internal static class CpuProvider
MaxClockMHz = maxMHz,
CurrentClockMHz = currentMHz,
L2CacheKB = l2kb,
- L3CacheKB = l3kb
+ L3CacheKB = l3kb,
};
}
catch
@@ -704,8 +722,10 @@ internal static class CpuProvider
private static string DetectCpuVendor(string manufacturer)
{
var lower = manufacturer.ToLowerInvariant();
- if (lower.Contains("intel") || lower.Contains("genuineintel")) return "Intel";
- if (lower.Contains("amd") || lower.Contains("authenticamd")) return "AMD";
+ if (lower.Contains("intel") || lower.Contains("genuineintel"))
+ return "Intel";
+ if (lower.Contains("amd") || lower.Contains("authenticamd"))
+ return "AMD";
return "Unknown";
}
}
@@ -721,7 +741,9 @@ internal static class RamProvider
try
{
var modules = GetPhysicalModules();
- var (totalGB, totalMB, totalKB, availableGB, usedPercent, usedGB) = GetMemoryStats(modules);
+ var (totalGB, totalMB, totalKB, availableGB, usedPercent, usedGB) = GetMemoryStats(
+ modules
+ );
return new RamInfo
{
@@ -731,7 +753,7 @@ internal static class RamProvider
AvailableGB = availableGB,
UsedPercent = usedPercent,
UsedGB = usedGB,
- Modules = modules
+ Modules = modules,
};
}
catch
@@ -743,9 +765,9 @@ internal static class RamProvider
private static List<RamModule> GetPhysicalModules()
{
var modules = new List<RamModule>();
- var physicalMemory =
- WmiHelper.Query(
- "SELECT Capacity, Speed, Manufacturer, PartNumber, DeviceLocator FROM Win32_PhysicalMemory");
+ var physicalMemory = WmiHelper.Query(
+ "SELECT Capacity, Speed, Manufacturer, PartNumber, DeviceLocator FROM Win32_PhysicalMemory"
+ );
foreach (var mem in physicalMemory)
{
@@ -756,21 +778,29 @@ internal static class RamProvider
var partNumber = WmiHelper.GetString(mem, "PartNumber");
var deviceLocator = WmiHelper.GetString(mem, "DeviceLocator");
- modules.Add(new RamModule
- {
- CapacityGB = Math.Round(capacityGB, 2),
- SpeedMHz = speed,
- Manufacturer = manufacturer,
- PartNumber = partNumber,
- DeviceLocator = deviceLocator
- });
+ modules.Add(
+ new RamModule
+ {
+ CapacityGB = Math.Round(capacityGB, 2),
+ SpeedMHz = speed,
+ Manufacturer = manufacturer,
+ PartNumber = partNumber,
+ DeviceLocator = deviceLocator,
+ }
+ );
}
return modules;
}
- private static (double totalGB, long totalMB, long totalKB, double availableGB, double usedPercent, double usedGB)
- GetMemoryStats(List<RamModule> modules)
+ private static (
+ double totalGB,
+ long totalMB,
+ long totalKB,
+ double availableGB,
+ double usedPercent,
+ double usedGB
+ ) GetMemoryStats(List<RamModule> modules)
{
// ── Primary: GlobalMemoryStatusEx (Task Manager accuracy) ────────
var memStatus = NativeMemory.GetMemoryStatus();
@@ -794,7 +824,8 @@ internal static class RamProvider
// ── Fallback: module-based calculation ───────────────────────────
var fallbackTotalGB = modules.Sum(m => m.CapacityGB);
- if (fallbackTotalGB <= 0) fallbackTotalGB = 0;
+ if (fallbackTotalGB <= 0)
+ fallbackTotalGB = 0;
var fallbackTotalMB = (long)(fallbackTotalGB * 1024);
var fallbackTotalKB = fallbackTotalMB * 1024;
@@ -819,16 +850,26 @@ public static class DiskHelper
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
private static extern SafeFileHandle CreateFile(
- string lpFileName, uint dwDesiredAccess, uint dwShareMode,
- IntPtr lpSecurityAttributes, uint dwCreationDisposition,
- uint dwFlagsAndAttributes, IntPtr hTemplateFile);
+ string lpFileName,
+ uint dwDesiredAccess,
+ uint dwShareMode,
+ IntPtr lpSecurityAttributes,
+ uint dwCreationDisposition,
+ uint dwFlagsAndAttributes,
+ IntPtr hTemplateFile
+ );
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool DeviceIoControl(
- SafeFileHandle hDevice, uint dwIoControlCode,
- IntPtr lpInBuffer, uint nInBufferSize,
- IntPtr lpOutBuffer, uint nOutBufferSize,
- out uint lpBytesReturned, IntPtr lpOverlapped);
+ SafeFileHandle hDevice,
+ uint dwIoControlCode,
+ IntPtr lpInBuffer,
+ uint nInBufferSize,
+ IntPtr lpOutBuffer,
+ uint nOutBufferSize,
+ out uint lpBytesReturned,
+ IntPtr lpOverlapped
+ );
public static string DetectMediaType(string driveLetter)
{
@@ -852,9 +893,15 @@ public static class DiskHelper
if (string.IsNullOrWhiteSpace(trimmedDrive))
return "Unknown";
- using var handle = CreateFile(@"\\.\" + trimmedDrive, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, IntPtr.Zero,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero);
+ using var handle = CreateFile(
+ @"\\.\" + trimmedDrive,
+ GENERIC_READ,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ IntPtr.Zero,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ IntPtr.Zero
+ );
if (handle.IsInvalid)
return "Unknown";
@@ -863,7 +910,7 @@ public static class DiskHelper
{
PropertyId = STORAGE_PROPERTY_ID.StorageDeviceSeekPenaltyProperty,
QueryType = STORAGE_QUERY_TYPE.PropertyStandardQuery,
- AdditionalParameters = new byte[1]
+ AdditionalParameters = new byte[1],
};
var querySize = Marshal.SizeOf(query);
@@ -879,10 +926,16 @@ public static class DiskHelper
resultPtr = Marshal.AllocHGlobal(resultSize);
- var success = DeviceIoControl(handle, IOCTL_STORAGE_QUERY_PROPERTY,
- queryPtr, (uint)querySize,
- resultPtr, (uint)resultSize,
- out _, IntPtr.Zero);
+ var success = DeviceIoControl(
+ handle,
+ IOCTL_STORAGE_QUERY_PROPERTY,
+ queryPtr,
+ (uint)querySize,
+ resultPtr,
+ (uint)resultSize,
+ out _,
+ IntPtr.Zero
+ );
if (!success)
return "Unknown";
@@ -911,12 +964,14 @@ public static class DiskHelper
{
// Get physical disk number from logical drive
var partitions = WmiHelper.Query(
- $"ASSOCIATORS OF {{Win32_LogicalDisk.DeviceID='{driveLetter.TrimEnd('\\')}' }} WHERE AssocClass=Win32_LogicalDiskToPartition");
+ $"ASSOCIATORS OF {{Win32_LogicalDisk.DeviceID='{driveLetter.TrimEnd('\\')}' }} WHERE AssocClass=Win32_LogicalDiskToPartition"
+ );
foreach (var partition in partitions)
{
var diskDrives = WmiHelper.Query(
- $"ASSOCIATORS OF {{Win32_DiskPartition.DeviceID='{partition["DeviceID"]}'}} WHERE AssocClass=Win32_DiskDriveToDiskPartition");
+ $"ASSOCIATORS OF {{Win32_DiskPartition.DeviceID='{partition["DeviceID"]}'}} WHERE AssocClass=Win32_DiskDriveToDiskPartition"
+ );
foreach (var disk in diskDrives)
{
@@ -924,8 +979,12 @@ public static class DiskHelper
var model = WmiHelper.GetString(disk, "Model", "").ToLowerInvariant();
// Check for SSD indicators
- if (mediaType.Contains("ssd") || model.Contains("ssd") ||
- model.Contains("nvme") || mediaType.Contains("fixed hard disk media"))
+ if (
+ mediaType.Contains("ssd")
+ || model.Contains("ssd")
+ || model.Contains("nvme")
+ || mediaType.Contains("fixed hard disk media")
+ )
{
// Additional check for rotational rate
var capabilities = disk["Capabilities"];
@@ -955,17 +1014,21 @@ public static class DiskHelper
public static bool IsSystemDrive(string driveLetter)
{
var systemDrive = Path.GetPathRoot(Environment.SystemDirectory)?.TrimEnd('\\') ?? "C:";
- return string.Equals(systemDrive, driveLetter.TrimEnd('\\'), StringComparison.OrdinalIgnoreCase);
+ return string.Equals(
+ systemDrive,
+ driveLetter.TrimEnd('\\'),
+ StringComparison.OrdinalIgnoreCase
+ );
}
private enum STORAGE_PROPERTY_ID
{
- StorageDeviceSeekPenaltyProperty = 7
+ StorageDeviceSeekPenaltyProperty = 7,
}
private enum STORAGE_QUERY_TYPE
{
- PropertyStandardQuery = 0
+ PropertyStandardQuery = 0,
}
[StructLayout(LayoutKind.Sequential)]
@@ -983,7 +1046,9 @@ public static class DiskHelper
{
public uint Version;
public uint Size;
- [MarshalAs(UnmanagedType.U1)] public bool IncursSeekPenalty;
+
+ [MarshalAs(UnmanagedType.U1)]
+ public bool IncursSeekPenalty;
}
}
@@ -1007,7 +1072,8 @@ internal static class DiskProvider
var physicalDisks = GetPhysicalDiskInfo();
var diskNumberToInfo = BuildDiskNumberMap(physicalDisks);
- var volumes = DriveInfo.GetDrives()
+ var volumes = DriveInfo
+ .GetDrives()
.Where(d => d.IsReady)
.Select(drive =>
{
@@ -1030,15 +1096,18 @@ internal static class DiskProvider
IsSystemDrive = isSystemDrive,
DriveFormat = drive.DriveFormat,
DriveType = drive.DriveType.ToString(),
- VolumeLabel = string.IsNullOrWhiteSpace(drive.VolumeLabel) ? "Local Disk" : drive.VolumeLabel,
+ VolumeLabel = string.IsNullOrWhiteSpace(drive.VolumeLabel)
+ ? "Local Disk"
+ : drive.VolumeLabel,
TotalSizeGB = ToGb(totalBytes),
AvailableSizeGB = ToGb(freeBytes),
UsedSizeGB = ToGb(usedBytes),
- UsedPercent = totalBytes > 0 ? Math.Round(usedBytes * 100.0 / totalBytes, 1) : 0,
+ UsedPercent =
+ totalBytes > 0 ? Math.Round(usedBytes * 100.0 / totalBytes, 1) : 0,
MediaType = mediaType,
IsRemovable = isRemovable,
SerialNumber = diskInfo?.SerialNumber,
- Model = diskInfo?.Model
+ Model = diskInfo?.Model,
};
})
.ToList();
@@ -1058,7 +1127,8 @@ internal static class DiskProvider
private static List<PhysicalDiskInfo> GetPhysicalDiskInfo()
{
var disks = GetViaMsftPhysicalDisk();
- if (disks.Count > 0) return disks;
+ if (disks.Count > 0)
+ return disks;
// Fallback to Win32_DiskDrive
return GetViaWin32DiskDrive();
@@ -1075,7 +1145,8 @@ internal static class DiskProvider
{
var physicalDisks = WmiHelper.Query(
"SELECT DeviceId, FriendlyName, SerialNumber, MediaType, BusType FROM MSFT_PhysicalDisk",
- @"root\Microsoft\Windows\Storage");
+ @"root\Microsoft\Windows\Storage"
+ );
foreach (var disk in physicalDisks)
{
@@ -1085,17 +1156,19 @@ internal static class DiskProvider
3 => "HDD",
4 => "SSD",
5 => "SCM", // Storage Class Memory
- _ => "Unknown"
+ _ => "Unknown",
};
- disks.Add(new PhysicalDiskInfo
- {
- DiskNumber = WmiHelper.GetString(disk, "DeviceId", "-1"),
- Model = WmiHelper.GetString(disk, "FriendlyName"),
- SerialNumber = WmiHelper.GetString(disk, "SerialNumber").Trim(),
- MediaType = mediaType,
- DeviceID = "" // Not available from MSFT_PhysicalDisk
- });
+ disks.Add(
+ new PhysicalDiskInfo
+ {
+ DiskNumber = WmiHelper.GetString(disk, "DeviceId", "-1"),
+ Model = WmiHelper.GetString(disk, "FriendlyName"),
+ SerialNumber = WmiHelper.GetString(disk, "SerialNumber").Trim(),
+ MediaType = mediaType,
+ DeviceID = "", // Not available from MSFT_PhysicalDisk
+ }
+ );
}
}
catch
@@ -1114,17 +1187,20 @@ internal static class DiskProvider
var disks = new List<PhysicalDiskInfo>();
try
{
- var diskDrives =
- WmiHelper.Query("SELECT DeviceID, Model, SerialNumber, MediaType, Index FROM Win32_DiskDrive");
+ var diskDrives = WmiHelper.Query(
+ "SELECT DeviceID, Model, SerialNumber, MediaType, Index FROM Win32_DiskDrive"
+ );
foreach (var disk in diskDrives)
- disks.Add(new PhysicalDiskInfo
- {
- DeviceID = WmiHelper.GetString(disk, "DeviceID"),
- DiskNumber = WmiHelper.GetInt(disk, "Index").ToString(),
- Model = WmiHelper.GetString(disk, "Model"),
- SerialNumber = WmiHelper.GetString(disk, "SerialNumber").Trim(),
- MediaType = "" // Win32_DiskDrive MediaType is unreliable
- });
+ disks.Add(
+ new PhysicalDiskInfo
+ {
+ DeviceID = WmiHelper.GetString(disk, "DeviceID"),
+ DiskNumber = WmiHelper.GetInt(disk, "Index").ToString(),
+ Model = WmiHelper.GetString(disk, "Model"),
+ SerialNumber = WmiHelper.GetString(disk, "SerialNumber").Trim(),
+ MediaType = "", // Win32_DiskDrive MediaType is unreliable
+ }
+ );
}
catch
{
@@ -1137,7 +1213,9 @@ internal static class DiskProvider
/// <summary>
/// Builds a lookup from disk number to PhysicalDiskInfo.
/// </summary>
- private static Dictionary<int, PhysicalDiskInfo> BuildDiskNumberMap(List<PhysicalDiskInfo> disks)
+ private static Dictionary<int, PhysicalDiskInfo> BuildDiskNumberMap(
+ List<PhysicalDiskInfo> disks
+ )
{
var map = new Dictionary<int, PhysicalDiskInfo>();
foreach (var disk in disks)
@@ -1150,10 +1228,13 @@ internal static class DiskProvider
/// <summary>
/// Maps a logical drive letter to a physical disk using Win32 associations.
/// </summary>
- private static PhysicalDiskInfo? GetDiskInfoForDrive(string driveLetter,
- Dictionary<int, PhysicalDiskInfo> diskNumberMap)
+ private static PhysicalDiskInfo? GetDiskInfoForDrive(
+ string driveLetter,
+ Dictionary<int, PhysicalDiskInfo> diskNumberMap
+ )
{
- if (diskNumberMap.Count == 0) return null;
+ if (diskNumberMap.Count == 0)
+ return null;
try
{
@@ -1162,7 +1243,8 @@ internal static class DiskProvider
// Try MSFT_Partition to get DiskNumber for this drive letter
var partitions = WmiHelper.Query(
$"SELECT DiskNumber FROM MSFT_Partition WHERE DriveLetter = '{letter.TrimEnd(':')}'",
- @"root\Microsoft\Windows\Storage");
+ @"root\Microsoft\Windows\Storage"
+ );
foreach (var partition in partitions)
{
@@ -1173,12 +1255,14 @@ internal static class DiskProvider
// Fallback: classic WMI ASSOCIATORS path
var classicPartitions = WmiHelper.Query(
- $"ASSOCIATORS OF {{Win32_LogicalDisk.DeviceID='{letter}'}} WHERE AssocClass=Win32_LogicalDiskToPartition");
+ $"ASSOCIATORS OF {{Win32_LogicalDisk.DeviceID='{letter}'}} WHERE AssocClass=Win32_LogicalDiskToPartition"
+ );
foreach (var partition in classicPartitions)
{
var diskDrives = WmiHelper.Query(
- $"ASSOCIATORS OF {{Win32_DiskPartition.DeviceID='{partition["DeviceID"]}'}} WHERE AssocClass=Win32_DiskDriveToDiskPartition");
+ $"ASSOCIATORS OF {{Win32_DiskPartition.DeviceID='{partition["DeviceID"]}'}} WHERE AssocClass=Win32_DiskDriveToDiskPartition"
+ );
foreach (var disk in diskDrives)
{
@@ -1234,8 +1318,8 @@ internal static class DxgiHelper
[DllImport("dxgi.dll", PreserveSig = false)]
private static extern void CreateDXGIFactory1(
[In] ref Guid riid,
- [Out] [MarshalAs(UnmanagedType.Interface)]
- out IDXGIFactory1 factory);
+ [Out] [MarshalAs(UnmanagedType.Interface)] out IDXGIFactory1 factory
+ );
public static IDXGIFactory1 CreateFactory()
{
@@ -1261,7 +1345,10 @@ internal static class DxgiHelper
// IDXGIObject (4 methods)
void SetPrivateData([In] ref Guid Name, uint DataSize, IntPtr pData);
- void SetPrivateDataInterface([In] ref Guid Name, [MarshalAs(UnmanagedType.IUnknown)] object pUnknown);
+ void SetPrivateDataInterface(
+ [In] ref Guid Name,
+ [MarshalAs(UnmanagedType.IUnknown)] object pUnknown
+ );
void GetPrivateData([In] ref Guid Name, ref uint pDataSize, IntPtr pData);
@@ -1277,9 +1364,13 @@ internal static class DxgiHelper
void CreateSwapChain(
[MarshalAs(UnmanagedType.IUnknown)] object pDevice,
IntPtr pDesc,
- [MarshalAs(UnmanagedType.IUnknown)] out object ppSwapChain);
+ [MarshalAs(UnmanagedType.IUnknown)] out object ppSwapChain
+ );
- void CreateSoftwareAdapter(IntPtr Module, [MarshalAs(UnmanagedType.IUnknown)] out object ppAdapter);
+ void CreateSoftwareAdapter(
+ IntPtr Module,
+ [MarshalAs(UnmanagedType.IUnknown)] out object ppAdapter
+ );
// IDXGIFactory1 (2 methods)
[PreserveSig]
@@ -1296,7 +1387,10 @@ internal static class DxgiHelper
// IDXGIObject (4 methods)
void SetPrivateData([In] ref Guid Name, uint DataSize, IntPtr pData);
- void SetPrivateDataInterface([In] ref Guid Name, [MarshalAs(UnmanagedType.IUnknown)] object pUnknown);
+ void SetPrivateDataInterface(
+ [In] ref Guid Name,
+ [MarshalAs(UnmanagedType.IUnknown)] object pUnknown
+ );
void GetPrivateData([In] ref Guid Name, ref uint pDataSize, IntPtr pData);
@@ -1378,11 +1472,12 @@ internal static class GpuProvider
/// </summary>
public static GpuInfo? GetPrimary(IReadOnlyList<GpuInfo> gpus)
{
- if (gpus.Count == 0) return null;
- if (gpus.Count == 1) return gpus[0];
+ if (gpus.Count == 0)
+ return null;
+ if (gpus.Count == 1)
+ return gpus[0];
- return gpus
- .OrderByDescending(g => g.MemoryMB ?? 0)
+ return gpus.OrderByDescending(g => g.MemoryMB ?? 0)
.ThenByDescending(g => g.Vendor == GpuVendor.NVIDIA)
.ThenByDescending(g => g.Vendor == GpuVendor.AMD)
.First();
@@ -1398,10 +1493,11 @@ internal static class GpuProvider
try
{
- for (uint i = 0;; i++)
+ for (uint i = 0; ; i++)
{
var hr = factory.EnumAdapters1(i, out var adapter);
- if (hr != 0 || adapter == null) break; // DXGI_ERROR_NOT_FOUND
+ if (hr != 0 || adapter == null)
+ break; // DXGI_ERROR_NOT_FOUND
try
{
@@ -1421,15 +1517,17 @@ internal static class GpuProvider
// Match to WMI entry for DriverVersion and DeviceID
var wmiMatch = FindWmiMatch(name, desc.VendorId, desc.DeviceId, wmiLookup);
- gpus.Add(new GpuInfo
- {
- Name = name,
- DriverVersion = wmiMatch?.DriverVersion ?? Translations.Common_Unknown,
- Vendor = vendor,
- MemoryMB = memoryMB > 0 ? memoryMB : null,
- DeviceId = wmiMatch?.DeviceId,
- PnpDeviceId = wmiMatch?.PnpDeviceId
- });
+ gpus.Add(
+ new GpuInfo
+ {
+ Name = name,
+ DriverVersion = wmiMatch?.DriverVersion ?? Translations.Common_Unknown,
+ Vendor = vendor,
+ MemoryMB = memoryMB > 0 ? memoryMB : null,
+ DeviceId = wmiMatch?.DeviceId,
+ PnpDeviceId = wmiMatch?.PnpDeviceId,
+ }
+ );
}
finally
{
@@ -1439,7 +1537,8 @@ internal static class GpuProvider
}
finally
{
- if (factory != null) Marshal.ReleaseComObject(factory);
+ if (factory != null)
+ Marshal.ReleaseComObject(factory);
}
return gpus.Count > 0 ? gpus : [GpuInfo.Unknown];
@@ -1450,8 +1549,9 @@ internal static class GpuProvider
private static IReadOnlyList<GpuInfo> GetAllViaWmi()
{
var gpus = new List<GpuInfo>();
- var controllers =
- WmiHelper.Query("SELECT Name, DriverVersion, DeviceID, PNPDeviceID, AdapterRAM FROM Win32_VideoController");
+ var controllers = WmiHelper.Query(
+ "SELECT Name, DriverVersion, DeviceID, PNPDeviceID, AdapterRAM FROM Win32_VideoController"
+ );
foreach (var controller in controllers)
{
@@ -1467,15 +1567,17 @@ internal static class GpuProvider
int? memoryMB = adapterRam > 0 ? (int)(adapterRam / (1024 * 1024)) : null;
var vendor = DetectGpuVendor(name, pnpId);
- gpus.Add(new GpuInfo
- {
- Name = name,
- DriverVersion = driver,
- Vendor = vendor,
- MemoryMB = memoryMB,
- DeviceId = deviceId,
- PnpDeviceId = pnpId
- });
+ gpus.Add(
+ new GpuInfo
+ {
+ Name = name,
+ DriverVersion = driver,
+ Vendor = vendor,
+ MemoryMB = memoryMB,
+ DeviceId = deviceId,
+ PnpDeviceId = pnpId,
+ }
+ );
}
return gpus.Count > 0 ? gpus : [GpuInfo.Unknown];
@@ -1491,7 +1593,8 @@ internal static class GpuProvider
try
{
var controllers = WmiHelper.Query(
- "SELECT Name, DriverVersion, DeviceID, PNPDeviceID FROM Win32_VideoController");
+ "SELECT Name, DriverVersion, DeviceID, PNPDeviceID FROM Win32_VideoController"
+ );
foreach (var controller in controllers)
{
@@ -1503,7 +1606,9 @@ internal static class GpuProvider
// Extract VendorId and DeviceId from PNP DeviceID (e.g., PCI\VEN_10DE&DEV_2684&...)
ParsePnpIds(pnpId, out var vendorId, out var hardwareDeviceId);
- entries.Add(new WmiGpuEntry(name, driver, deviceId, pnpId, vendorId, hardwareDeviceId));
+ entries.Add(
+ new WmiGpuEntry(name, driver, deviceId, pnpId, vendorId, hardwareDeviceId)
+ );
}
}
catch
@@ -1521,20 +1626,33 @@ internal static class GpuProvider
{
vendorId = 0;
hardwareDeviceId = 0;
- if (string.IsNullOrWhiteSpace(pnpId)) return;
+ if (string.IsNullOrWhiteSpace(pnpId))
+ return;
var upper = pnpId.ToUpperInvariant();
var venIdx = upper.IndexOf("VEN_", StringComparison.Ordinal);
if (venIdx >= 0 && venIdx + 8 <= upper.Length)
- if (uint.TryParse(upper.Substring(venIdx + 4, 4),
- NumberStyles.HexNumber, null, out var v))
+ if (
+ uint.TryParse(
+ upper.Substring(venIdx + 4, 4),
+ NumberStyles.HexNumber,
+ null,
+ out var v
+ )
+ )
vendorId = v;
var devIdx = upper.IndexOf("DEV_", StringComparison.Ordinal);
if (devIdx >= 0 && devIdx + 8 <= upper.Length)
- if (uint.TryParse(upper.Substring(devIdx + 4, 4),
- NumberStyles.HexNumber, null, out var d))
+ if (
+ uint.TryParse(
+ upper.Substring(devIdx + 4, 4),
+ NumberStyles.HexNumber,
+ null,
+ out var d
+ )
+ )
hardwareDeviceId = d;
}
@@ -1543,7 +1661,11 @@ internal static class GpuProvider
/// Priority: VendorId+DeviceId match > name substring match.
/// </summary>
private static WmiGpuEntry? FindWmiMatch(
- string dxgiName, uint dxgiVendorId, uint dxgiDeviceId, List<WmiGpuEntry> wmiEntries)
+ string dxgiName,
+ uint dxgiVendorId,
+ uint dxgiDeviceId,
+ List<WmiGpuEntry> wmiEntries
+ )
{
// First pass: match by hardware IDs (most reliable)
foreach (var entry in wmiEntries)
@@ -1553,8 +1675,10 @@ internal static class GpuProvider
// Second pass: match by name substring
var dxgiNameLower = dxgiName.ToLowerInvariant();
foreach (var entry in wmiEntries)
- if (!string.IsNullOrEmpty(entry.Name) &&
- dxgiNameLower.Contains(entry.Name.ToLowerInvariant()))
+ if (
+ !string.IsNullOrEmpty(entry.Name)
+ && dxgiNameLower.Contains(entry.Name.ToLowerInvariant())
+ )
return entry;
return null;
@@ -1565,9 +1689,9 @@ internal static class GpuProvider
private static bool IsVirtualAdapter(string name)
{
var lower = name.ToLowerInvariant();
- return lower.Contains("microsoft basic") ||
- lower.Contains("remote desktop") ||
- lower.Contains("virtual");
+ return lower.Contains("microsoft basic")
+ || lower.Contains("remote desktop")
+ || lower.Contains("virtual");
}
/// <summary>
@@ -1580,7 +1704,7 @@ internal static class GpuProvider
0x10DE => GpuVendor.NVIDIA,
0x1002 => GpuVendor.AMD,
0x8086 => GpuVendor.Intel,
- _ => GpuVendor.Unknown
+ _ => GpuVendor.Unknown,
};
}
@@ -1592,16 +1716,29 @@ internal static class GpuProvider
var nameLower = name.ToLowerInvariant();
var pnpLower = pnpId?.ToLowerInvariant() ?? "";
- if (nameLower.Contains("nvidia") || nameLower.Contains("geforce") ||
- nameLower.Contains("quadro") || nameLower.Contains("tesla") || pnpLower.Contains("ven_10de"))
+ if (
+ nameLower.Contains("nvidia")
+ || nameLower.Contains("geforce")
+ || nameLower.Contains("quadro")
+ || nameLower.Contains("tesla")
+ || pnpLower.Contains("ven_10de")
+ )
return GpuVendor.NVIDIA;
- if (nameLower.Contains("amd") || nameLower.Contains("radeon") ||
- nameLower.Contains("ryzen") || pnpLower.Contains("ven_1002"))
+ if (
+ nameLower.Contains("amd")
+ || nameLower.Contains("radeon")
+ || nameLower.Contains("ryzen")
+ || pnpLower.Contains("ven_1002")
+ )
return GpuVendor.AMD;
- if (nameLower.Contains("intel") || nameLower.Contains("iris") ||
- nameLower.Contains("uhd") || pnpLower.Contains("ven_8086"))
+ if (
+ nameLower.Contains("intel")
+ || nameLower.Contains("iris")
+ || nameLower.Contains("uhd")
+ || pnpLower.Contains("ven_8086")
+ )
return GpuVendor.Intel;
return GpuVendor.Unknown;
@@ -1634,19 +1771,26 @@ internal static class OsProvider
var installDate = Translations.Common_Unknown;
var displayVersion = "";
- using (var ntKey = Registry.LocalMachine.OpenSubKey(
- @"SOFTWARE\Microsoft\Windows NT\CurrentVersion"))
+ using (
+ var ntKey = Registry.LocalMachine.OpenSubKey(
+ @"SOFTWARE\Microsoft\Windows NT\CurrentVersion"
+ )
+ )
{
if (ntKey != null)
{
- buildNumber = ntKey.GetValue("CurrentBuildNumber")?.ToString()
- ?? ntKey.GetValue("CurrentBuild")?.ToString()
- ?? buildNumber;
+ buildNumber =
+ ntKey.GetValue("CurrentBuildNumber")?.ToString()
+ ?? ntKey.GetValue("CurrentBuild")?.ToString()
+ ?? buildNumber;
edition = ntKey.GetValue("EditionID")?.ToString() ?? edition;
displayVersion = ntKey.GetValue("DisplayVersion")?.ToString() ?? "";
// Install date from Registry (Unix timestamp)
- if (ntKey.GetValue("InstallDate") is int installTimestamp && installTimestamp > 0)
+ if (
+ ntKey.GetValue("InstallDate") is int installTimestamp
+ && installTimestamp > 0
+ )
{
var installDateTime = DateTimeOffset.FromUnixTimeSeconds(installTimestamp);
installDate = installDateTime.LocalDateTime.ToString("yyyy-MM-dd");
@@ -1675,7 +1819,7 @@ internal static class OsProvider
Architecture = architecture,
DeviceType = deviceType,
InstallDate = installDate,
- LastBootUpTime = lastBoot
+ LastBootUpTime = lastBoot,
};
}
catch
@@ -1697,18 +1841,21 @@ internal static class OsProvider
>= 9600 => "8.1",
>= 9200 => "8",
>= 7600 => "7",
- _ => "Unknown"
+ _ => "Unknown",
};
}
private static string GetDeviceType()
{
var chassis = WmiHelper.GetFirst("SELECT ChassisTypes FROM Win32_SystemEnclosure");
- if (chassis == null) return "Unknown";
+ if (chassis == null)
+ return "Unknown";
try
{
- return chassis["ChassisTypes"] is ushort[] { Length: > 0 } types ? MapChassisType(types) : "Unknown";
+ return chassis["ChassisTypes"] is ushort[] { Length: > 0 } types
+ ? MapChassisType(types)
+ : "Unknown";
}
catch
{
@@ -1724,7 +1871,14 @@ internal static class OsProvider
case 8 or 9 or 10 or 11 or 14 or 30 or 31 or 32:
return Translations.Dashboard_SystemInfo_Os_DeviceType_Laptop;
- case >= 1 and <= 7 or 12 or 13 or >= 15 and <= 29 or >= 33 and <= 36:
+ case >= 1
+ and <= 7
+ or 12
+ or 13
+ or >= 15
+ and <= 29
+ or >= 33
+ and <= 36:
return Translations.Dashboard_SystemInfo_Os_DeviceType_Desktop;
}
@@ -1733,9 +1887,9 @@ internal static class OsProvider
private static string FormatWmiDateTime(string wmiDate)
{
- if (wmiDate.Length < 12) return "Unknown";
- return
- $"{wmiDate[..4]}-{wmiDate.Substring(4, 2)}-{wmiDate.Substring(6, 2)} {wmiDate.Substring(8, 2)}:{wmiDate.Substring(10, 2)}";
+ if (wmiDate.Length < 12)
+ return "Unknown";
+ return $"{wmiDate[..4]}-{wmiDate.Substring(4, 2)}-{wmiDate.Substring(6, 2)} {wmiDate.Substring(8, 2)}:{wmiDate.Substring(10, 2)}";
}
}
@@ -1746,8 +1900,10 @@ internal static class BiosProvider
try
{
var bios = WmiHelper.GetFirst(
- "SELECT Manufacturer, BIOSVersion, SMBIOSBIOSVersion, SerialNumber, ReleaseDate FROM Win32_BIOS");
- if (bios == null) return BiosInfo.Unknown;
+ "SELECT Manufacturer, BIOSVersion, SMBIOSBIOSVersion, SerialNumber, ReleaseDate FROM Win32_BIOS"
+ );
+ if (bios == null)
+ return BiosInfo.Unknown;
var manufacturer = WmiHelper.GetString(bios, "Manufacturer");
var version = WmiHelper.GetString(bios, "BIOSVersion");
@@ -1761,7 +1917,7 @@ internal static class BiosProvider
Version = version,
ReleaseDate = releaseDate,
SmbiosVersion = smbiosVersion,
- SerialNumber = serialNumber
+ SerialNumber = serialNumber,
};
}
catch
@@ -1772,7 +1928,8 @@ internal static class BiosProvider
private static string FormatWmiDate(string wmiDate)
{
- if (wmiDate.Length < 8) return "Unknown";
+ if (wmiDate.Length < 8)
+ return "Unknown";
return $"{wmiDate[..4]}-{wmiDate.Substring(4, 2)}-{wmiDate.Substring(6, 2)}";
}
}
@@ -1834,7 +1991,7 @@ public sealed class SystemInfoService
Bios = _cachedBios,
Gpus = _cachedGpus,
PrimaryGpu = primaryGpu,
- Disk = await diskTask
+ Disk = await diskTask,
};
}
else
@@ -1857,7 +2014,7 @@ public sealed class SystemInfoService
Bios = _cachedBios!,
Gpus = gpus,
PrimaryGpu = primaryGpu,
- Disk = await diskTask
+ Disk = await diskTask,
};
}
@@ -1878,16 +2035,30 @@ public sealed class SystemInfoService
{
try
{
- _logger.LogInformation("OS : {OsName} {OsEdition} [{OsArchitecture}] ({OsDeviceType})",
- Snapshot.Os.Name, Snapshot.Os.Edition, Snapshot.Os.Architecture, Snapshot.Os.DeviceType);
+ _logger.LogInformation(
+ "OS : {OsName} {OsEdition} [{OsArchitecture}] ({OsDeviceType})",
+ Snapshot.Os.Name,
+ Snapshot.Os.Edition,
+ Snapshot.Os.Architecture,
+ Snapshot.Os.DeviceType
+ );
LogGpuSummary();
- _logger.LogInformation("CPU: {CpuName} [{CpuVendor}] ({CpuCores} Cores/{CpuThreads} Threads)",
- Snapshot.Cpu.Name, Snapshot.Cpu.Vendor, Snapshot.Cpu.Cores, Snapshot.Cpu.Threads);
-
- _logger.LogInformation("RAM: {RamTotalGb:F1} GB [{RamModules} Module(s)] (Used: {RamUsedGB:F1} GB)",
- Snapshot.Ram.TotalGB, Snapshot.Ram.Modules.Count, Snapshot.Ram.UsedGB);
+ _logger.LogInformation(
+ "CPU: {CpuName} [{CpuVendor}] ({CpuCores} Cores/{CpuThreads} Threads)",
+ Snapshot.Cpu.Name,
+ Snapshot.Cpu.Vendor,
+ Snapshot.Cpu.Cores,
+ Snapshot.Cpu.Threads
+ );
+
+ _logger.LogInformation(
+ "RAM: {RamTotalGb:F1} GB [{RamModules} Module(s)] (Used: {RamUsedGB:F1} GB)",
+ Snapshot.Ram.TotalGB,
+ Snapshot.Ram.Modules.Count,
+ Snapshot.Ram.UsedGB
+ );
foreach (var volume in Snapshot.Disk.Volumes)
{
@@ -1895,8 +2066,13 @@ public sealed class SystemInfoService
var modelInfo = !string.IsNullOrEmpty(volume.Model) ? $" - {volume.Model}" : "";
_logger.LogInformation(
"Disk {VolumeLetter}{SystemDrive} [{MediaType}] {VolumeTotalSizeGb:F1} GB (Free: {VolumeFreeSpaceGb:F1} GB){ModelInfo}",
- volume.DriveLetter, systemDrive, volume.MediaType, volume.TotalSizeGB, volume.AvailableSizeGB,
- modelInfo);
+ volume.DriveLetter,
+ systemDrive,
+ volume.MediaType,
+ volume.TotalSizeGB,
+ volume.AvailableSizeGB,
+ modelInfo
+ );
}
}
catch (Exception ex)
@@ -1919,7 +2095,12 @@ public sealed class SystemInfoService
{
var gpu = Snapshot.Gpus[0];
var memoryInfo = gpu.MemoryMB.HasValue ? $" ({gpu.MemoryMB.Value / 1024.0:F0} GB)" : "";
- _logger.LogInformation("GPU: {GpuName} [{GpuVendor}]{MemoryInfo}", gpu.Name, gpu.Vendor, memoryInfo);
+ _logger.LogInformation(
+ "GPU: {GpuName} [{GpuVendor}]{MemoryInfo}",
+ gpu.Name,
+ gpu.Vendor,
+ memoryInfo
+ );
return;
}
@@ -1929,24 +2110,35 @@ public sealed class SystemInfoService
var memoryInfoPrimary = Snapshot.PrimaryGpu.MemoryMB.HasValue
? $" ({Snapshot.PrimaryGpu.MemoryMB.Value / 1024.0:F0} GB)"
: "";
- _logger.LogInformation("GPU (Primary): {PrimaryGpuName} [{PrimaryGpuVendor}]{MemoryInfo}",
- Snapshot.PrimaryGpu.Name, Snapshot.PrimaryGpu.Vendor, memoryInfoPrimary);
+ _logger.LogInformation(
+ "GPU (Primary): {PrimaryGpuName} [{PrimaryGpuVendor}]{MemoryInfo}",
+ Snapshot.PrimaryGpu.Name,
+ Snapshot.PrimaryGpu.Vendor,
+ memoryInfoPrimary
+ );
for (var index = 0; index < Snapshot.Gpus.Count; index++)
{
- if (Snapshot.Gpus[index].Name == Snapshot.PrimaryGpu.Name
- && Snapshot.Gpus[index].Vendor == Snapshot.PrimaryGpu.Vendor)
+ if (
+ Snapshot.Gpus[index].Name == Snapshot.PrimaryGpu.Name
+ && Snapshot.Gpus[index].Vendor == Snapshot.PrimaryGpu.Vendor
+ )
continue;
var gpu = Snapshot.Gpus[index];
var memoryInfo = gpu.MemoryMB.HasValue
? $" [{gpu.MemoryMB.Value / 1024.0:F0} GB]"
: "";
- _logger.LogInformation("GPU ({GpuIndex}): {GpuName} ({GpuVendor}){MemoryInfo}",
- index + 1, gpu.Name, gpu.Vendor, memoryInfo);
+ _logger.LogInformation(
+ "GPU ({GpuIndex}): {GpuName} ({GpuVendor}){MemoryInfo}",
+ index + 1,
+ gpu.Name,
+ gpu.Vendor,
+ memoryInfo
+ );
}
_logger.LogInformation("Total GPUs : {GpuCount}", gpuCount);
}
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/Services/System/UpdaterService.cs b/optimizerDuck/Services/System/UpdaterService.cs
index 966a709..a0f071b 100644
--- a/optimizerDuck/Services/System/UpdaterService.cs
+++ b/optimizerDuck/Services/System/UpdaterService.cs
@@ -19,19 +19,24 @@ public class UpdaterService
public UpdaterService(ILogger<UpdaterService> logger)
{
_httpClient = new HttpClient();
- _httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("optimizerDuck", "1.0"));
+ _httpClient.DefaultRequestHeaders.UserAgent.Add(
+ new ProductInfoHeaderValue("optimizerDuck", "1.0")
+ );
_logger = logger;
}
public async Task<(bool Result, string? Version)> CheckForUpdatesAsync()
{
- _logger.LogInformation("Checking for updates (Current version: {CurrentVersion})",
- Shared.FileVersion);
+ _logger.LogInformation(
+ "Checking for updates (Current version: {CurrentVersion})",
+ Shared.FileVersion
+ );
try
{
- var response =
- await _httpClient.GetStringAsync($"https://api.github.com/repos/{Owner}/{Repo}/releases/latest");
+ var response = await _httpClient.GetStringAsync(
+ $"https://api.github.com/repos/{Owner}/{Repo}/releases/latest"
+ );
var latestRelease = JsonConvert.DeserializeObject<GitHubRelease>(response);
if (latestRelease == null || string.IsNullOrEmpty(latestRelease.TagName))
@@ -48,13 +53,18 @@ public class UpdaterService
if (preReleaseSeparatorIndex != -1)
latestVersionStr = latestVersionStr[..preReleaseSeparatorIndex];
- _logger.LogDebug("Latest release version: {LatestReleaseTagName}", latestRelease.TagName);
+ _logger.LogDebug(
+ "Latest release version: {LatestReleaseTagName}",
+ latestRelease.TagName
+ );
// Parse version
if (!Version.TryParse(latestVersionStr, out var latestVersion))
{
- _logger.LogWarning("Could not parse latest release version: {LatestReleaseTagName}",
- latestRelease.TagName);
+ _logger.LogWarning(
+ "Could not parse latest release version: {LatestReleaseTagName}",
+ latestRelease.TagName
+ );
return (false, null);
}
@@ -62,10 +72,10 @@ public class UpdaterService
if (latestVersion > currentVersion)
{
- var updateExecutableAsset = latestRelease.Assets
- .FirstOrDefault(a =>
- a.Name.StartsWith("optimizerDuck", StringComparison.OrdinalIgnoreCase)
- && a.Name.EndsWith(".exe", StringComparison.OrdinalIgnoreCase));
+ var updateExecutableAsset = latestRelease.Assets.FirstOrDefault(a =>
+ a.Name.StartsWith("optimizerDuck", StringComparison.OrdinalIgnoreCase)
+ && a.Name.EndsWith(".exe", StringComparison.OrdinalIgnoreCase)
+ );
if (updateExecutableAsset == null)
{
@@ -73,7 +83,10 @@ public class UpdaterService
return (false, null);
}
- _logger.LogInformation("A new version ({LatestVersion}) is available!", latestVersionStr);
+ _logger.LogInformation(
+ "A new version ({LatestVersion}) is available!",
+ latestVersionStr
+ );
return (true, latestVersionStr);
}
@@ -92,16 +105,21 @@ public class UpdaterService
// Helper classes for deserializing GitHub API response
public class GitHubRelease
{
- [JsonProperty("tag_name")] public required string TagName { get; set; }
+ [JsonProperty("tag_name")]
+ public required string TagName { get; set; }
- [JsonProperty("assets")] public required List<GitHubAsset> Assets { get; set; }
+ [JsonProperty("assets")]
+ public required List<GitHubAsset> Assets { get; set; }
- [JsonProperty("body")] public required string Body { get; set; }
+ [JsonProperty("body")]
+ public required string Body { get; set; }
}
public class GitHubAsset
{
- [JsonProperty("name")] public required string Name { get; set; }
+ [JsonProperty("name")]
+ public required string Name { get; set; }
- [JsonProperty("browser_download_url")] public required string BrowserDownloadUrl { get; set; }
-}
\ No newline at end of file
+ [JsonProperty("browser_download_url")]
+ public required string BrowserDownloadUrl { get; set; }
+}
diff --git a/optimizerDuck/UI/Controls/FilledNavigationViewItem.cs b/optimizerDuck/UI/Controls/FilledNavigationViewItem.cs
index 1842845..ba48f54 100644
--- a/optimizerDuck/UI/Controls/FilledNavigationViewItem.cs
+++ b/optimizerDuck/UI/Controls/FilledNavigationViewItem.cs
@@ -12,13 +12,15 @@ public class FilledNavigationViewItem : NavigationViewItem
{
base.Activate(navigationView);
- if (Icon is SymbolIcon symbolIcon) symbolIcon.Filled = true;
+ if (Icon is SymbolIcon symbolIcon)
+ symbolIcon.Filled = true;
}
public override void Deactivate(INavigationView navigationView)
{
base.Deactivate(navigationView);
- if (Icon is SymbolIcon symbolIcon) symbolIcon.Filled = false;
+ if (Icon is SymbolIcon symbolIcon)
+ symbolIcon.Filled = false;
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Dialogs/BloatwareConfirmationDialog.xaml b/optimizerDuck/UI/Dialogs/BloatwareConfirmationDialog.xaml
index 2d80f2c..093841e 100644
--- a/optimizerDuck/UI/Dialogs/BloatwareConfirmationDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/BloatwareConfirmationDialog.xaml
@@ -1,171 +1,191 @@
<UserControl
- x:Class="optimizerDuck.UI.Dialogs.BloatwareConfirmationDialog"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:dialogVm="clr-namespace:optimizerDuck.UI.ViewModels.Dialogs"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- d:DesignHeight="520"
- d:DesignWidth="900"
- mc:Ignorable="d">
- <UserControl.Resources>
- <converters:GreaterThanZeroToVisibilityConverter x:Key="GreaterThanZeroToVisibilityConverter" />
- <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
- </UserControl.Resources>
+ x:Class="optimizerDuck.UI.Dialogs.BloatwareConfirmationDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:dialogVm="clr-namespace:optimizerDuck.UI.ViewModels.Dialogs"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ d:DesignHeight="520"
+ d:DesignWidth="900"
+ mc:Ignorable="d"
+>
+ <UserControl.Resources>
+ <converters:GreaterThanZeroToVisibilityConverter x:Key="GreaterThanZeroToVisibilityConverter" />
+ <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
+ </UserControl.Resources>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
- <ui:InfoBar
- Grid.Row="0"
- Margin="0,0,0,12"
- IsClosable="False"
- IsOpen="True"
- Message="{ext:Loc BloatwareDialog.Confirmation.Description}"
- Severity="Warning" />
+ <ui:InfoBar
+ Grid.Row="0"
+ Margin="0,0,0,12"
+ IsClosable="False"
+ IsOpen="True"
+ Message="{ext:Loc BloatwareDialog.Confirmation.Description}"
+ Severity="Warning"
+ />
+ <ui:TextBlock
+ Grid.Row="1"
+ Margin="0,0,0,6"
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc BloatwareDialog.Confirmation.SelectedList}"
+ TextWrapping="Wrap"
+ />
+ <ScrollViewer Grid.Row="2" MaxHeight="420" VerticalScrollBarVisibility="Auto">
+ <ItemsControl
+ ItemsSource="{Binding Items}"
+ Visibility="{Binding Items.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}"
+ >
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <VirtualizingStackPanel />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
- <ui:TextBlock
- Grid.Row="1"
- Margin="0,0,0,6"
- Appearance="Primary"
- FontTypography="BodyStrong"
- Text="{ext:Loc BloatwareDialog.Confirmation.SelectedList}"
- TextWrapping="Wrap" />
- <ScrollViewer
- Grid.Row="2"
- MaxHeight="420"
- VerticalScrollBarVisibility="Auto">
- <ItemsControl ItemsSource="{Binding Items}" Visibility="{Binding Items.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <VirtualizingStackPanel />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate DataType="{x:Type dialogVm:BloatwareConfirmationItemViewModel}">
+ <Border
+ Margin="0,0,0,6"
+ Padding="12"
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ CornerRadius="6"
+ >
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
- <ItemsControl.ItemTemplate>
- <DataTemplate DataType="{x:Type dialogVm:BloatwareConfirmationItemViewModel}">
- <Border
- Margin="0,0,0,6"
- Padding="12"
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- CornerRadius="6">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
+ <Border
+ Grid.Column="0"
+ MinWidth="34"
+ Margin="0,0,12,0"
+ Padding="6,2"
+ VerticalAlignment="Top"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="5"
+ >
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{Binding Index, StringFormat=#{0}}"
+ />
+ </Border>
- <Border
- Grid.Column="0"
- MinWidth="34"
- Margin="0,0,12,0"
- Padding="6,2"
- VerticalAlignment="Top"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="5">
- <ui:TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{Binding Index, StringFormat=#{0}}" />
- </Border>
+ <Image
+ Grid.Column="1"
+ Width="36"
+ Height="36"
+ Margin="0,0,12,0"
+ VerticalAlignment="Top"
+ Source="{Binding Package.LogoImage}"
+ Stretch="UniformToFill"
+ />
- <Image
- Grid.Column="1"
- Width="36"
- Height="36"
- Margin="0,0,12,0"
- VerticalAlignment="Top"
- Source="{Binding Package.LogoImage}"
- Stretch="UniformToFill" />
+ <StackPanel Grid.Column="2">
+ <DockPanel LastChildFill="False">
+ <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Package.Name}" />
- <StackPanel Grid.Column="2">
- <DockPanel LastChildFill="False">
- <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Package.Name}" />
+ <Border
+ Margin="5,0,0,0"
+ Padding="4,1"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="5"
+ >
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ Appearance="Tertiary"
+ FontTypography="Body"
+ Text="{Binding Package.Version}"
+ />
+ </Border>
- <Border
- Margin="5,0,0,0"
- Padding="4,1"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="5">
- <ui:TextBlock
- VerticalAlignment="Center"
- Appearance="Tertiary"
- FontTypography="Body"
- Text="{Binding Package.Version}" />
- </Border>
+ <Border
+ Margin="5,0,0,0"
+ Padding="4,2"
+ HorizontalAlignment="Left"
+ CornerRadius="5"
+ Visibility="{Binding Package.ShouldVisibleRisk, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource SystemFillColorSuccessBrush}"
+ />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Package.Risk}" Value="Caution">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource SystemFillColorCautionBrush}"
+ />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Margin="0,0,5,0"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Symbol="{Binding Package.RiskVisual.Icon}"
+ />
- <Border
- Margin="5,0,0,0"
- Padding="4,2"
- HorizontalAlignment="Left"
- CornerRadius="5"
- Visibility="{Binding Package.ShouldVisibleRisk, Converter={StaticResource BooleanToVisibilityConverter}}">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding Package.Risk}" Value="Caution">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,5,0"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Symbol="{Binding Package.RiskVisual.Icon}" />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Text="{Binding Package.RiskVisual.Display}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </Border>
+ </DockPanel>
- <ui:TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text="{Binding Package.RiskVisual.Display}"
- TextWrapping="Wrap" />
- </StackPanel>
- </Border>
- </DockPanel>
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ Appearance="Disabled"
+ FontTypography="Body"
+ Text="{Binding Package.Publisher}"
+ TextTrimming="CharacterEllipsis"
+ />
- <ui:TextBlock
- Margin="0,2,0,0"
- Appearance="Disabled"
- FontTypography="Body"
- Text="{Binding Package.Publisher}"
- TextTrimming="CharacterEllipsis" />
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ Appearance="Disabled"
+ FontTypography="Body"
+ Text="{Binding Package.InstallLocation}"
+ TextTrimming="CharacterEllipsis"
+ />
- <ui:TextBlock
- Margin="0,2,0,0"
- Appearance="Disabled"
- FontTypography="Body"
- Text="{Binding Package.InstallLocation}"
- TextTrimming="CharacterEllipsis" />
-
- <ui:TextBlock
- Margin="0,4,0,0"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{Binding Package.PackageFullName}"
- TextTrimming="CharacterEllipsis" />
- </StackPanel>
- </Grid>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
- </Grid>
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{Binding Package.PackageFullName}"
+ TextTrimming="CharacterEllipsis"
+ />
+ </StackPanel>
+ </Grid>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
+ </Grid>
</UserControl>
diff --git a/optimizerDuck/UI/Dialogs/LegalDialog.xaml b/optimizerDuck/UI/Dialogs/LegalDialog.xaml
index e1bc0b4..9be96ba 100644
--- a/optimizerDuck/UI/Dialogs/LegalDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/LegalDialog.xaml
@@ -1,64 +1,71 @@
<UserControl
- x:Class="optimizerDuck.UI.Dialogs.LegalDialog"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- d:DesignHeight="420"
- d:DesignWidth="520"
- mc:Ignorable="d">
+ x:Class="optimizerDuck.UI.Dialogs.LegalDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ d:DesignHeight="420"
+ d:DesignWidth="520"
+ mc:Ignorable="d"
+>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
+ <StackPanel>
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc LegalDialog.Intro.ThankYou}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Margin="0,3,0,0"
+ FontTypography="Body"
+ Text="{ext:Loc LegalDialog.Intro.Safety}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Margin="0,1,0,0"
+ FontTypography="Body"
+ Text="{ext:Loc LegalDialog.Intro.Review}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
- <StackPanel>
- <ui:TextBlock
- FontTypography="BodyStrong"
- Text="{ext:Loc LegalDialog.Intro.ThankYou}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Margin="0,3,0,0"
- FontTypography="Body"
- Text="{ext:Loc LegalDialog.Intro.Safety}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Margin="0,1,0,0"
- FontTypography="Body"
- Text="{ext:Loc LegalDialog.Intro.Review}"
- TextWrapping="Wrap" />
- </StackPanel>
+ <StackPanel Grid.Row="1" Margin="0,6,0,6">
+ <ui:HyperlinkButton
+ Content="{ext:Loc Key=LegalDialog.Link.TermsOfService}"
+ Icon="{ui:SymbolIcon DocumentText24}"
+ NavigateUri="https://github.com/itsfatduck/optimizerDuck/blob/master/TERMS.md"
+ />
- <StackPanel Grid.Row="1" Margin="0,6,0,6">
- <ui:HyperlinkButton
- Content="{ext:Loc Key=LegalDialog.Link.TermsOfService}"
- Icon="{ui:SymbolIcon DocumentText24}"
- NavigateUri="https://github.com/itsfatduck/optimizerDuck/blob/master/TERMS.md" />
+ <ui:HyperlinkButton
+ Margin="0,4,0,0"
+ Content="{ext:Loc Key=LegalDialog.Link.PrivacyPolicy}"
+ Icon="{ui:SymbolIcon ShieldLock24}"
+ NavigateUri="https://github.com/itsfatduck/optimizerDuck/blob/master/PRIVACY.md"
+ />
- <ui:HyperlinkButton
- Margin="0,4,0,0"
- Content="{ext:Loc Key=LegalDialog.Link.PrivacyPolicy}"
- Icon="{ui:SymbolIcon ShieldLock24}"
- NavigateUri="https://github.com/itsfatduck/optimizerDuck/blob/master/PRIVACY.md" />
+ <ui:HyperlinkButton
+ Margin="0,4,0,0"
+ Content="{ext:Loc Key=LegalDialog.Link.Disclaimer}"
+ Icon="{ui:SymbolIcon Warning24}"
+ NavigateUri="https://github.com/itsfatduck/optimizerDuck/blob/master/DISCLAIMER.md"
+ />
+ </StackPanel>
- <ui:HyperlinkButton
- Margin="0,4,0,0"
- Content="{ext:Loc Key=LegalDialog.Link.Disclaimer}"
- Icon="{ui:SymbolIcon Warning24}"
- NavigateUri="https://github.com/itsfatduck/optimizerDuck/blob/master/DISCLAIMER.md" />
- </StackPanel>
-
- <ui:InfoBar
- Title="{ext:Loc Key=LegalDialog.Warning.Title}"
- Grid.Row="2"
- IsClosable="False"
- IsOpen="True"
- Message="{ext:Loc Key=LegalDialog.Warning.Message}"
- Severity="Warning" />
- </Grid>
-</UserControl>
\ No newline at end of file
+ <ui:InfoBar
+ Title="{ext:Loc Key=LegalDialog.Warning.Title}"
+ Grid.Row="2"
+ IsClosable="False"
+ IsOpen="True"
+ Message="{ext:Loc Key=LegalDialog.Warning.Message}"
+ Severity="Warning"
+ />
+ </Grid>
+</UserControl>
diff --git a/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml b/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml
index ded7cdc..0d4fcdb 100644
--- a/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml
@@ -1,233 +1,263 @@
<UserControl
- x:Class="optimizerDuck.UI.Dialogs.OptimizationDetailsDialog"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- d:DesignHeight="760"
- d:DesignWidth="760"
- ScrollViewer.CanContentScroll="False"
- mc:Ignorable="d">
- <StackPanel>
- <Border
- Margin="0,0,0,12"
- Padding="16"
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- BorderBrush="{DynamicResource CardBorderBrush}"
- BorderThickness="1"
- CornerRadius="8">
- <Grid RowDefinitions="Auto,Auto,Auto,Auto">
- <ui:TextBlock
- Appearance="Disabled"
- FontTypography="Caption"
- Text="{Binding Optimization.Id}" />
-
- <ui:TextBlock
- Grid.Row="1"
- Margin="0,2,0,0"
- FontTypography="Subtitle"
- Text="{Binding Optimization.Name}"
- TextWrapping="Wrap" />
-
- <ui:VirtualizingItemsControl
- Grid.Row="2"
- Margin="0,8,0,0"
- ItemsSource="{Binding Optimization.TagDisplays}">
- <ui:VirtualizingItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel HorizontalAlignment="Left" VerticalAlignment="Top" />
- </ItemsPanelTemplate>
- </ui:VirtualizingItemsControl.ItemsPanel>
- <ui:VirtualizingItemsControl.ItemContainerStyle>
- <Style TargetType="ContentPresenter">
- <Setter Property="Margin" Value="0,0,6,6" />
- </Style>
- </ui:VirtualizingItemsControl.ItemContainerStyle>
- <ui:VirtualizingItemsControl.ItemTemplate>
- <DataTemplate>
- <Border
- Padding="6,3"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="5">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Symbol="{Binding Icon}" />
- <ui:TextBlock
- VerticalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{Binding Display}" />
- </StackPanel>
- </Border>
- </DataTemplate>
- </ui:VirtualizingItemsControl.ItemTemplate>
- </ui:VirtualizingItemsControl>
-
- <Grid
- Grid.Row="3"
- Margin="0,4,0,0"
- ColumnDefinitions="Auto,Auto,*">
- <Border
- Padding="6,4"
- HorizontalAlignment="Left"
- CornerRadius="5">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding Optimization.Risk}" Value="Moderate">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding Optimization.Risk}" Value="Risky">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Symbol="{Binding Optimization.RiskVisual.Icon}" />
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text="{Binding Optimization.RiskVisual.Display}" />
- </StackPanel>
- </Border>
+ x:Class="optimizerDuck.UI.Dialogs.OptimizationDetailsDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ d:DesignHeight="760"
+ d:DesignWidth="760"
+ ScrollViewer.CanContentScroll="False"
+ mc:Ignorable="d"
+>
+ <StackPanel>
+ <Border
+ Margin="0,0,0,12"
+ Padding="16"
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ BorderBrush="{DynamicResource CardBorderBrush}"
+ BorderThickness="1"
+ CornerRadius="8"
+ >
+ <Grid RowDefinitions="Auto,Auto,Auto,Auto">
+ <ui:TextBlock
+ Appearance="Disabled"
+ FontTypography="Caption"
+ Text="{Binding Optimization.Id}"
+ />
- <Border
- Grid.Column="1"
- Margin="8,0,0,0"
- Padding="6,4"
- HorizontalAlignment="Left"
- Background="{DynamicResource CardBackgroundDisabled}"
- CornerRadius="5"
- ToolTip="{Binding Optimization.State.AppliedAt}"
- ToolTipService.InitialShowDelay="150"
- ToolTipService.Placement="Top"
- Visibility="{Binding Optimization.State.AppliedAt, Converter={StaticResource NullToVisibilityConverter}}">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon Margin="0,0,6,0" Symbol="CheckmarkCircle24" />
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="Caption"
- Text="{Binding Optimization.State.RelativeTime}" />
- </StackPanel>
- </Border>
- </Grid>
- </Grid>
- </Border>
+ <ui:TextBlock
+ Grid.Row="1"
+ Margin="0,2,0,0"
+ FontTypography="Subtitle"
+ Text="{Binding Optimization.Name}"
+ TextWrapping="Wrap"
+ />
- <Border
- Margin="0,0,0,12"
- Padding="16"
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- BorderBrush="{DynamicResource CardBorderBrush}"
- BorderThickness="1"
- CornerRadius="8">
- <StackPanel>
- <ui:TextBlock
- Margin="0,0,0,8"
- FontTypography="BodyStrong"
- Text="{ext:Loc OptimizationDetailsDialog.DetailedDescription}" />
- <ui:TextBlock
+ <ui:VirtualizingItemsControl
+ Grid.Row="2"
+ Margin="0,8,0,0"
+ ItemsSource="{Binding Optimization.TagDisplays}"
+ >
+ <ui:VirtualizingItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel HorizontalAlignment="Left" VerticalAlignment="Top" />
+ </ItemsPanelTemplate>
+ </ui:VirtualizingItemsControl.ItemsPanel>
+ <ui:VirtualizingItemsControl.ItemContainerStyle>
+ <Style TargetType="ContentPresenter">
+ <Setter Property="Margin" Value="0,0,6,6" />
+ </Style>
+ </ui:VirtualizingItemsControl.ItemContainerStyle>
+ <ui:VirtualizingItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border
+ Padding="6,3"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="5"
+ >
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Symbol="{Binding Icon}"
+ />
+ <ui:TextBlock
+ VerticalAlignment="Center"
Appearance="Secondary"
- FontTypography="Body"
- Text="{Binding Optimization.ShortDescription}"
- TextWrapping="Wrap" />
+ FontTypography="Caption"
+ Text="{Binding Display}"
+ />
+ </StackPanel>
+ </Border>
+ </DataTemplate>
+ </ui:VirtualizingItemsControl.ItemTemplate>
+ </ui:VirtualizingItemsControl>
+
+ <Grid Grid.Row="3" Margin="0,4,0,0" ColumnDefinitions="Auto,Auto,*">
+ <Border Padding="6,4" HorizontalAlignment="Left" CornerRadius="5">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource SystemFillColorSuccessBrush}"
+ />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Optimization.Risk}" Value="Moderate">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource SystemFillColorCautionBrush}"
+ />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Optimization.Risk}" Value="Risky">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource SystemFillColorCriticalBrush}"
+ />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Symbol="{Binding Optimization.RiskVisual.Icon}"
+ />
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Text="{Binding Optimization.RiskVisual.Display}"
+ />
</StackPanel>
- </Border>
+ </Border>
- <Border
- Margin="0,0,0,12"
- Padding="0"
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- BorderBrush="{DynamicResource CardBorderBrush}"
- BorderThickness="1"
- CornerRadius="8">
- <StackPanel>
- <Grid Margin="16">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="150" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:TextBlock
- Grid.Column="0"
- VerticalAlignment="Center"
- Appearance="Secondary"
- Text="{ext:Loc OptimizationDetailsDialog.Id}" />
- <ui:TextBlock
- Grid.Column="1"
- VerticalAlignment="Center"
- FontFamily="Consolas"
- Text="{Binding Optimization.Id}"
- TextWrapping="Wrap" />
- </Grid>
- <Separator Margin="16,0" />
- <Grid Margin="16">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="150" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:TextBlock
- Grid.Column="0"
- VerticalAlignment="Center"
- Appearance="Secondary"
- Text="{ext:Loc OptimizationDetailsDialog.Class}" />
- <ui:TextBlock
- Grid.Column="1"
- VerticalAlignment="Center"
- FontFamily="Consolas"
- Text="{Binding Optimization.OptimizationKey}"
- TextWrapping="Wrap" />
- </Grid>
+ <Border
+ Grid.Column="1"
+ Margin="8,0,0,0"
+ Padding="6,4"
+ HorizontalAlignment="Left"
+ Background="{DynamicResource CardBackgroundDisabled}"
+ CornerRadius="5"
+ ToolTip="{Binding Optimization.State.AppliedAt}"
+ ToolTipService.InitialShowDelay="150"
+ ToolTipService.Placement="Top"
+ Visibility="{Binding Optimization.State.AppliedAt, Converter={StaticResource NullToVisibilityConverter}}"
+ >
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon Margin="0,0,6,0" Symbol="CheckmarkCircle24" />
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ FontTypography="Caption"
+ Text="{Binding Optimization.State.RelativeTime}"
+ />
</StackPanel>
- </Border>
+ </Border>
+ </Grid>
+ </Grid>
+ </Border>
+ <Border
+ Margin="0,0,0,12"
+ Padding="16"
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ BorderBrush="{DynamicResource CardBorderBrush}"
+ BorderThickness="1"
+ CornerRadius="8"
+ >
+ <StackPanel>
<ui:TextBlock
- Margin="0,0,0,8"
- FontTypography="BodyStrong"
- Text="{ext:Loc OptimizationDetailsDialog.Other}" />
+ Margin="0,0,0,8"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc OptimizationDetailsDialog.DetailedDescription}"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{Binding Optimization.ShortDescription}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </Border>
- <ui:CardAction
- Margin="0,0,0,8"
- Command="{Binding ViewSourceOnGitHubCommand}"
- Icon="{ui:SymbolIcon Code24}">
- <StackPanel>
- <ui:TextBlock
- FontTypography="BodyStrong"
- Text="{ext:Loc OptimizationDetailsDialog.Other.ViewSource.Title}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc OptimizationDetailsDialog.Other.ViewSource.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- </ui:CardAction>
+ <Border
+ Margin="0,0,0,12"
+ Padding="0"
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ BorderBrush="{DynamicResource CardBorderBrush}"
+ BorderThickness="1"
+ CornerRadius="8"
+ >
+ <StackPanel>
+ <Grid Margin="16">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="150" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:TextBlock
+ Grid.Column="0"
+ VerticalAlignment="Center"
+ Appearance="Secondary"
+ Text="{ext:Loc OptimizationDetailsDialog.Id}"
+ />
+ <ui:TextBlock
+ Grid.Column="1"
+ VerticalAlignment="Center"
+ FontFamily="Consolas"
+ Text="{Binding Optimization.Id}"
+ TextWrapping="Wrap"
+ />
+ </Grid>
+ <Separator Margin="16,0" />
+ <Grid Margin="16">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="150" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:TextBlock
+ Grid.Column="0"
+ VerticalAlignment="Center"
+ Appearance="Secondary"
+ Text="{ext:Loc OptimizationDetailsDialog.Class}"
+ />
+ <ui:TextBlock
+ Grid.Column="1"
+ VerticalAlignment="Center"
+ FontFamily="Consolas"
+ Text="{Binding Optimization.OptimizationKey}"
+ TextWrapping="Wrap"
+ />
+ </Grid>
+ </StackPanel>
+ </Border>
- <ui:CardAction
- Margin="0,0,0,4"
- Command="{Binding OpenRevertFileCommand}"
- Icon="{ui:SymbolIcon FolderOpen24}"
- Visibility="{Binding Optimization.State.AppliedAt, Converter={StaticResource NullToVisibilityConverter}}">
- <StackPanel>
- <ui:TextBlock
- FontTypography="BodyStrong"
- Text="{ext:Loc OptimizationDetailsDialog.Other.OpenRevertFile.Title}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc OptimizationDetailsDialog.Other.OpenRevertFile.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- </ui:CardAction>
- </StackPanel>
+ <ui:TextBlock
+ Margin="0,0,0,8"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc OptimizationDetailsDialog.Other}"
+ />
+
+ <ui:CardAction
+ Margin="0,0,0,8"
+ Command="{Binding ViewSourceOnGitHubCommand}"
+ Icon="{ui:SymbolIcon Code24}"
+ >
+ <StackPanel>
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc OptimizationDetailsDialog.Other.ViewSource.Title}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc OptimizationDetailsDialog.Other.ViewSource.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </ui:CardAction>
+
+ <ui:CardAction
+ Margin="0,0,0,4"
+ Command="{Binding OpenRevertFileCommand}"
+ Icon="{ui:SymbolIcon FolderOpen24}"
+ Visibility="{Binding Optimization.State.AppliedAt, Converter={StaticResource NullToVisibilityConverter}}"
+ >
+ <StackPanel>
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc OptimizationDetailsDialog.Other.OpenRevertFile.Title}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc OptimizationDetailsDialog.Other.OpenRevertFile.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </ui:CardAction>
+ </StackPanel>
</UserControl>
diff --git a/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml.cs b/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml.cs
index 427286b..82972c2 100644
--- a/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml.cs
+++ b/optimizerDuck/UI/Dialogs/OptimizationDetailsDialog.xaml.cs
@@ -11,4 +11,4 @@ public partial class OptimizationDetailsDialog : UserControl
{
InitializeComponent();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml b/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml
index 04ea6f6..742f301 100644
--- a/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml
@@ -1,123 +1,136 @@
<UserControl
- d:DesignHeight="450"
- d:DesignWidth="800"
- mc:Ignorable="d"
- x:Class="optimizerDuck.UI.Dialogs.OptimizationResultDialog"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
- <UserControl.Resources>
- <converters:NullToVisibilityConverter
- False="Visible"
- True="Collapsed"
- x:Key="NullToVisibilityConverter" />
- </UserControl.Resources>
- <StackPanel>
- <!-- Header with failed count summary -->
- <StackPanel Orientation="Horizontal" Margin="0,0,0,4">
- <ui:SymbolIcon
- Filled="True"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Margin="0,0,8,0"
- Symbol="ErrorCircle24"
- VerticalAlignment="Center" />
+ d:DesignHeight="450"
+ d:DesignWidth="800"
+ mc:Ignorable="d"
+ x:Class="optimizerDuck.UI.Dialogs.OptimizationResultDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <UserControl.Resources>
+ <converters:NullToVisibilityConverter
+ False="Visible"
+ True="Collapsed"
+ x:Key="NullToVisibilityConverter"
+ />
+ </UserControl.Resources>
+ <StackPanel>
+ <!-- Header with failed count summary -->
+ <StackPanel Orientation="Horizontal" Margin="0,0,0,4">
+ <ui:SymbolIcon
+ Filled="True"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Margin="0,0,8,0"
+ Symbol="ErrorCircle24"
+ VerticalAlignment="Center"
+ />
- <ui:TextBlock
- FontTypography="Subtitle"
- Text="{ext:Loc OptimizationResultDialog.Header,
+ <ui:TextBlock
+ FontTypography="Subtitle"
+ Text="{ext:Loc OptimizationResultDialog.Header,
{Binding FailedCount}}"
- TextTrimming="WordEllipsis"
- TextWrapping="Wrap" />
- </StackPanel>
+ TextTrimming="WordEllipsis"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Body"
- Margin="0,2,0,12"
- Text="{ext:Loc OptimizationResultDialog.Description}"
- TextWrapping="Wrap" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Body"
+ Margin="0,2,0,12"
+ Text="{ext:Loc OptimizationResultDialog.Description}"
+ TextWrapping="Wrap"
+ />
- <ScrollViewer MaxHeight="350" VerticalScrollBarVisibility="Auto">
- <ItemsControl ItemsSource="{Binding FailedSteps}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <ui:CardControl Margin="0,0,0,8">
- <ui:CardControl.Header>
- <StackPanel>
- <!-- Top row: index + service type badge + step name -->
- <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
- <!-- Step index badge -->
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- HorizontalAlignment="Left"
- Margin="0,0,8,0"
- Padding="6,2"
- VerticalAlignment="Center">
- <ui:TextBlock
- Appearance="Disabled"
- FontTypography="Caption"
- Text="{Binding Index, StringFormat=# {0}}"
- VerticalAlignment="Center" />
- </Border>
+ <ScrollViewer MaxHeight="350" VerticalScrollBarVisibility="Auto">
+ <ItemsControl ItemsSource="{Binding FailedSteps}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <ui:CardControl Margin="0,0,0,8">
+ <ui:CardControl.Header>
+ <StackPanel>
+ <!-- Top row: index + service type badge + step name -->
+ <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+ <!-- Step index badge -->
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ HorizontalAlignment="Left"
+ Margin="0,0,8,0"
+ Padding="6,2"
+ VerticalAlignment="Center"
+ >
+ <ui:TextBlock
+ Appearance="Disabled"
+ FontTypography="Caption"
+ Text="{Binding Index, StringFormat=# {0}}"
+ VerticalAlignment="Center"
+ />
+ </Border>
- <!-- Service type badge -->
- <Border
- Background="{DynamicResource SystemFillColorAttentionBackgroundBrush}"
- CornerRadius="4"
- HorizontalAlignment="Left"
- Margin="0,0,8,0"
- Padding="6,2"
- VerticalAlignment="Center">
- <ui:TextBlock
- FontTypography="Caption"
- Foreground="{DynamicResource SystemFillColorAttentionBrush}"
- Text="{Binding Name}"
- VerticalAlignment="Center" />
- </Border>
- </StackPanel>
+ <!-- Service type badge -->
+ <Border
+ Background="{DynamicResource SystemFillColorAttentionBackgroundBrush}"
+ CornerRadius="4"
+ HorizontalAlignment="Left"
+ Margin="0,0,8,0"
+ Padding="6,2"
+ VerticalAlignment="Center"
+ >
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{DynamicResource SystemFillColorAttentionBrush}"
+ Text="{Binding Name}"
+ VerticalAlignment="Center"
+ />
+ </Border>
+ </StackPanel>
- <!-- Step description -->
- <ui:TextBlock
- FontTypography="BodyStrong"
- Margin="0,0,0,4"
- Text="{Binding Description}"
- TextWrapping="Wrap" />
+ <!-- Step description -->
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Margin="0,0,0,4"
+ Text="{Binding Description}"
+ TextWrapping="Wrap"
+ />
- <!-- Error message -->
- <Border
- BorderBrush="{DynamicResource SystemFillColorCriticalBrush}"
- BorderThickness="1"
- CornerRadius="6"
- HorizontalAlignment="Left"
- Margin="0,4,0,0"
- Padding="8,6"
- Visibility="{Binding Error, Converter={StaticResource NullToVisibilityConverter}}">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Filled="True"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Margin="0,0,6,0"
- Symbol="Warning24"
- VerticalAlignment="Center" />
- <ui:TextBlock
- FontTypography="Caption"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- HorizontalAlignment="Stretch"
- Text="{Binding Error}"
- TextWrapping="Wrap" />
- </StackPanel>
- </Border>
- </StackPanel>
- </ui:CardControl.Header>
- </ui:CardControl>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
- </StackPanel>
-</UserControl>
\ No newline at end of file
+ <!-- Error message -->
+ <Border
+ BorderBrush="{DynamicResource SystemFillColorCriticalBrush}"
+ BorderThickness="1"
+ CornerRadius="6"
+ HorizontalAlignment="Left"
+ Margin="0,4,0,0"
+ Padding="8,6"
+ Visibility="{Binding Error, Converter={StaticResource NullToVisibilityConverter}}"
+ >
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Filled="True"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Margin="0,0,6,0"
+ Symbol="Warning24"
+ VerticalAlignment="Center"
+ />
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ HorizontalAlignment="Stretch"
+ Text="{Binding Error}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </Border>
+ </StackPanel>
+ </ui:CardControl.Header>
+ </ui:CardControl>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
+ </StackPanel>
+</UserControl>
diff --git a/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml.cs b/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml.cs
index c168512..f32d722 100644
--- a/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml.cs
+++ b/optimizerDuck/UI/Dialogs/OptimizationResultDialog.xaml.cs
@@ -6,4 +6,4 @@ public partial class OptimizationResultDialog
{
InitializeComponent();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml b/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml
index 98cc3db..b54f747 100644
--- a/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml
@@ -1,31 +1,31 @@
<UserControl
- d:DesignHeight="450"
- d:DesignWidth="800"
- mc:Ignorable="d"
- x:Class="optimizerDuck.UI.Dialogs.ProcessingDialog"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:extensions="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
- <StackPanel>
- <TextBlock
- HorizontalAlignment="Center"
- Margin="0,0,0,5"
- Text="{Binding Message}" />
+ d:DesignHeight="450"
+ d:DesignWidth="800"
+ mc:Ignorable="d"
+ x:Class="optimizerDuck.UI.Dialogs.ProcessingDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:extensions="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <StackPanel>
+ <TextBlock HorizontalAlignment="Center" Margin="0,0,0,5" Text="{Binding Message}" />
- <ProgressBar
- IsIndeterminate="{Binding IsIndeterminate}"
- Maximum="{Binding Total}"
- Minimum="0"
- Value="{Binding Value}" />
+ <ProgressBar
+ IsIndeterminate="{Binding IsIndeterminate}"
+ Maximum="{Binding Total}"
+ Minimum="0"
+ Value="{Binding Value}"
+ />
- <ui:TextBlock
- FontTypography="Body"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- HorizontalAlignment="Center"
- Margin="0,25,0,0"
- Text="{extensions:Loc ProcessingOptimizationDialog.Warning.DontCloseAppOrRestart}" />
- </StackPanel>
-</UserControl>
\ No newline at end of file
+ <ui:TextBlock
+ FontTypography="Body"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ HorizontalAlignment="Center"
+ Margin="0,25,0,0"
+ Text="{extensions:Loc ProcessingOptimizationDialog.Warning.DontCloseAppOrRestart}"
+ />
+ </StackPanel>
+</UserControl>
diff --git a/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml.cs b/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml.cs
index 630faf8..a9b13e9 100644
--- a/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml.cs
+++ b/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml.cs
@@ -14,4 +14,4 @@ public partial class ProcessingDialog : UserControl
}
public ProcessingViewModel? ViewModel => DataContext as ProcessingViewModel;
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Dialogs/RestorePointDialog.xaml b/optimizerDuck/UI/Dialogs/RestorePointDialog.xaml
index 5128e6a..e69f48a 100644
--- a/optimizerDuck/UI/Dialogs/RestorePointDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/RestorePointDialog.xaml
@@ -1,30 +1,33 @@
<UserControl
- d:DesignHeight="300"
- d:DesignWidth="300"
- mc:Ignorable="d"
- x:Class="optimizerDuck.UI.Dialogs.RestorePointDialog"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
- <Grid>
- <StackPanel>
- <ui:SymbolIcon FontSize="48" Symbol="DatabaseLightning20" />
- <ui:TextBlock
- FontTypography="Body"
- HorizontalAlignment="Center"
- Text="{ext:Loc RestorePointDialog.Description}"
- TextAlignment="Center"
- TextWrapping="Wrap" />
+ d:DesignHeight="300"
+ d:DesignWidth="300"
+ mc:Ignorable="d"
+ x:Class="optimizerDuck.UI.Dialogs.RestorePointDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <Grid>
+ <StackPanel>
+ <ui:SymbolIcon FontSize="48" Symbol="DatabaseLightning20" />
+ <ui:TextBlock
+ FontTypography="Body"
+ HorizontalAlignment="Center"
+ Text="{ext:Loc RestorePointDialog.Description}"
+ TextAlignment="Center"
+ TextWrapping="Wrap"
+ />
- <ui:InfoBar
- IsClosable="False"
- IsOpen="True"
- Margin="0,15,0,0"
- Message="{ext:Loc RestorePointDialog.Help}"
- Severity="Success" />
- </StackPanel>
- </Grid>
-</UserControl>
\ No newline at end of file
+ <ui:InfoBar
+ IsClosable="False"
+ IsOpen="True"
+ Margin="0,15,0,0"
+ Message="{ext:Loc RestorePointDialog.Help}"
+ Severity="Success"
+ />
+ </StackPanel>
+ </Grid>
+</UserControl>
diff --git a/optimizerDuck/UI/Dialogs/RestorePointDialog.xaml.cs b/optimizerDuck/UI/Dialogs/RestorePointDialog.xaml.cs
index 23ee38e..6e79c26 100644
--- a/optimizerDuck/UI/Dialogs/RestorePointDialog.xaml.cs
+++ b/optimizerDuck/UI/Dialogs/RestorePointDialog.xaml.cs
@@ -8,4 +8,4 @@ public partial class RestorePointDialog : UserControl
{
InitializeComponent();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Dialogs/ScheduledTaskCreateDialog.xaml b/optimizerDuck/UI/Dialogs/ScheduledTaskCreateDialog.xaml
index b2efeb4..92986e9 100644
--- a/optimizerDuck/UI/Dialogs/ScheduledTaskCreateDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/ScheduledTaskCreateDialog.xaml
@@ -1,148 +1,162 @@
<UserControl
- d:DesignHeight="400"
- d:DesignWidth="500"
- mc:Ignorable="d"
- x:Class="optimizerDuck.UI.Dialogs.ScheduledTaskCreateDialog"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ d:DesignHeight="400"
+ d:DesignWidth="500"
+ mc:Ignorable="d"
+ x:Class="optimizerDuck.UI.Dialogs.ScheduledTaskCreateDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <Grid MinWidth="480">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
- <Grid MinWidth="480">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
+ <Grid Grid.Row="1">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="24" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
- <Grid Grid.Row="1">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="24" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
+ <!-- Left Column: General & Action Info -->
+ <StackPanel Grid.Column="0">
+ <ui:TextBlock
+ FontTypography="Caption"
+ Margin="0,0,0,4"
+ Text="{ext:Loc ScheduledTasks.Dialog.TaskName}"
+ />
+ <ui:TextBox
+ Margin="0,0,0,12"
+ PlaceholderText="{ext:Loc ScheduledTasks.Dialog.TaskNameHint}"
+ x:Name="TaskNameBox"
+ />
- <!-- Left Column: General & Action Info -->
- <StackPanel Grid.Column="0">
- <ui:TextBlock
- FontTypography="Caption"
- Margin="0,0,0,4"
- Text="{ext:Loc ScheduledTasks.Dialog.TaskName}" />
- <ui:TextBox
- Margin="0,0,0,12"
- PlaceholderText="{ext:Loc ScheduledTasks.Dialog.TaskNameHint}"
- x:Name="TaskNameBox" />
+ <ui:TextBlock
+ FontTypography="Caption"
+ Margin="0,0,0,4"
+ Text="{ext:Loc ScheduledTasks.Dialog.Description}"
+ />
+ <ui:TextBox
+ AcceptsReturn="True"
+ Margin="0,0,0,12"
+ MinHeight="60"
+ PlaceholderText="{ext:Loc ScheduledTasks.Dialog.DescriptionHint}"
+ TextWrapping="Wrap"
+ x:Name="DescriptionBox"
+ />
- <ui:TextBlock
- FontTypography="Caption"
- Margin="0,0,0,4"
- Text="{ext:Loc ScheduledTasks.Dialog.Description}" />
- <ui:TextBox
- AcceptsReturn="True"
- Margin="0,0,0,12"
- MinHeight="60"
- PlaceholderText="{ext:Loc ScheduledTasks.Dialog.DescriptionHint}"
- TextWrapping="Wrap"
- x:Name="DescriptionBox" />
+ <ui:TextBlock
+ FontTypography="Caption"
+ Margin="0,0,0,4"
+ Text="{ext:Loc ScheduledTasks.Dialog.FolderPath}"
+ />
+ <ui:TextBox Margin="0,0,0,12" PlaceholderText="\" x:Name="FolderPathBox" />
- <ui:TextBlock
- FontTypography="Caption"
- Margin="0,0,0,4"
- Text="{ext:Loc ScheduledTasks.Dialog.FolderPath}" />
- <ui:TextBox
- Margin="0,0,0,12"
- PlaceholderText="\"
- x:Name="FolderPathBox" />
+ <ui:TextBlock
+ FontTypography="Caption"
+ Margin="0,0,0,4"
+ Text="{ext:Loc ScheduledTasks.Dialog.Executable}"
+ />
+ <ui:TextBox
+ Margin="0,0,0,12"
+ PlaceholderText="{ext:Loc ScheduledTasks.Dialog.ExecutableHint}"
+ x:Name="ExecutableBox"
+ />
- <ui:TextBlock
- FontTypography="Caption"
- Margin="0,0,0,4"
- Text="{ext:Loc ScheduledTasks.Dialog.Executable}" />
- <ui:TextBox
- Margin="0,0,0,12"
- PlaceholderText="{ext:Loc ScheduledTasks.Dialog.ExecutableHint}"
- x:Name="ExecutableBox" />
+ <ui:TextBlock
+ FontTypography="Caption"
+ Margin="0,0,0,4"
+ Text="{ext:Loc ScheduledTasks.Dialog.Arguments}"
+ />
+ <ui:TextBox
+ Margin="0,0,0,12"
+ PlaceholderText="{ext:Loc ScheduledTasks.Dialog.ArgumentsHint}"
+ x:Name="ArgumentsBox"
+ />
+ </StackPanel>
- <ui:TextBlock
- FontTypography="Caption"
- Margin="0,0,0,4"
- Text="{ext:Loc ScheduledTasks.Dialog.Arguments}" />
- <ui:TextBox
- Margin="0,0,0,12"
- PlaceholderText="{ext:Loc ScheduledTasks.Dialog.ArgumentsHint}"
- x:Name="ArgumentsBox" />
- </StackPanel>
-
- <!-- Right Column: Triggers & Settings -->
- <StackPanel Grid.Column="2">
- <ui:TextBlock
- FontTypography="Caption"
- Margin="0,0,0,4"
- Text="{ext:Loc ScheduledTasks.Dialog.Trigger}" />
- <Border
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- CornerRadius="4"
- Margin="0,0,0,12"
- Padding="12">
- <StackPanel>
- <CheckBox
- Content="{ext:Loc ScheduledTasks.Dialog.TriggerLogon}"
- IsChecked="True"
- Margin="0,0,0,8"
- x:Name="LogonTriggerCheck" />
- <CheckBox
- Content="{ext:Loc ScheduledTasks.Dialog.TriggerBoot}"
- Margin="0,0,0,8"
- x:Name="BootTriggerCheck" />
- <CheckBox
- Content="{ext:Loc ScheduledTasks.Dialog.TriggerIdle}"
- Margin="0,0,0,8"
- x:Name="IdleTriggerCheck" />
- <CheckBox
- Content="{ext:Loc ScheduledTasks.Dialog.TriggerRegistration}"
- Margin="0,0,0,8"
- x:Name="RegistrationTriggerCheck" />
+ <!-- Right Column: Triggers & Settings -->
+ <StackPanel Grid.Column="2">
+ <ui:TextBlock
+ FontTypography="Caption"
+ Margin="0,0,0,4"
+ Text="{ext:Loc ScheduledTasks.Dialog.Trigger}"
+ />
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ CornerRadius="4"
+ Margin="0,0,0,12"
+ Padding="12"
+ >
+ <StackPanel>
+ <CheckBox
+ Content="{ext:Loc ScheduledTasks.Dialog.TriggerLogon}"
+ IsChecked="True"
+ Margin="0,0,0,8"
+ x:Name="LogonTriggerCheck"
+ />
+ <CheckBox
+ Content="{ext:Loc ScheduledTasks.Dialog.TriggerBoot}"
+ Margin="0,0,0,8"
+ x:Name="BootTriggerCheck"
+ />
+ <CheckBox
+ Content="{ext:Loc ScheduledTasks.Dialog.TriggerIdle}"
+ Margin="0,0,0,8"
+ x:Name="IdleTriggerCheck"
+ />
+ <CheckBox
+ Content="{ext:Loc ScheduledTasks.Dialog.TriggerRegistration}"
+ Margin="0,0,0,8"
+ x:Name="RegistrationTriggerCheck"
+ />
- <StackPanel Margin="0,0,0,0" Orientation="Horizontal">
- <CheckBox
- Content="{ext:Loc ScheduledTasks.Dialog.TriggerDaily}"
- Margin="0,0,12,0"
- VerticalAlignment="Center"
- x:Name="DailyTriggerCheck" />
- <ui:TextBox
- IsEnabled="{Binding ElementName=DailyTriggerCheck, Path=IsChecked}"
- PlaceholderText="12:00"
- ToolTip="{ext:Loc ScheduledTasks.Dialog.Time}"
- Width="80"
- x:Name="DailyTimeBox" />
- </StackPanel>
- </StackPanel>
- </Border>
-
- <ui:TextBlock
- FontTypography="Caption"
- Margin="0,0,0,4"
- Text="Settings" />
- <Border
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- CornerRadius="4"
- Margin="0,0,0,12"
- Padding="12">
- <StackPanel>
- <CheckBox
- Content="{ext:Loc ScheduledTasks.Dialog.Enabled}"
- IsChecked="True"
- Margin="0,0,0,8"
- x:Name="EnabledCheck" />
- <CheckBox
- Content="{ext:Loc ScheduledTasks.Dialog.HighestPrivileges}"
- Margin="0,0,0,8"
- x:Name="HighestPrivilegesCheck" />
- <CheckBox Content="{ext:Loc ScheduledTasks.Dialog.Hidden}" x:Name="HiddenCheck" />
- </StackPanel>
- </Border>
+ <StackPanel Margin="0,0,0,0" Orientation="Horizontal">
+ <CheckBox
+ Content="{ext:Loc ScheduledTasks.Dialog.TriggerDaily}"
+ Margin="0,0,12,0"
+ VerticalAlignment="Center"
+ x:Name="DailyTriggerCheck"
+ />
+ <ui:TextBox
+ IsEnabled="{Binding ElementName=DailyTriggerCheck, Path=IsChecked}"
+ PlaceholderText="12:00"
+ ToolTip="{ext:Loc ScheduledTasks.Dialog.Time}"
+ Width="80"
+ x:Name="DailyTimeBox"
+ />
</StackPanel>
- </Grid>
+ </StackPanel>
+ </Border>
+
+ <ui:TextBlock FontTypography="Caption" Margin="0,0,0,4" Text="Settings" />
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ CornerRadius="4"
+ Margin="0,0,0,12"
+ Padding="12"
+ >
+ <StackPanel>
+ <CheckBox
+ Content="{ext:Loc ScheduledTasks.Dialog.Enabled}"
+ IsChecked="True"
+ Margin="0,0,0,8"
+ x:Name="EnabledCheck"
+ />
+ <CheckBox
+ Content="{ext:Loc ScheduledTasks.Dialog.HighestPrivileges}"
+ Margin="0,0,0,8"
+ x:Name="HighestPrivilegesCheck"
+ />
+ <CheckBox Content="{ext:Loc ScheduledTasks.Dialog.Hidden}" x:Name="HiddenCheck" />
+ </StackPanel>
+ </Border>
+ </StackPanel>
</Grid>
-</UserControl>
\ No newline at end of file
+ </Grid>
+</UserControl>
diff --git a/optimizerDuck/UI/Dialogs/ScheduledTaskCreateDialog.xaml.cs b/optimizerDuck/UI/Dialogs/ScheduledTaskCreateDialog.xaml.cs
index 84e809b..b630106 100644
--- a/optimizerDuck/UI/Dialogs/ScheduledTaskCreateDialog.xaml.cs
+++ b/optimizerDuck/UI/Dialogs/ScheduledTaskCreateDialog.xaml.cs
@@ -15,17 +15,23 @@ public partial class ScheduledTaskCreateDialog : UserControl
get
{
var name = TaskNameBox.Text?.Trim();
- if (string.IsNullOrWhiteSpace(name)) return null;
+ if (string.IsNullOrWhiteSpace(name))
+ return null;
var folderPath = FolderPathBox.Text?.Trim() ?? "\\";
- if (!folderPath.StartsWith("\\")) folderPath = "\\" + folderPath;
- if (folderPath.Length > 1) folderPath = folderPath.TrimEnd('\\');
+ if (!folderPath.StartsWith("\\"))
+ folderPath = "\\" + folderPath;
+ if (folderPath.Length > 1)
+ folderPath = folderPath.TrimEnd('\\');
var fullPath = folderPath == "\\" ? $"\\{name}" : $"{folderPath}\\{name}";
// Parse daily time
var time = TimeSpan.Zero;
- if (DailyTriggerCheck.IsChecked == true && !string.IsNullOrWhiteSpace(DailyTimeBox.Text))
+ if (
+ DailyTriggerCheck.IsChecked == true
+ && !string.IsNullOrWhiteSpace(DailyTimeBox.Text)
+ )
if (TimeSpan.TryParse(DailyTimeBox.Text.Trim(), out var parsedTime))
time = parsedTime;
@@ -45,8 +51,8 @@ public partial class ScheduledTaskCreateDialog : UserControl
HasDailyTrigger = DailyTriggerCheck.IsChecked == true,
DailyTriggerTime = time,
RunWithHighestPrivileges = HighestPrivilegesCheck.IsChecked == true,
- Hidden = HiddenCheck.IsChecked == true
+ Hidden = HiddenCheck.IsChecked == true,
};
}
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml
index a19971f..365f6aa 100644
--- a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml
+++ b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml
@@ -1,289 +1,308 @@
<UserControl
- d:DesignHeight="700"
- d:DesignWidth="760"
- mc:Ignorable="d"
- x:Class="optimizerDuck.UI.Dialogs.ScheduledTaskDetailsDialog"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
- <ScrollViewer VerticalScrollBarVisibility="Auto">
- <StackPanel MinWidth="620" x:Name="RootPanel">
- <Border
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- BorderBrush="{DynamicResource CardBorderBrush}"
- BorderThickness="1"
- CornerRadius="8"
- Margin="0,0,0,12"
- Padding="16,12">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
+ d:DesignHeight="700"
+ d:DesignWidth="760"
+ mc:Ignorable="d"
+ x:Class="optimizerDuck.UI.Dialogs.ScheduledTaskDetailsDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <ScrollViewer VerticalScrollBarVisibility="Auto">
+ <StackPanel MinWidth="620" x:Name="RootPanel">
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ BorderBrush="{DynamicResource CardBorderBrush}"
+ BorderThickness="1"
+ CornerRadius="8"
+ Margin="0,0,0,12"
+ Padding="16,12"
+ >
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
- <Image
- Grid.Column="0"
- Height="40"
- Margin="0,0,12,0"
- Stretch="UniformToFill"
- VerticalAlignment="Center"
- Width="40"
- x:Name="TaskLogoImage" />
+ <Image
+ Grid.Column="0"
+ Height="40"
+ Margin="0,0,12,0"
+ Stretch="UniformToFill"
+ VerticalAlignment="Center"
+ Width="40"
+ x:Name="TaskLogoImage"
+ />
- <StackPanel Grid.Column="1" VerticalAlignment="Center">
- <DockPanel LastChildFill="False">
- <ui:TextBlock
- FontTypography="BodyStrong"
- Text=""
- TextWrapping="Wrap"
- x:Name="TaskNameText" />
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="8,0,0,0"
- Padding="6,1"
- VerticalAlignment="Center">
- <ui:TextBlock
- Appearance="Tertiary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Header.Title}"
- VerticalAlignment="Center" />
- </Border>
- <Border
- CornerRadius="4"
- Margin="8,0,0,0"
- Padding="6,1"
- VerticalAlignment="Center"
- x:Name="StateBorder">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- FontSize="10"
- Margin="0,0,4,0"
- Symbol="Circle24"
- x:Name="StateIcon" />
- <ui:TextBlock
- FontTypography="Caption"
- Foreground="{Binding ElementName=StateIcon, Path=Foreground}"
- Text=""
- VerticalAlignment="Center"
- x:Name="StateText" />
- </StackPanel>
- </Border>
- </DockPanel>
+ <StackPanel Grid.Column="1" VerticalAlignment="Center">
+ <DockPanel LastChildFill="False">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text=""
+ TextWrapping="Wrap"
+ x:Name="TaskNameText"
+ />
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="8,0,0,0"
+ Padding="6,1"
+ VerticalAlignment="Center"
+ >
+ <ui:TextBlock
+ Appearance="Tertiary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Header.Title}"
+ VerticalAlignment="Center"
+ />
+ </Border>
+ <Border
+ CornerRadius="4"
+ Margin="8,0,0,0"
+ Padding="6,1"
+ VerticalAlignment="Center"
+ x:Name="StateBorder"
+ >
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ FontSize="10"
+ Margin="0,0,4,0"
+ Symbol="Circle24"
+ x:Name="StateIcon"
+ />
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{Binding ElementName=StateIcon, Path=Foreground}"
+ Text=""
+ VerticalAlignment="Center"
+ x:Name="StateText"
+ />
+ </StackPanel>
+ </Border>
+ </DockPanel>
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Margin="0,4,0,0"
- Text=""
- TextWrapping="Wrap"
- x:Name="DescriptionText" />
- <ui:TextBlock
- Appearance="Disabled"
- FontTypography="Caption"
- Margin="0,2,0,0"
- Text=""
- TextTrimming="CharacterEllipsis"
- x:Name="PathText" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Margin="0,4,0,0"
+ Text=""
+ TextWrapping="Wrap"
+ x:Name="DescriptionText"
+ />
+ <ui:TextBlock
+ Appearance="Disabled"
+ FontTypography="Caption"
+ Margin="0,2,0,0"
+ Text=""
+ TextTrimming="CharacterEllipsis"
+ x:Name="PathText"
+ />
- <ItemsControl Margin="0,6,0,0" x:Name="TriggerBadgesItems">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="0,0,4,2"
- Padding="6,2">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Margin="0,0,4,0"
- Symbol="Timer24" />
- <ui:TextBlock
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{Binding}"
- VerticalAlignment="Center" />
- </StackPanel>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
+ <ItemsControl Margin="0,6,0,0" x:Name="TriggerBadgesItems">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel Orientation="Horizontal" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,2"
+ Padding="6,2"
+ >
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,4,0"
+ Symbol="Timer24"
+ />
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Text="{Binding}"
+ VerticalAlignment="Center"
+ />
</StackPanel>
- </Grid>
- </Border>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+ </Grid>
+ </Border>
- <Border
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- BorderBrush="{DynamicResource CardBorderBrush}"
- BorderThickness="1"
- CornerRadius="8"
- Margin="0,0,0,12"
- Padding="0">
- <StackPanel>
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
- FontSize="14"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Margin="0,0,10,0"
- Symbol="Person24"
- VerticalAlignment="Top" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Details.Author}" />
- <ui:TextBlock
- FontTypography="Body"
- Margin="0,2,0,0"
- Text=""
- x:Name="AuthorText" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ BorderBrush="{DynamicResource CardBorderBrush}"
+ BorderThickness="1"
+ CornerRadius="8"
+ Margin="0,0,0,12"
+ Padding="0"
+ >
+ <StackPanel>
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,10,0"
+ Symbol="Person24"
+ VerticalAlignment="Top"
+ />
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.Author}"
+ />
+ <ui:TextBlock FontTypography="Body" Margin="0,2,0,0" Text="" x:Name="AuthorText" />
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
- FontSize="14"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Margin="0,0,10,0"
- Symbol="Timer24"
- VerticalAlignment="Top" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Details.Triggers}" />
- <ui:TextBlock
- FontTypography="Body"
- Margin="0,2,0,0"
- Text=""
- TextWrapping="Wrap"
- x:Name="TriggersText" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,10,0"
+ Symbol="Timer24"
+ VerticalAlignment="Top"
+ />
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.Triggers}"
+ />
+ <ui:TextBlock
+ FontTypography="Body"
+ Margin="0,2,0,0"
+ Text=""
+ TextWrapping="Wrap"
+ x:Name="TriggersText"
+ />
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
- FontSize="14"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Margin="0,0,10,0"
- Symbol="Play24"
- VerticalAlignment="Top" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Details.Action}" />
- <ui:TextBlock
- FontFamily="Consolas"
- FontTypography="Body"
- Margin="0,2,0,0"
- Text=""
- TextWrapping="Wrap"
- x:Name="ActionText" />
- </StackPanel>
- </Grid>
- </StackPanel>
- </Border>
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,10,0"
+ Symbol="Play24"
+ VerticalAlignment="Top"
+ />
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.Action}"
+ />
+ <ui:TextBlock
+ FontFamily="Consolas"
+ FontTypography="Body"
+ Margin="0,2,0,0"
+ Text=""
+ TextWrapping="Wrap"
+ x:Name="ActionText"
+ />
+ </StackPanel>
+ </Grid>
+ </StackPanel>
+ </Border>
- <Border
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- BorderBrush="{DynamicResource CardBorderBrush}"
- BorderThickness="1"
- CornerRadius="8"
- Padding="0">
- <StackPanel>
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
- FontSize="14"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Margin="0,0,10,0"
- Symbol="History24"
- VerticalAlignment="Top" />
- <StackPanel Grid.Column="1" Margin="0,0,16,0">
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Details.LastRun}" />
- <ui:TextBlock
- FontTypography="Body"
- Margin="0,2,0,0"
- Text=""
- x:Name="LastRunText" />
- </StackPanel>
- <ui:SymbolIcon
- FontSize="14"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Grid.Column="2"
- Margin="0,0,10,0"
- Symbol="CalendarArrowRight24"
- VerticalAlignment="Top" />
- <StackPanel Grid.Column="3">
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Details.NextRun}" />
- <ui:TextBlock
- FontTypography="Body"
- Margin="0,2,0,0"
- Text=""
- x:Name="NextRunText" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
- FontSize="14"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Margin="0,0,10,0"
- Symbol="CheckmarkCircle24"
- VerticalAlignment="Top" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Details.LastResult}" />
- <ui:TextBlock
- FontTypography="Body"
- Margin="0,2,0,0"
- Text=""
- x:Name="LastResultText" />
- </StackPanel>
- </Grid>
- </StackPanel>
- </Border>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ BorderBrush="{DynamicResource CardBorderBrush}"
+ BorderThickness="1"
+ CornerRadius="8"
+ Padding="0"
+ >
+ <StackPanel>
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,10,0"
+ Symbol="History24"
+ VerticalAlignment="Top"
+ />
+ <StackPanel Grid.Column="1" Margin="0,0,16,0">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.LastRun}"
+ />
+ <ui:TextBlock FontTypography="Body" Margin="0,2,0,0" Text="" x:Name="LastRunText" />
+ </StackPanel>
+ <ui:SymbolIcon
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Grid.Column="2"
+ Margin="0,0,10,0"
+ Symbol="CalendarArrowRight24"
+ VerticalAlignment="Top"
+ />
+ <StackPanel Grid.Column="3">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.NextRun}"
+ />
+ <ui:TextBlock FontTypography="Body" Margin="0,2,0,0" Text="" x:Name="NextRunText" />
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,10,0"
+ Symbol="CheckmarkCircle24"
+ VerticalAlignment="Top"
+ />
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.LastResult}"
+ />
+ <ui:TextBlock
+ FontTypography="Body"
+ Margin="0,2,0,0"
+ Text=""
+ x:Name="LastResultText"
+ />
+ </StackPanel>
+ </Grid>
</StackPanel>
- </ScrollViewer>
+ </Border>
+ </StackPanel>
+ </ScrollViewer>
</UserControl>
diff --git a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml.cs b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml.cs
index 136f5e7..1a3fe25 100644
--- a/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml.cs
+++ b/optimizerDuck/UI/Dialogs/ScheduledTaskDetailsDialog.xaml.cs
@@ -20,7 +20,8 @@ public partial class ScheduledTaskDetailsDialog : UserControl
set
{
_taskModel = value;
- if (value == null) return;
+ if (value == null)
+ return;
TaskLogoImage.Source = value.LogoImage;
TaskNameText.Text = value.Name;
@@ -28,8 +29,12 @@ public partial class ScheduledTaskDetailsDialog : UserControl
DescriptionText.Text = value.Description ?? "—";
AuthorText.Text = value.Author ?? "—";
StateText.Text = value.State;
- TriggersText.Text = string.IsNullOrWhiteSpace(value.TriggerSummary) ? "—" : value.TriggerSummary;
- ActionText.Text = string.IsNullOrWhiteSpace(value.ActionSummary) ? "—" : value.ActionSummary;
+ TriggersText.Text = string.IsNullOrWhiteSpace(value.TriggerSummary)
+ ? "—"
+ : value.TriggerSummary;
+ ActionText.Text = string.IsNullOrWhiteSpace(value.ActionSummary)
+ ? "—"
+ : value.ActionSummary;
LastRunText.Text = value.LastRunTime?.ToString("g") ?? "—";
NextRunText.Text = value.NextRunTime?.ToString("g") ?? "—";
LastResultText.Text = value.LastRunResult?.ToString() ?? "—";
@@ -40,7 +45,7 @@ public partial class ScheduledTaskDetailsDialog : UserControl
"Ready" => "SystemFillColorSuccessBrush",
"Running" => "AccentButtonBackground",
"Disabled" => "SystemFillColorCautionBrush",
- _ => "CardBackgroundFillColorSecondaryBrush"
+ _ => "CardBackgroundFillColorSecondaryBrush",
};
var iconSymbol = value.State switch
@@ -48,7 +53,7 @@ public partial class ScheduledTaskDetailsDialog : UserControl
"Ready" => SymbolRegular.CheckmarkCircle24,
"Running" => SymbolRegular.Play24,
"Disabled" => SymbolRegular.Dismiss24,
- _ => SymbolRegular.Circle24
+ _ => SymbolRegular.Circle24,
};
var iconBrushKey = value.State switch
@@ -56,7 +61,7 @@ public partial class ScheduledTaskDetailsDialog : UserControl
"Ready" => "TextFillColorInverseBrush",
"Running" => "TextFillColorInverseBrush",
"Disabled" => "TextFillColorInverseBrush",
- _ => "TextFillColorPrimaryBrush"
+ _ => "TextFillColorPrimaryBrush",
};
if (TryFindResource(backgroundBrushKey) is Brush backgroundBrush)
diff --git a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml
index a7c72a6..366be62 100644
--- a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml
+++ b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml
@@ -1,259 +1,288 @@
<UserControl
- d:DesignHeight="520"
- d:DesignWidth="620"
- mc:Ignorable="d"
- x:Class="optimizerDuck.UI.Dialogs.StartupTaskDetailsPanel"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
- <ScrollViewer VerticalScrollBarVisibility="Auto">
- <StackPanel MinWidth="540">
- <Border
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- BorderBrush="{DynamicResource CardBorderBrush}"
- BorderThickness="1"
- CornerRadius="8"
- Margin="0,0,0,12"
- Padding="16,12">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
+ d:DesignHeight="520"
+ d:DesignWidth="620"
+ mc:Ignorable="d"
+ x:Class="optimizerDuck.UI.Dialogs.StartupTaskDetailsPanel"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <ScrollViewer VerticalScrollBarVisibility="Auto">
+ <StackPanel MinWidth="540">
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ BorderBrush="{DynamicResource CardBorderBrush}"
+ BorderThickness="1"
+ CornerRadius="8"
+ Margin="0,0,0,12"
+ Padding="16,12"
+ >
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
- <Image
- Grid.Column="0"
- Height="40"
- Margin="0,0,12,0"
- Source="{x:Null}"
- Stretch="UniformToFill"
- VerticalAlignment="Center"
- Width="40"
- x:Name="LogoImageControl" />
+ <Image
+ Grid.Column="0"
+ Height="40"
+ Margin="0,0,12,0"
+ Source="{x:Null}"
+ Stretch="UniformToFill"
+ VerticalAlignment="Center"
+ Width="40"
+ x:Name="LogoImageControl"
+ />
- <StackPanel Grid.Column="1" VerticalAlignment="Center">
- <DockPanel LastChildFill="False">
- <ui:TextBlock
- FontTypography="BodyStrong"
- Text="{Binding Text, ElementName=NameText}"
- TextWrapping="Wrap" />
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="8,0,0,0"
- Padding="6,1"
- VerticalAlignment="Center"
- x:Name="TaskKindBadge">
- <ui:TextBlock
- Appearance="Tertiary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Header.Title}"
- VerticalAlignment="Center" />
- </Border>
- <Border
- CornerRadius="4"
- Margin="8,0,0,0"
- Padding="6,1"
- VerticalAlignment="Center"
- x:Name="TaskStateBadge">
- <ui:TextBlock
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text=""
- VerticalAlignment="Center"
- x:Name="TaskStateText" />
- </Border>
- </DockPanel>
+ <StackPanel Grid.Column="1" VerticalAlignment="Center">
+ <DockPanel LastChildFill="False">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{Binding Text, ElementName=NameText}"
+ TextWrapping="Wrap"
+ />
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="8,0,0,0"
+ Padding="6,1"
+ VerticalAlignment="Center"
+ x:Name="TaskKindBadge"
+ >
+ <ui:TextBlock
+ Appearance="Tertiary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Header.Title}"
+ VerticalAlignment="Center"
+ />
+ </Border>
+ <Border
+ CornerRadius="4"
+ Margin="8,0,0,0"
+ Padding="6,1"
+ VerticalAlignment="Center"
+ x:Name="TaskStateBadge"
+ >
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Text=""
+ VerticalAlignment="Center"
+ x:Name="TaskStateText"
+ />
+ </Border>
+ </DockPanel>
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Margin="0,4,0,0"
- Text="{Binding Text, ElementName=DescriptionText}"
- TextTrimming="CharacterEllipsis"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Appearance="Disabled"
- FontTypography="Caption"
- Margin="0,2,0,0"
- Text="{Binding Text, ElementName=PathText}"
- TextTrimming="CharacterEllipsis" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Margin="0,4,0,0"
+ Text="{Binding Text, ElementName=DescriptionText}"
+ TextTrimming="CharacterEllipsis"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Appearance="Disabled"
+ FontTypography="Caption"
+ Margin="0,2,0,0"
+ Text="{Binding Text, ElementName=PathText}"
+ TextTrimming="CharacterEllipsis"
+ />
- <ItemsControl Margin="0,6,0,0" x:Name="TriggerBadgesItems">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="0,0,4,2"
- Padding="6,2">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- FontSize="14"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Margin="0,0,4,0"
- Symbol="Timer24" />
- <ui:TextBlock
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{Binding}"
- VerticalAlignment="Center" />
- </StackPanel>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
+ <ItemsControl Margin="0,6,0,0" x:Name="TriggerBadgesItems">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel Orientation="Horizontal" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,2"
+ Padding="6,2"
+ >
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,4,0"
+ Symbol="Timer24"
+ />
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Text="{Binding}"
+ VerticalAlignment="Center"
+ />
</StackPanel>
- </Grid>
- </Border>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+ </Grid>
+ </Border>
- <Border
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- BorderBrush="{DynamicResource CardBorderBrush}"
- BorderThickness="1"
- CornerRadius="8"
- Padding="0">
- <StackPanel>
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
- FontSize="14"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Margin="0,0,10,0"
- Symbol="AppGeneric24"
- VerticalAlignment="Top" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Details.Name}" />
- <ui:TextBlock
- FontTypography="Body"
- Margin="0,2,0,0"
- Text=""
- TextWrapping="Wrap"
- x:Name="NameText" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ BorderBrush="{DynamicResource CardBorderBrush}"
+ BorderThickness="1"
+ CornerRadius="8"
+ Padding="0"
+ >
+ <StackPanel>
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,10,0"
+ Symbol="AppGeneric24"
+ VerticalAlignment="Top"
+ />
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.Name}"
+ />
+ <ui:TextBlock
+ FontTypography="Body"
+ Margin="0,2,0,0"
+ Text=""
+ TextWrapping="Wrap"
+ x:Name="NameText"
+ />
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
- FontSize="14"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Margin="0,0,10,0"
- Symbol="TextDescription24"
- VerticalAlignment="Top" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Details.Description}" />
- <ui:TextBlock
- FontTypography="Body"
- Margin="0,2,0,0"
- Text=""
- TextWrapping="Wrap"
- x:Name="DescriptionText" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,10,0"
+ Symbol="TextDescription24"
+ VerticalAlignment="Top"
+ />
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.Description}"
+ />
+ <ui:TextBlock
+ FontTypography="Body"
+ Margin="0,2,0,0"
+ Text=""
+ TextWrapping="Wrap"
+ x:Name="DescriptionText"
+ />
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
- FontSize="14"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Margin="0,0,10,0"
- Symbol="Folder24"
- VerticalAlignment="Top" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Details.Path}" />
- <ui:TextBlock
- FontFamily="Consolas"
- FontTypography="Body"
- Margin="0,2,0,0"
- Text=""
- TextWrapping="Wrap"
- x:Name="PathText" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,10,0"
+ Symbol="Folder24"
+ VerticalAlignment="Top"
+ />
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.Path}"
+ />
+ <ui:TextBlock
+ FontFamily="Consolas"
+ FontTypography="Body"
+ Margin="0,2,0,0"
+ Text=""
+ TextWrapping="Wrap"
+ x:Name="PathText"
+ />
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
- FontSize="14"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Margin="0,0,10,0"
- Symbol="Timer24"
- VerticalAlignment="Top" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Details.Triggers}" />
- <ui:TextBlock
- FontTypography="Body"
- Margin="0,2,0,0"
- Text=""
- TextWrapping="Wrap"
- x:Name="TriggersText" />
- </StackPanel>
- </Grid>
- <Separator Margin="14,0" />
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,10,0"
+ Symbol="Timer24"
+ VerticalAlignment="Top"
+ />
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.Triggers}"
+ />
+ <ui:TextBlock
+ FontTypography="Body"
+ Margin="0,2,0,0"
+ Text=""
+ TextWrapping="Wrap"
+ x:Name="TriggersText"
+ />
+ </StackPanel>
+ </Grid>
+ <Separator Margin="14,0" />
- <Grid Margin="14,12">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ui:SymbolIcon
- FontSize="14"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Margin="0,0,10,0"
- Symbol="Play24"
- VerticalAlignment="Top" />
- <StackPanel Grid.Column="1">
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Details.Action}" />
- <ui:TextBlock
- FontFamily="Consolas"
- FontTypography="Body"
- Margin="0,2,0,0"
- Text=""
- TextWrapping="Wrap"
- x:Name="ActionText" />
- </StackPanel>
- </Grid>
- </StackPanel>
- </Border>
+ <Grid Margin="14,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ui:SymbolIcon
+ FontSize="14"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,10,0"
+ Symbol="Play24"
+ VerticalAlignment="Top"
+ />
+ <StackPanel Grid.Column="1">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Details.Action}"
+ />
+ <ui:TextBlock
+ FontFamily="Consolas"
+ FontTypography="Body"
+ Margin="0,2,0,0"
+ Text=""
+ TextWrapping="Wrap"
+ x:Name="ActionText"
+ />
+ </StackPanel>
+ </Grid>
</StackPanel>
- </ScrollViewer>
+ </Border>
+ </StackPanel>
+ </ScrollViewer>
</UserControl>
diff --git a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml.cs b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml.cs
index 6e275d0..e65ab11 100644
--- a/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml.cs
+++ b/optimizerDuck/UI/Dialogs/StartupTaskDetailsPanel.xaml.cs
@@ -19,8 +19,12 @@ public partial class StartupTaskDetailsPanel : UserControl
LogoImageControl.Source = task.LogoImage;
TriggerBadgesItems.ItemsSource = task.TriggerTypes;
- TaskStateText.Text = task.IsEnabled ? Translations.Common_Toggle_On : Translations.Common_Toggle_Off;
- var brushKey = task.IsEnabled ? "SystemFillColorSuccessBrush" : "SystemFillColorCriticalBrush";
+ TaskStateText.Text = task.IsEnabled
+ ? Translations.Common_Toggle_On
+ : Translations.Common_Toggle_Off;
+ var brushKey = task.IsEnabled
+ ? "SystemFillColorSuccessBrush"
+ : "SystemFillColorCriticalBrush";
if (TryFindResource(brushKey) is Brush brush)
TaskStateBadge.Background = brush;
}
diff --git a/optimizerDuck/UI/Pages/BloatwarePage.xaml b/optimizerDuck/UI/Pages/BloatwarePage.xaml
index a9b1d04..42384bd 100644
--- a/optimizerDuck/UI/Pages/BloatwarePage.xaml
+++ b/optimizerDuck/UI/Pages/BloatwarePage.xaml
@@ -1,427 +1,461 @@
<Page
- x:Class="optimizerDuck.UI.Pages.BloatwarePage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:bloatware1="clr-namespace:optimizerDuck.Domain.Optimizations.Models.Bloatware"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:local="clr-namespace:optimizerDuck.UI.Pages"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- Title="BloatwarePage"
- Margin="0,32,0,0"
- d:DataContext="{d:DesignInstance local:BloatwarePage}"
- d:DesignHeight="1200"
- d:DesignWidth="800"
- ui:Design.Background="Black"
- ui:Design.Foreground="White"
- Foreground="{DynamicResource TextFillColorPrimaryBrush}"
- ScrollViewer.CanContentScroll="False"
- mc:Ignorable="d">
- <Page.Resources>
- <converters:GreaterThanZeroToVisibilityConverter x:Key="GreaterThanZeroToVisibilityConverter" />
- <converters:ZeroToVisibilityConverter x:Key="ZeroToVisibilityConverter" />
- <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
- </Page.Resources>
+ x:Class="optimizerDuck.UI.Pages.BloatwarePage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:bloatware1="clr-namespace:optimizerDuck.Domain.Optimizations.Models.Bloatware"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:local="clr-namespace:optimizerDuck.UI.Pages"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ Title="BloatwarePage"
+ Margin="0,32,0,0"
+ d:DataContext="{d:DesignInstance local:BloatwarePage}"
+ d:DesignHeight="1200"
+ d:DesignWidth="800"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ ScrollViewer.CanContentScroll="False"
+ mc:Ignorable="d"
+>
+ <Page.Resources>
+ <converters:GreaterThanZeroToVisibilityConverter x:Key="GreaterThanZeroToVisibilityConverter" />
+ <converters:ZeroToVisibilityConverter x:Key="ZeroToVisibilityConverter" />
+ <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
+ </Page.Resources>
- <Grid RowDefinitions="Auto *">
- <StackPanel Margin="0,0,0,20">
- <ui:TextBlock
- FontTypography="Title"
- Text="{ext:Loc Bloatware.Header.Title}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Margin="0,4,0,0"
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc Bloatware.Header.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
+ <Grid RowDefinitions="Auto *">
+ <StackPanel Margin="0,0,0,20">
+ <ui:TextBlock
+ FontTypography="Title"
+ Text="{ext:Loc Bloatware.Header.Title}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc Bloatware.Header.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
- <!-- Empty (truly no packages installed) -->
- <Border Grid.Row="1">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Visibility" Value="Collapsed" />
- <Style.Triggers>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding ViewModel.HasData}" Value="False" />
- <Condition Binding="{Binding ViewModel.IsLoading}" Value="False" />
- </MultiDataTrigger.Conditions>
- <Setter Property="Visibility" Value="Visible" />
- </MultiDataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
+ <!-- Empty (truly no packages installed) -->
+ <Border Grid.Row="1">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed" />
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding ViewModel.HasData}" Value="False" />
+ <Condition Binding="{Binding ViewModel.IsLoading}" Value="False" />
+ </MultiDataTrigger.Conditions>
+ <Setter Property="Visibility" Value="Visible" />
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:SymbolIcon
- Margin="0,0,0,15"
- HorizontalAlignment="Center"
- FontSize="46"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Symbol="DeleteOff24" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="Subtitle"
- Text="{ext:Loc Bloatware.Empty.Title}" />
- <ui:TextBlock
- Margin="0,0,0,10"
- HorizontalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc Bloatware.Empty.Description}" />
- <ui:Button
- HorizontalAlignment="Center"
- Appearance="Primary"
- Command="{Binding ViewModel.RefreshCommand}"
- Content="{ext:Loc Bloatware.Menu.Refresh}"
- Icon="{ui:SymbolIcon ArrowClockwise24,
- FontSize=18}" />
- </StackPanel>
- </Border>
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+ <ui:SymbolIcon
+ Margin="0,0,0,15"
+ HorizontalAlignment="Center"
+ FontSize="46"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Symbol="DeleteOff24"
+ />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ FontTypography="Subtitle"
+ Text="{ext:Loc Bloatware.Empty.Title}"
+ />
+ <ui:TextBlock
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc Bloatware.Empty.Description}"
+ />
+ <ui:Button
+ HorizontalAlignment="Center"
+ Appearance="Primary"
+ Command="{Binding ViewModel.RefreshCommand}"
+ Content="{ext:Loc Bloatware.Menu.Refresh}"
+ Icon="{ui:SymbolIcon ArrowClockwise24,
+ FontSize=18}"
+ />
+ </StackPanel>
+ </Border>
- <!-- Loading -->
- <Border Grid.Row="1" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Width="48"
- Height="48"
- Margin="0,0,0,16"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsIndeterminate="True" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc Bloatware.Loading}" />
- <ui:TextBlock
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc Bloatware.Loading.Hint}" />
- </StackPanel>
- </Border>
+ <!-- Loading -->
+ <Border
+ Grid.Row="1"
+ Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+ <ui:ProgressRing
+ Width="48"
+ Height="48"
+ Margin="0,0,0,16"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsIndeterminate="True"
+ />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Bloatware.Loading}"
+ />
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc Bloatware.Loading.Hint}"
+ />
+ </StackPanel>
+ </Border>
- <Border
- Grid.Row="1"
- CornerRadius="6"
- Visibility="{Binding ViewModel.HasData, Converter={StaticResource BooleanToVisibilityConverter}}">
- <Grid RowDefinitions="Auto,Auto,*">
- <!-- Search / Filter / Sort toolbar -->
- <WrapPanel
- Grid.Row="0"
- Margin="0,0,0,5"
- Orientation="Horizontal">
+ <Border
+ Grid.Row="1"
+ CornerRadius="6"
+ Visibility="{Binding ViewModel.HasData, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <Grid RowDefinitions="Auto,Auto,*">
+ <!-- Search / Filter / Sort toolbar -->
+ <WrapPanel Grid.Row="0" Margin="0,0,0,5" Orientation="Horizontal">
+ <!-- Search -->
+ <ui:TextBox
+ MinWidth="200"
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ Icon="{ui:SymbolIcon Search24}"
+ PlaceholderText="{ext:Loc Common.Search.Placeholder}"
+ Text="{Binding ViewModel.SearchText, UpdateSourceTrigger=PropertyChanged}"
+ />
- <!-- Search -->
- <ui:TextBox
- MinWidth="200"
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- Icon="{ui:SymbolIcon Search24}"
- PlaceholderText="{ext:Loc Common.Search.Placeholder}"
- Text="{Binding ViewModel.SearchText, UpdateSourceTrigger=PropertyChanged}" />
-
- <!-- Filter by Risk -->
- <ComboBox
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- SelectedIndex="{Binding ViewModel.SelectedRiskFilterIndex}"
- ToolTip="{ext:Loc Common.Filter}"
- ToolTipService.BetweenShowDelay="160"
- ToolTipService.Placement="Top">
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="Filter24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.Filter.All}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Foreground="{DynamicResource SystemFillColorSuccessBrush}"
- Symbol="ShieldCheckmark24" />
- <TextBlock Grid.Column="1" Text="{ext:Loc Optimizer.UI.Risk.Safe}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Foreground="{DynamicResource SystemFillColorCautionBrush}"
- Symbol="Warning24" />
- <TextBlock Grid.Column="1" Text="{ext:Loc Optimizer.UI.Risk.Moderate}" />
- </Grid>
- </ComboBoxItem>
- </ComboBox>
- <!-- Sort By -->
- <ComboBox
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- SelectedIndex="{Binding ViewModel.SelectedSortByIndex}"
- ToolTip="{ext:Loc Common.SortBy}"
- ToolTipService.BetweenShowDelay="160"
- ToolTipService.Placement="Top">
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="TextSortAscending24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Name}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="Certificate24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Publisher}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="Shield24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Risk}" />
- </Grid>
- </ComboBoxItem>
- </ComboBox>
- </WrapPanel>
+ <!-- Filter by Risk -->
+ <ComboBox
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ SelectedIndex="{Binding ViewModel.SelectedRiskFilterIndex}"
+ ToolTip="{ext:Loc Common.Filter}"
+ ToolTipService.BetweenShowDelay="160"
+ ToolTipService.Placement="Top"
+ >
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,6,0" HorizontalAlignment="Left" Symbol="Filter24" />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.Filter.All}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ HorizontalAlignment="Left"
+ Foreground="{DynamicResource SystemFillColorSuccessBrush}"
+ Symbol="ShieldCheckmark24"
+ />
+ <TextBlock Grid.Column="1" Text="{ext:Loc Optimizer.UI.Risk.Safe}" />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ HorizontalAlignment="Left"
+ Foreground="{DynamicResource SystemFillColorCautionBrush}"
+ Symbol="Warning24"
+ />
+ <TextBlock Grid.Column="1" Text="{ext:Loc Optimizer.UI.Risk.Moderate}" />
+ </Grid>
+ </ComboBoxItem>
+ </ComboBox>
+ <!-- Sort By -->
+ <ComboBox
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ SelectedIndex="{Binding ViewModel.SelectedSortByIndex}"
+ ToolTip="{ext:Loc Common.SortBy}"
+ ToolTipService.BetweenShowDelay="160"
+ ToolTipService.Placement="Top"
+ >
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ HorizontalAlignment="Left"
+ Symbol="TextSortAscending24"
+ />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Name}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,6,0" HorizontalAlignment="Left" Symbol="Certificate24" />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Publisher}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,6,0" HorizontalAlignment="Left" Symbol="Shield24" />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Risk}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ </ComboBox>
+ </WrapPanel>
- <!-- Action buttons -->
- <StackPanel
- Grid.Row="1"
- Margin="0,0,0,8"
- Orientation="Horizontal">
- <ui:Button
- Appearance="Danger"
- Command="{Binding ViewModel.RemoveSelectedCommand}"
- Content="{ext:Loc Bloatware.Menu.Remove,
+ <!-- Action buttons -->
+ <StackPanel Grid.Row="1" Margin="0,0,0,8" Orientation="Horizontal">
+ <ui:Button
+ Appearance="Danger"
+ Command="{Binding ViewModel.RemoveSelectedCommand}"
+ Content="{ext:Loc Bloatware.Menu.Remove,
{Binding ViewModel.SelectedCount}}"
- Icon="{ui:SymbolIcon Delete24,
- FontSize=18}" />
-
- <Separator Margin="3,0,3,0" Visibility="{Binding ViewModel.HasSafePackages, Converter={StaticResource BooleanToVisibilityConverter}}" />
+ Icon="{ui:SymbolIcon Delete24,
+ FontSize=18}"
+ />
- <ui:Button Command="{Binding ViewModel.SelectAllSafeCommand}" Visibility="{Binding ViewModel.HasSafePackages, Converter={StaticResource BooleanToVisibilityConverter}}">
- <ui:Button.Style>
- <Style BasedOn="{StaticResource {x:Type ui:Button}}" TargetType="ui:Button">
- <Setter Property="Appearance" Value="Success" />
- <Setter Property="Content" Value="{ext:Loc Bloatware.Menu.SelectAllSafe}" />
- <Setter Property="Icon">
- <Setter.Value>
- <ui:SymbolIcon FontSize="18" Symbol="ShieldCheckmark24" />
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding ViewModel.IsAllSafeSelected}" Value="True">
- <Setter Property="Appearance" Value="Danger" />
- <Setter Property="Content" Value="{ext:Loc Bloatware.Menu.DeselectAllSafe}" />
- <Setter Property="Icon">
- <Setter.Value>
- <ui:SymbolIcon FontSize="18" Symbol="CheckboxUnchecked24" />
- </Setter.Value>
- </Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ui:Button.Style>
- </ui:Button>
+ <Separator
+ Margin="3,0,3,0"
+ Visibility="{Binding ViewModel.HasSafePackages, Converter={StaticResource BooleanToVisibilityConverter}}"
+ />
- <Separator Margin="3,0,3,0" />
+ <ui:Button
+ Command="{Binding ViewModel.SelectAllSafeCommand}"
+ Visibility="{Binding ViewModel.HasSafePackages, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <ui:Button.Style>
+ <Style BasedOn="{StaticResource {x:Type ui:Button}}" TargetType="ui:Button">
+ <Setter Property="Appearance" Value="Success" />
+ <Setter Property="Content" Value="{ext:Loc Bloatware.Menu.SelectAllSafe}" />
+ <Setter Property="Icon">
+ <Setter.Value>
+ <ui:SymbolIcon FontSize="18" Symbol="ShieldCheckmark24" />
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding ViewModel.IsAllSafeSelected}" Value="True">
+ <Setter Property="Appearance" Value="Danger" />
+ <Setter Property="Content" Value="{ext:Loc Bloatware.Menu.DeselectAllSafe}" />
+ <Setter Property="Icon">
+ <Setter.Value>
+ <ui:SymbolIcon FontSize="18" Symbol="CheckboxUnchecked24" />
+ </Setter.Value>
+ </Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ui:Button.Style>
+ </ui:Button>
- <ui:Button
- Appearance="Primary"
- Command="{Binding ViewModel.RefreshCommand}"
- Content="{ext:Loc Bloatware.Menu.Refresh}"
- Icon="{ui:SymbolIcon ArrowClockwise24,
- FontSize=18}" />
- </StackPanel>
+ <Separator Margin="3,0,3,0" />
- <!-- No search results -->
- <StackPanel
- Grid.Row="2"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Visibility="{Binding ViewModel.AppxPackages.Count, Converter={StaticResource ZeroToVisibilityConverter}}">
- <ui:SymbolIcon
- Margin="0,0,0,10"
- HorizontalAlignment="Center"
- FontSize="36"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Symbol="SearchInfo24" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc Bloatware.Search.NoResults}" />
- </StackPanel>
-
- <ItemsControl
- Grid.Row="2"
- ItemsSource="{Binding ViewModel.AppxPackages}"
- Visibility="{Binding ViewModel.AppxPackages.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">
- <ItemsControl.Template>
- <ControlTemplate TargetType="ItemsControl">
- <ScrollViewer HorizontalScrollBarVisibility="Disabled">
- <ItemsPresenter />
- </ScrollViewer>
- </ControlTemplate>
- </ItemsControl.Template>
- <!-- Layout panel -->
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <VirtualizingStackPanel />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
-
- <!-- Item template -->
- <ItemsControl.ItemTemplate>
- <DataTemplate DataType="{x:Type bloatware1:AppXPackage}">
- <Border
- Margin="0,0,16,4"
- Padding="12"
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- CornerRadius="6">
+ <ui:Button
+ Appearance="Primary"
+ Command="{Binding ViewModel.RefreshCommand}"
+ Content="{ext:Loc Bloatware.Menu.Refresh}"
+ Icon="{ui:SymbolIcon ArrowClockwise24,
+ FontSize=18}"
+ />
+ </StackPanel>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
+ <!-- No search results -->
+ <StackPanel
+ Grid.Row="2"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Visibility="{Binding ViewModel.AppxPackages.Count, Converter={StaticResource ZeroToVisibilityConverter}}"
+ >
+ <ui:SymbolIcon
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ FontSize="36"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Symbol="SearchInfo24"
+ />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc Bloatware.Search.NoResults}"
+ />
+ </StackPanel>
- <!-- Checkbox -->
- <CheckBox
- Grid.Column="0"
- Margin="0,4,12,0"
- VerticalAlignment="Top"
- IsChecked="{Binding IsSelected, Mode=TwoWay}" />
+ <ItemsControl
+ Grid.Row="2"
+ ItemsSource="{Binding ViewModel.AppxPackages}"
+ Visibility="{Binding ViewModel.AppxPackages.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}"
+ >
+ <ItemsControl.Template>
+ <ControlTemplate TargetType="ItemsControl">
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled">
+ <ItemsPresenter />
+ </ScrollViewer>
+ </ControlTemplate>
+ </ItemsControl.Template>
+ <!-- Layout panel -->
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <VirtualizingStackPanel />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
- <!-- Logo Image -->
- <Image
- Grid.Column="1"
- Width="36"
- Height="36"
- Margin="0,0,12,0"
- VerticalAlignment="Top"
- Source="{Binding LogoImage}"
- Stretch="UniformToFill" />
+ <!-- Item template -->
+ <ItemsControl.ItemTemplate>
+ <DataTemplate DataType="{x:Type bloatware1:AppXPackage}">
+ <Border
+ Margin="0,0,16,4"
+ Padding="12"
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ CornerRadius="6"
+ >
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
- <!-- Content -->
- <StackPanel Grid.Column="2">
+ <!-- Checkbox -->
+ <CheckBox
+ Grid.Column="0"
+ Margin="0,4,12,0"
+ VerticalAlignment="Top"
+ IsChecked="{Binding IsSelected, Mode=TwoWay}"
+ />
- <!-- Top row -->
- <DockPanel LastChildFill="False">
+ <!-- Logo Image -->
+ <Image
+ Grid.Column="1"
+ Width="36"
+ Height="36"
+ Margin="0,0,12,0"
+ VerticalAlignment="Top"
+ Source="{Binding LogoImage}"
+ Stretch="UniformToFill"
+ />
- <!-- App Name -->
- <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />
+ <!-- Content -->
+ <StackPanel Grid.Column="2">
+ <!-- Top row -->
+ <DockPanel LastChildFill="False">
+ <!-- App Name -->
+ <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />
- <Border
- Margin="5,0,0,0"
- Padding="4,1"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="5">
- <!-- Version -->
- <ui:TextBlock
- VerticalAlignment="Center"
- Appearance="Tertiary"
- FontTypography="Body"
- Text="{Binding Version}" />
- </Border>
+ <Border
+ Margin="5,0,0,0"
+ Padding="4,1"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="5"
+ >
+ <!-- Version -->
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ Appearance="Tertiary"
+ FontTypography="Body"
+ Text="{Binding Version}"
+ />
+ </Border>
- <Border
- Margin="5,0,0,0"
- Padding="4,2"
- HorizontalAlignment="Left"
- CornerRadius="5"
- Visibility="{Binding ShouldVisibleRisk, Converter={StaticResource BooleanToVisibilityConverter}}">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding Risk}" Value="Caution">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,5,0"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Symbol="{Binding RiskVisual.Icon}" />
+ <Border
+ Margin="5,0,0,0"
+ Padding="4,2"
+ HorizontalAlignment="Left"
+ CornerRadius="5"
+ Visibility="{Binding ShouldVisibleRisk, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource SystemFillColorSuccessBrush}"
+ />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Risk}" Value="Caution">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource SystemFillColorCautionBrush}"
+ />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Margin="0,0,5,0"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Symbol="{Binding RiskVisual.Icon}"
+ />
- <ui:TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text="{Binding RiskVisual.Display}"
- TextWrapping="Wrap" />
- </StackPanel>
- </Border>
- </DockPanel>
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Text="{Binding RiskVisual.Display}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </Border>
+ </DockPanel>
- <!-- Publisher -->
- <ui:TextBlock
- Margin="0,2,0,0"
- Appearance="Disabled"
- FontTypography="Body"
- Text="{Binding Publisher}"
- TextTrimming="CharacterEllipsis" />
+ <!-- Publisher -->
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ Appearance="Disabled"
+ FontTypography="Body"
+ Text="{Binding Publisher}"
+ TextTrimming="CharacterEllipsis"
+ />
- <!-- Install location -->
- <ui:TextBlock
- Margin="0,2,0,0"
- Appearance="Disabled"
- FontTypography="Body"
- Text="{Binding InstallLocation}"
- TextTrimming="CharacterEllipsis" />
+ <!-- Install location -->
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ Appearance="Disabled"
+ FontTypography="Body"
+ Text="{Binding InstallLocation}"
+ TextTrimming="CharacterEllipsis"
+ />
- <!-- Package full name -->
- <ui:TextBlock
- Margin="0,4,0,0"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{Binding PackageFullName}"
- TextTrimming="CharacterEllipsis" />
- </StackPanel>
- </Grid>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </Grid>
- </Border>
- </Grid>
+ <!-- Package full name -->
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{Binding PackageFullName}"
+ TextTrimming="CharacterEllipsis"
+ />
+ </StackPanel>
+ </Grid>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </Grid>
+ </Border>
+ </Grid>
</Page>
diff --git a/optimizerDuck/UI/Pages/BloatwarePage.xaml.cs b/optimizerDuck/UI/Pages/BloatwarePage.xaml.cs
index 66a2ef7..e7edf64 100644
--- a/optimizerDuck/UI/Pages/BloatwarePage.xaml.cs
+++ b/optimizerDuck/UI/Pages/BloatwarePage.xaml.cs
@@ -14,4 +14,4 @@ public partial class BloatwarePage : INavigableView<BloatwareViewModel>
}
public BloatwareViewModel ViewModel { get; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Pages/DashboardPage.xaml b/optimizerDuck/UI/Pages/DashboardPage.xaml
index 89eef83..78d3463 100644
--- a/optimizerDuck/UI/Pages/DashboardPage.xaml
+++ b/optimizerDuck/UI/Pages/DashboardPage.xaml
@@ -1,524 +1,585 @@
<Page
- Foreground="{DynamicResource TextFillColorPrimaryBrush}"
- Margin="0,32,0,0"
- ScrollViewer.CanContentScroll="False"
- Title="Dashboard"
- d:DataContext="{d:DesignInstance pages:DashboardPage}"
- d:DesignHeight="650"
- d:DesignWidth="800"
- mc:Ignorable="d"
- ui:Design.Background="Black"
- ui:Design.Foreground="White"
- x:Class="optimizerDuck.UI.Pages.DashboardPage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:pages="clr-namespace:optimizerDuck.UI.Pages"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
- <Page.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
- <converters:MBToGBConverter x:Key="MBToGBConverter" />
- <converters:GreaterThanNumberToVisibilityConverter Threshold="1" x:Key="GreaterThanOneToVisibilityConverter" />
- <converters:MinusNumberConverter NumberToMinus="1" x:Key="MinusOneConverter" />
- <converters:ThemeToGitHubIconConverter x:Key="ThemeToGitHubIconConverter" />
- </Page.Resources>
-
- <Grid RowDefinitions="Auto,Auto,*">
- <!-- Loading Overlay -->
- <Grid
- Grid.RowSpan="3"
- Panel.ZIndex="1000"
- Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BoolToVisibilityConverter}}">
- <Border Background="{DynamicResource ApplicationBackgroundBrush}" Opacity="0.8" />
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Height="60"
- IsIndeterminate="True"
- Width="60" />
- <ui:TextBlock
- FontTypography="Subtitle"
- HorizontalAlignment="Center"
- Margin="0,16,0,0"
- Text="{ext:Loc Dashboard.SystemInfo.Loading}"
- TextWrapping="Wrap" />
- </StackPanel>
- </Grid>
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ Margin="0,32,0,0"
+ ScrollViewer.CanContentScroll="False"
+ Title="Dashboard"
+ d:DataContext="{d:DesignInstance pages:DashboardPage}"
+ d:DesignHeight="650"
+ d:DesignWidth="800"
+ mc:Ignorable="d"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ x:Class="optimizerDuck.UI.Pages.DashboardPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:pages="clr-namespace:optimizerDuck.UI.Pages"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <Page.Resources>
+ <converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
+ <converters:MBToGBConverter x:Key="MBToGBConverter" />
+ <converters:GreaterThanNumberToVisibilityConverter
+ Threshold="1"
+ x:Key="GreaterThanOneToVisibilityConverter"
+ />
+ <converters:MinusNumberConverter NumberToMinus="1" x:Key="MinusOneConverter" />
+ <converters:ThemeToGitHubIconConverter x:Key="ThemeToGitHubIconConverter" />
+ </Page.Resources>
+
+ <Grid RowDefinitions="Auto,Auto,*">
+ <!-- Loading Overlay -->
+ <Grid
+ Grid.RowSpan="3"
+ Panel.ZIndex="1000"
+ Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BoolToVisibilityConverter}}"
+ >
+ <Border Background="{DynamicResource ApplicationBackgroundBrush}" Opacity="0.8" />
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+ <ui:ProgressRing Height="60" IsIndeterminate="True" Width="60" />
+ <ui:TextBlock
+ FontTypography="Subtitle"
+ HorizontalAlignment="Center"
+ Margin="0,16,0,0"
+ Text="{ext:Loc Dashboard.SystemInfo.Loading}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </Grid>
- <!-- Header -->
- <StackPanel Margin="0,0,0,20">
- <ui:InfoBar
- IsOpen="{Binding ViewModel.IsUpdateInfoOpen, Mode=TwoWay}"
- Margin="0,0,0,10"
- Message="{ext:Loc Dashboard.UpdateInfoBar.Message,
+ <!-- Header -->
+ <StackPanel Margin="0,0,0,20">
+ <ui:InfoBar
+ IsOpen="{Binding ViewModel.IsUpdateInfoOpen, Mode=TwoWay}"
+ Margin="0,0,0,10"
+ Message="{ext:Loc Dashboard.UpdateInfoBar.Message,
{Binding ViewModel.LatestVersion}}"
- Severity="Warning" />
- <Grid ColumnDefinitions="*,Auto">
- <ui:TextBlock
- FontTypography="Title"
- Text="{ext:Loc Dashboard.Header.Title}"
- TextWrapping="Wrap" />
-
- <Menu Grid.Column="1">
- <ui:MenuItem Header="{ext:Loc Dashboard.Header.Menu.Header.Options}">
- <ui:MenuItem Header="{ext:Loc Dashboard.Header.Menu.Header.Run}" Icon="{ui:SymbolIcon Apps24}">
- <ui:MenuItem
- Command="{Binding ViewModel.RunCommand}"
- CommandParameter="Settings"
- Header="{ext:Loc Dashboard.Header.Menu.RunSettings}" />
- <ui:MenuItem
- Command="{Binding ViewModel.RunCommand}"
- CommandParameter="TaskManager"
- Header="{ext:Loc Dashboard.Header.Menu.RunTaskManager}" />
- <ui:MenuItem
- Command="{Binding ViewModel.RunCommand}"
- CommandParameter="ControlPanel"
- Header="{ext:Loc Dashboard.Header.Menu.RunControlPanel}" />
- </ui:MenuItem>
- <Separator />
- <ui:MenuItem
- Command="{Binding ViewModel.RefreshCommand}"
- Header="{ext:Loc Dashboard.Header.Menu.Refresh}"
- Icon="{ui:SymbolIcon ArrowClockwise24}" />
- </ui:MenuItem>
- </Menu>
- </Grid>
+ Severity="Warning"
+ />
+ <Grid ColumnDefinitions="*,Auto">
+ <ui:TextBlock
+ FontTypography="Title"
+ Text="{ext:Loc Dashboard.Header.Title}"
+ TextWrapping="Wrap"
+ />
+
+ <Menu Grid.Column="1">
+ <ui:MenuItem Header="{ext:Loc Dashboard.Header.Menu.Header.Options}">
+ <ui:MenuItem
+ Header="{ext:Loc Dashboard.Header.Menu.Header.Run}"
+ Icon="{ui:SymbolIcon Apps24}"
+ >
+ <ui:MenuItem
+ Command="{Binding ViewModel.RunCommand}"
+ CommandParameter="Settings"
+ Header="{ext:Loc Dashboard.Header.Menu.RunSettings}"
+ />
+ <ui:MenuItem
+ Command="{Binding ViewModel.RunCommand}"
+ CommandParameter="TaskManager"
+ Header="{ext:Loc Dashboard.Header.Menu.RunTaskManager}"
+ />
+ <ui:MenuItem
+ Command="{Binding ViewModel.RunCommand}"
+ CommandParameter="ControlPanel"
+ Header="{ext:Loc Dashboard.Header.Menu.RunControlPanel}"
+ />
+ </ui:MenuItem>
+ <Separator />
+ <ui:MenuItem
+ Command="{Binding ViewModel.RefreshCommand}"
+ Header="{ext:Loc Dashboard.Header.Menu.Refresh}"
+ Icon="{ui:SymbolIcon ArrowClockwise24}"
+ />
+ </ui:MenuItem>
+ </Menu>
+ </Grid>
+ </StackPanel>
+
+ <!-- Action Cards -->
+ <UniformGrid Columns="3" Grid.Row="1" Margin="0,0,0,20">
+ <ui:CardAction
+ Command="{Binding ViewModel.OpenActionCommand}"
+ CommandParameter="Discord"
+ Margin="0,0,5,0"
+ VerticalAlignment="Stretch"
+ >
+ <ui:CardAction.Icon>
+ <ui:ImageIcon
+ Height="25"
+ Source="pack://application:,,,/Resources/Images/DiscordLogo.png"
+ />
+ </ui:CardAction.Icon>
+ <StackPanel>
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Dashboard.Actions.Discord.Title}"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc Dashboard.Actions.Discord.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </ui:CardAction>
+
+ <ui:CardAction
+ Command="{Binding ViewModel.OpenActionCommand}"
+ CommandParameter="GitHub"
+ Margin="5,0,5,0"
+ VerticalAlignment="Stretch"
+ >
+ <ui:CardAction.Icon>
+ <ui:ImageIcon
+ Height="40"
+ Source="{Binding ViewModel.CurrentApplicationTheme, Converter={StaticResource ThemeToGitHubIconConverter}}"
+ />
+ </ui:CardAction.Icon>
+ <StackPanel>
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Dashboard.Actions.GitHub.Title}"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc Dashboard.Actions.GitHub.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </ui:CardAction>
+
+ <ui:CardAction
+ BorderThickness="1"
+ Command="{Binding ViewModel.OpenActionCommand}"
+ CommandParameter="Contribute"
+ Margin="5,0,0,0"
+ VerticalAlignment="Stretch"
+ >
+ <ui:CardAction.Icon>
+ <ui:SymbolIcon
+ Filled="True"
+ Foreground="{DynamicResource SystemFillColorCautionBrush}"
+ Symbol="Star24"
+ />
+ </ui:CardAction.Icon>
+
+ <StackPanel>
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Dashboard.Actions.SupportMe.Title}"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc Dashboard.Actions.SupportMe.Description}"
+ TextWrapping="Wrap"
+ />
</StackPanel>
+ </ui:CardAction>
+ </UniformGrid>
+
+ <ScrollViewer
+ Grid.Row="2"
+ HorizontalScrollBarVisibility="Disabled"
+ Padding="20,0"
+ VerticalScrollBarVisibility="Auto"
+ >
+ <StackPanel>
+ <!-- System Info Cards -->
+ <UniformGrid Columns="2" Rows="2">
+ <!-- Operating System -->
+ <ui:CardControl Icon="{ui:SymbolIcon Tv24}" Margin="0,0,5,5" VerticalAlignment="Stretch">
+ <ui:CardControl.Header>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+
+ <StackPanel Grid.Row="0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{Binding ViewModel.SystemInfo.Os.Name}"
+ />
+ <ui:TextBlock Appearance="Secondary" FontTypography="Caption">
+ <Run Text="{Binding ViewModel.SystemInfo.Os.Edition}" />
+ <Run Text="·" />
+ <Run Text="{Binding ViewModel.SystemInfo.Os.Architecture}" />
+ </ui:TextBlock>
+ </StackPanel>
- <!-- Action Cards -->
- <UniformGrid
- Columns="3"
- Grid.Row="1"
- Margin="0,0,0,20">
- <ui:CardAction
- Command="{Binding ViewModel.OpenActionCommand}"
- CommandParameter="Discord"
- Margin="0,0,5,0"
- VerticalAlignment="Stretch">
- <ui:CardAction.Icon>
- <ui:ImageIcon Height="25" Source="pack://application:,,,/Resources/Images/DiscordLogo.png" />
- </ui:CardAction.Icon>
- <StackPanel>
- <ui:TextBlock FontTypography="BodyStrong" Text="{ext:Loc Dashboard.Actions.Discord.Title}" />
+ <WrapPanel Grid.Row="1" Margin="0,8,0,0" Orientation="Horizontal">
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3"
+ >
<ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc Dashboard.Actions.Discord.Description}"
- TextWrapping="Wrap" />
+ FontTypography="Caption"
+ Text="{ext:Loc Dashboard.SystemInfo.Os.Build, {Binding ViewModel.SystemInfo.Os.BuildNumber}}"
+ />
+ </Border>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3"
+ >
+ <ui:TextBlock
+ FontTypography="Caption"
+ Text="{Binding ViewModel.SystemInfo.Os.DeviceType}"
+ />
+ </Border>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3"
+ >
+ <ui:TextBlock
+ FontTypography="Caption"
+ Text="{Binding ViewModel.SystemInfo.Os.InstallDate}"
+ />
+ </Border>
+ </WrapPanel>
+ </Grid>
+ </ui:CardControl.Header>
+ </ui:CardControl>
+
+ <!-- CPU -->
+ <ui:CardControl
+ Icon="{ui:SymbolIcon DeveloperBoard24}"
+ Margin="5,0,0,5"
+ VerticalAlignment="Stretch"
+ >
+ <ui:CardControl.Header>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+
+ <StackPanel Grid.Row="0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{Binding ViewModel.SystemInfo.Cpu.Name}"
+ TextTrimming="CharacterEllipsis"
+ />
+ <ui:TextBlock Appearance="Secondary" FontTypography="Caption">
+ <Run Text="{Binding ViewModel.SystemInfo.Cpu.Vendor}" />
+ <Run Text="·" />
+ <Run Text="{ext:Loc Dashboard.SystemInfo.Cpu.Cores, {Binding ViewModel.SystemInfo.Cpu.Cores}}" />
+ <Run Text="/" />
+ <Run Text="{ext:Loc Dashboard.SystemInfo.Cpu.Threads, {Binding ViewModel.SystemInfo.Cpu.Threads}}" />
+ </ui:TextBlock>
</StackPanel>
- </ui:CardAction>
- <ui:CardAction
- Command="{Binding ViewModel.OpenActionCommand}"
- CommandParameter="GitHub"
- Margin="5,0,5,0"
- VerticalAlignment="Stretch">
- <ui:CardAction.Icon>
- <ui:ImageIcon Height="40" Source="{Binding ViewModel.CurrentApplicationTheme, Converter={StaticResource ThemeToGitHubIconConverter}}" />
- </ui:CardAction.Icon>
- <StackPanel>
- <ui:TextBlock FontTypography="BodyStrong" Text="{ext:Loc Dashboard.Actions.GitHub.Title}" />
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc Dashboard.Actions.GitHub.Description}"
- TextWrapping="Wrap" />
+ <WrapPanel Grid.Row="1" Margin="0,8,0,0" Orientation="Horizontal">
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3"
+ >
+ <ui:TextBlock FontTypography="Caption">
+ <Run Text="{Binding ViewModel.SystemInfo.Cpu.CurrentClockMHz}" />
+ <Run Text="MHz" />
+ </ui:TextBlock>
+ </Border>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3"
+ >
+ <ui:TextBlock FontTypography="Caption">
+ <Run Text="L2:" />
+ <Run Text="{Binding ViewModel.SystemInfo.Cpu.L2CacheKB}" />
+ <Run Text="KB" />
+ </ui:TextBlock>
+ </Border>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3"
+ >
+ <ui:TextBlock FontTypography="Caption">
+ <Run Text="L3:" />
+ <Run Text="{Binding ViewModel.SystemInfo.Cpu.L3CacheKB}" />
+ <Run Text="KB" />
+ </ui:TextBlock>
+ </Border>
+ </WrapPanel>
+ </Grid>
+ </ui:CardControl.Header>
+ </ui:CardControl>
+
+ <!-- RAM -->
+ <ui:CardControl
+ Icon="{ui:SymbolIcon Memory16}"
+ Margin="0,5,5,0"
+ VerticalAlignment="Stretch"
+ >
+ <ui:CardControl.Header>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <StackPanel Grid.Row="0">
+ <ui:TextBlock FontTypography="BodyStrong">
+ <Run Text="{Binding ViewModel.RuntimeRam.TotalGB, StringFormat='{}{0:F1}'}" />
+ <Run Text="GB RAM" />
+ </ui:TextBlock>
+ <ui:TextBlock Appearance="Secondary" FontTypography="Caption">
+ <Run Text="{ext:Loc Dashboard.SystemInfo.Ram.Used, {Binding ViewModel.RuntimeRam.UsedGB, StringFormat='{}{0:F1}'}}" />
+ <Run Text="·" />
+ <Run Text="{ext:Loc Dashboard.SystemInfo.Ram.Available, {Binding ViewModel.RuntimeRam.AvailableGB, StringFormat='{}{0:F1}'}}" />
+ </ui:TextBlock>
</StackPanel>
- </ui:CardAction>
- <ui:CardAction
- BorderThickness="1"
- Command="{Binding ViewModel.OpenActionCommand}"
- CommandParameter="Contribute"
- Margin="5,0,0,0"
- VerticalAlignment="Stretch">
+ <ProgressBar
+ Grid.Row="1"
+ Height="6"
+ Margin="0,8,0,0"
+ Maximum="100"
+ Value="{Binding ViewModel.RuntimeRam.UsedPercent}"
+ />
+
+ <WrapPanel Grid.Row="2" Margin="0,8,0,0" Orientation="Horizontal">
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Padding="6,3"
+ >
+ <ui:TextBlock FontTypography="Caption">
+ <Run Text="{ext:Loc Dashboard.SystemInfo.Ram.Modules, {Binding ViewModel.RuntimeRam.Modules.Count, Mode=OneWay}}" />
+ </ui:TextBlock>
+ </Border>
+ </WrapPanel>
+ </Grid>
+ </ui:CardControl.Header>
+ </ui:CardControl>
+
+ <!-- GPU -->
+ <ui:CardControl
+ Icon="{ui:SymbolIcon NetworkAdapter16}"
+ Margin="5,5,0,0"
+ VerticalAlignment="Stretch"
+ >
+ <ui:CardControl.Header>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+
+ <StackPanel Grid.Row="0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{Binding ViewModel.SystemInfo.PrimaryGpu.Name}"
+ TextTrimming="CharacterEllipsis"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{Binding ViewModel.SystemInfo.PrimaryGpu.Vendor}"
+ />
+ </StackPanel>
- <ui:CardAction.Icon>
- <ui:SymbolIcon
- Filled="True"
- Foreground="{DynamicResource SystemFillColorCautionBrush}"
- Symbol="Star24" />
- </ui:CardAction.Icon>
+ <WrapPanel Grid.Row="1" Margin="0,8,0,0" Orientation="Horizontal">
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3"
+ >
+ <ui:TextBlock FontTypography="Caption">
+ <Run Text="{Binding ViewModel.SystemInfo.PrimaryGpu.MemoryMB, Converter={StaticResource MBToGBConverter}}" />
+ <Run Text="GB" />
+ </ui:TextBlock>
+ </Border>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3"
+ >
+ <ui:TextBlock
+ FontTypography="Caption"
+ Text="{Binding ViewModel.SystemInfo.PrimaryGpu.DriverVersion}"
+ TextTrimming="CharacterEllipsis"
+ />
+ </Border>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3"
+ Visibility="{Binding ViewModel.SystemInfo.Gpus.Count, Converter={StaticResource GreaterThanOneToVisibilityConverter}}"
+ >
+ <ui:TextBlock FontTypography="Caption">
+ <Run Text="{ext:Loc Dashboard.SystemInfo.Gpu.More, {Binding ViewModel.SystemInfo.Gpus.Count, Mode=OneWay, Converter={StaticResource MinusOneConverter}}}" />
+ </ui:TextBlock>
+ </Border>
+ </WrapPanel>
+ </Grid>
+ </ui:CardControl.Header>
+ </ui:CardControl>
+ </UniformGrid>
- <StackPanel>
- <ui:TextBlock FontTypography="BodyStrong" Text="{ext:Loc Dashboard.Actions.SupportMe.Title}" />
+ <!-- Storage Section -->
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Margin="0,20,0,8"
+ Text="{ext:Loc Dashboard.SystemInfo.Storage.Header}"
+ />
+
+ <ItemsControl ItemsSource="{Binding ViewModel.RuntimeDisk.Volumes}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <ui:CardControl Margin="0,0,0,8">
+ <ui:CardControl.Icon>
+ <ui:SymbolIcon Filled="True" Symbol="HardDrive20">
+ <ui:SymbolIcon.Style>
+ <Style TargetType="ui:SymbolIcon">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsSystemDrive}" Value="True">
+ <Setter
+ Property="Foreground"
+ Value="{DynamicResource SystemFillColorAttentionBrush}"
+ />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ui:SymbolIcon.Style>
+ </ui:SymbolIcon>
+ </ui:CardControl.Icon>
+ <ui:CardControl.Header>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <!-- Drive Letter and Label -->
+ <StackPanel Grid.Row="0" Orientation="Horizontal">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Margin="0,0,5,0"
+ Text="{Binding DriveLetter, StringFormat='({0})'}"
+ />
+
+ <ui:TextBlock
+ FontTypography="Caption"
+ Margin="0,0,5,0"
+ Text="{Binding VolumeLabel}"
+ VerticalAlignment="Center"
+ />
+
+ <Border
+ Background="{DynamicResource SystemFillColorAttentionBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,0"
+ Padding="5,2"
+ VerticalAlignment="Center"
+ Visibility="{Binding IsSystemDrive, Converter={StaticResource BoolToVisibilityConverter}}"
+ >
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="Black"
+ Text="{ext:Loc Dashboard.SystemInfo.Storage.System}"
+ />
+ </Border>
+
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,0"
+ Padding="5,2"
+ VerticalAlignment="Center"
+ >
+ <ui:TextBlock FontTypography="Caption" Text="{Binding MediaType}">
+ <ui:TextBlock.Style>
+ <Style TargetType="ui:TextBlock">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding MediaType}" Value="SSD">
+ <Setter
+ Property="Foreground"
+ Value="{DynamicResource SystemFillColorSuccessBrush}"
+ />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding MediaType}" Value="HDD">
+ <Setter
+ Property="Foreground"
+ Value="{DynamicResource SystemFillColorCautionBrush}"
+ />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ui:TextBlock.Style>
+ </ui:TextBlock>
+ </Border>
+
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Padding="5,2"
+ VerticalAlignment="Center"
+ >
+ <ui:TextBlock FontTypography="Caption" Text="{Binding DriveFormat}" />
+ </Border>
+ </StackPanel>
+
+ <!-- Model Information -->
<ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Grid.Row="1"
+ Margin="0,4,0,0"
+ Text="{Binding Model}"
+ TextTrimming="CharacterEllipsis"
+ Visibility="{Binding Model, Converter={StaticResource NullToVisibilityConverter}}"
+ />
+
+ <!-- Storage Stats -->
+ <StackPanel Grid.Row="2" Margin="0,4,0,0" Orientation="Horizontal">
+ <ui:TextBlock
Appearance="Secondary"
FontTypography="Caption"
- Text="{ext:Loc Dashboard.Actions.SupportMe.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- </ui:CardAction>
- </UniformGrid>
-
- <ScrollViewer
- Grid.Row="2"
- HorizontalScrollBarVisibility="Disabled"
- Padding="20,0"
- VerticalScrollBarVisibility="Auto">
- <StackPanel>
- <!-- System Info Cards -->
- <UniformGrid Columns="2" Rows="2">
- <!-- Operating System -->
- <ui:CardControl
- Icon="{ui:SymbolIcon Tv24}"
- Margin="0,0,5,5"
- VerticalAlignment="Stretch">
- <ui:CardControl.Header>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
-
- <StackPanel Grid.Row="0">
- <ui:TextBlock FontTypography="BodyStrong" Text="{Binding ViewModel.SystemInfo.Os.Name}" />
- <ui:TextBlock Appearance="Secondary" FontTypography="Caption">
- <Run Text="{Binding ViewModel.SystemInfo.Os.Edition}" />
- <Run Text="·" />
- <Run Text="{Binding ViewModel.SystemInfo.Os.Architecture}" />
- </ui:TextBlock>
- </StackPanel>
-
- <WrapPanel
- Grid.Row="1"
- Margin="0,8,0,0"
- Orientation="Horizontal">
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="0,0,4,4"
- Padding="6,3">
- <ui:TextBlock FontTypography="Caption" Text="{ext:Loc Dashboard.SystemInfo.Os.Build, {Binding ViewModel.SystemInfo.Os.BuildNumber}}" />
- </Border>
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="0,0,4,4"
- Padding="6,3">
- <ui:TextBlock FontTypography="Caption" Text="{Binding ViewModel.SystemInfo.Os.DeviceType}" />
- </Border>
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="0,0,4,4"
- Padding="6,3">
- <ui:TextBlock FontTypography="Caption" Text="{Binding ViewModel.SystemInfo.Os.InstallDate}" />
- </Border>
- </WrapPanel>
- </Grid>
- </ui:CardControl.Header>
- </ui:CardControl>
-
- <!-- CPU -->
- <ui:CardControl
- Icon="{ui:SymbolIcon DeveloperBoard24}"
- Margin="5,0,0,5"
- VerticalAlignment="Stretch">
- <ui:CardControl.Header>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
-
- <StackPanel Grid.Row="0">
- <ui:TextBlock
- FontTypography="BodyStrong"
- Text="{Binding ViewModel.SystemInfo.Cpu.Name}"
- TextTrimming="CharacterEllipsis" />
- <ui:TextBlock Appearance="Secondary" FontTypography="Caption">
- <Run Text="{Binding ViewModel.SystemInfo.Cpu.Vendor}" />
- <Run Text="·" />
- <Run Text="{ext:Loc Dashboard.SystemInfo.Cpu.Cores, {Binding ViewModel.SystemInfo.Cpu.Cores}}" />
- <Run Text="/" />
- <Run Text="{ext:Loc Dashboard.SystemInfo.Cpu.Threads, {Binding ViewModel.SystemInfo.Cpu.Threads}}" />
- </ui:TextBlock>
- </StackPanel>
-
- <WrapPanel
- Grid.Row="1"
- Margin="0,8,0,0"
- Orientation="Horizontal">
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="0,0,4,4"
- Padding="6,3">
- <ui:TextBlock FontTypography="Caption">
- <Run Text="{Binding ViewModel.SystemInfo.Cpu.CurrentClockMHz}" />
- <Run Text="MHz" />
- </ui:TextBlock>
- </Border>
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="0,0,4,4"
- Padding="6,3">
- <ui:TextBlock FontTypography="Caption">
- <Run Text="L2:" />
- <Run Text="{Binding ViewModel.SystemInfo.Cpu.L2CacheKB}" />
- <Run Text="KB" />
- </ui:TextBlock>
- </Border>
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="0,0,4,4"
- Padding="6,3">
- <ui:TextBlock FontTypography="Caption">
- <Run Text="L3:" />
- <Run Text="{Binding ViewModel.SystemInfo.Cpu.L3CacheKB}" />
- <Run Text="KB" />
- </ui:TextBlock>
- </Border>
- </WrapPanel>
- </Grid>
- </ui:CardControl.Header>
- </ui:CardControl>
-
- <!-- RAM -->
- <ui:CardControl
- Icon="{ui:SymbolIcon Memory16}"
- Margin="0,5,5,0"
- VerticalAlignment="Stretch">
- <ui:CardControl.Header>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
-
- <StackPanel Grid.Row="0">
- <ui:TextBlock FontTypography="BodyStrong">
- <Run Text="{Binding ViewModel.RuntimeRam.TotalGB, StringFormat='{}{0:F1}'}" />
- <Run Text="GB RAM" />
- </ui:TextBlock>
- <ui:TextBlock Appearance="Secondary" FontTypography="Caption">
- <Run Text="{ext:Loc Dashboard.SystemInfo.Ram.Used, {Binding ViewModel.RuntimeRam.UsedGB, StringFormat='{}{0:F1}'}}" />
- <Run Text="·" />
- <Run Text="{ext:Loc Dashboard.SystemInfo.Ram.Available, {Binding ViewModel.RuntimeRam.AvailableGB, StringFormat='{}{0:F1}'}}" />
- </ui:TextBlock>
- </StackPanel>
-
- <ProgressBar
- Grid.Row="1"
- Height="6"
- Margin="0,8,0,0"
- Maximum="100"
- Value="{Binding ViewModel.RuntimeRam.UsedPercent}" />
-
- <WrapPanel
- Grid.Row="2"
- Margin="0,8,0,0"
- Orientation="Horizontal">
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Padding="6,3">
- <ui:TextBlock FontTypography="Caption">
- <Run Text="{ext:Loc Dashboard.SystemInfo.Ram.Modules, {Binding ViewModel.RuntimeRam.Modules.Count, Mode=OneWay}}" />
- </ui:TextBlock>
- </Border>
- </WrapPanel>
- </Grid>
- </ui:CardControl.Header>
- </ui:CardControl>
-
- <!-- GPU -->
- <ui:CardControl
- Icon="{ui:SymbolIcon NetworkAdapter16}"
- Margin="5,5,0,0"
- VerticalAlignment="Stretch">
- <ui:CardControl.Header>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
-
- <StackPanel Grid.Row="0">
- <ui:TextBlock
- FontTypography="BodyStrong"
- Text="{Binding ViewModel.SystemInfo.PrimaryGpu.Name}"
- TextTrimming="CharacterEllipsis" />
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{Binding ViewModel.SystemInfo.PrimaryGpu.Vendor}" />
- </StackPanel>
-
- <WrapPanel
- Grid.Row="1"
- Margin="0,8,0,0"
- Orientation="Horizontal">
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="0,0,4,4"
- Padding="6,3">
- <ui:TextBlock FontTypography="Caption">
- <Run Text="{Binding ViewModel.SystemInfo.PrimaryGpu.MemoryMB, Converter={StaticResource MBToGBConverter}}" />
- <Run Text="GB" />
- </ui:TextBlock>
- </Border>
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="0,0,4,4"
- Padding="6,3">
- <ui:TextBlock
- FontTypography="Caption"
- Text="{Binding ViewModel.SystemInfo.PrimaryGpu.DriverVersion}"
- TextTrimming="CharacterEllipsis" />
- </Border>
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="0,0,4,4"
- Padding="6,3"
- Visibility="{Binding ViewModel.SystemInfo.Gpus.Count, Converter={StaticResource GreaterThanOneToVisibilityConverter}}">
- <ui:TextBlock FontTypography="Caption">
- <Run Text="{ext:Loc Dashboard.SystemInfo.Gpu.More, {Binding ViewModel.SystemInfo.Gpus.Count, Mode=OneWay, Converter={StaticResource MinusOneConverter}}}" />
- </ui:TextBlock>
- </Border>
- </WrapPanel>
- </Grid>
- </ui:CardControl.Header>
- </ui:CardControl>
- </UniformGrid>
-
- <!-- Storage Section -->
- <ui:TextBlock
- FontTypography="BodyStrong"
- Margin="0,20,0,8"
- Text="{ext:Loc Dashboard.SystemInfo.Storage.Header}" />
-
- <ItemsControl ItemsSource="{Binding ViewModel.RuntimeDisk.Volumes}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <ui:CardControl Margin="0,0,0,8">
- <ui:CardControl.Icon>
- <ui:SymbolIcon Filled="True" Symbol="HardDrive20">
- <ui:SymbolIcon.Style>
- <Style TargetType="ui:SymbolIcon">
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsSystemDrive}" Value="True">
- <Setter Property="Foreground" Value="{DynamicResource SystemFillColorAttentionBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ui:SymbolIcon.Style>
- </ui:SymbolIcon>
- </ui:CardControl.Icon>
- <ui:CardControl.Header>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
-
- <!-- Drive Letter and Label -->
- <StackPanel Grid.Row="0" Orientation="Horizontal">
- <ui:TextBlock
- FontTypography="BodyStrong"
- Margin="0,0,5,0"
- Text="{Binding DriveLetter, StringFormat='({0})'}" />
-
- <ui:TextBlock
- FontTypography="Caption"
- Margin="0,0,5,0"
- Text="{Binding VolumeLabel}"
- VerticalAlignment="Center" />
-
- <Border
- Background="{DynamicResource SystemFillColorAttentionBrush}"
- CornerRadius="4"
- Margin="0,0,4,0"
- Padding="5,2"
- VerticalAlignment="Center"
- Visibility="{Binding IsSystemDrive, Converter={StaticResource BoolToVisibilityConverter}}">
- <ui:TextBlock
- FontTypography="Caption"
- Foreground="Black"
- Text="{ext:Loc Dashboard.SystemInfo.Storage.System}" />
- </Border>
-
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Margin="0,0,4,0"
- Padding="5,2"
- VerticalAlignment="Center">
- <ui:TextBlock FontTypography="Caption" Text="{Binding MediaType}">
- <ui:TextBlock.Style>
- <Style TargetType="ui:TextBlock">
- <Style.Triggers>
- <DataTrigger Binding="{Binding MediaType}" Value="SSD">
- <Setter Property="Foreground" Value="{DynamicResource SystemFillColorSuccessBrush}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding MediaType}" Value="HDD">
- <Setter Property="Foreground" Value="{DynamicResource SystemFillColorCautionBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ui:TextBlock.Style>
- </ui:TextBlock>
- </Border>
-
- <Border
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4"
- Padding="5,2"
- VerticalAlignment="Center">
- <ui:TextBlock FontTypography="Caption" Text="{Binding DriveFormat}" />
- </Border>
- </StackPanel>
-
- <!-- Model Information -->
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Grid.Row="1"
- Margin="0,4,0,0"
- Text="{Binding Model}"
- TextTrimming="CharacterEllipsis"
- Visibility="{Binding Model, Converter={StaticResource NullToVisibilityConverter}}" />
-
- <!-- Storage Stats -->
- <StackPanel
- Grid.Row="2"
- Margin="0,4,0,0"
- Orientation="Horizontal">
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc Dashboard.SystemInfo.Storage.DiskInfo,
+ Text="{ext:Loc Dashboard.SystemInfo.Storage.DiskInfo,
{Binding UsedSizeGB, StringFormat='{}{0:F1}'},
{Binding TotalSizeGB, StringFormat='{}{0:F1}'},
- {Binding AvailableSizeGB, StringFormat='{}{0:F1}'}}" />
- </StackPanel>
-
- <!-- Progress Bar -->
- <ProgressBar
- Grid.Row="3"
- Height="6"
- Margin="0,8,0,0"
- Maximum="100"
- Value="{Binding UsedPercent}" />
- </Grid>
- </ui:CardControl.Header>
- </ui:CardControl>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </StackPanel>
- </ScrollViewer>
- </Grid>
-</Page>
\ No newline at end of file
+ {Binding AvailableSizeGB, StringFormat='{}{0:F1}'}}"
+ />
+ </StackPanel>
+
+ <!-- Progress Bar -->
+ <ProgressBar
+ Grid.Row="3"
+ Height="6"
+ Margin="0,8,0,0"
+ Maximum="100"
+ Value="{Binding UsedPercent}"
+ />
+ </Grid>
+ </ui:CardControl.Header>
+ </ui:CardControl>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+ </ScrollViewer>
+ </Grid>
+</Page>
diff --git a/optimizerDuck/UI/Pages/DashboardPage.xaml.cs b/optimizerDuck/UI/Pages/DashboardPage.xaml.cs
index 72de150..a1f870c 100644
--- a/optimizerDuck/UI/Pages/DashboardPage.xaml.cs
+++ b/optimizerDuck/UI/Pages/DashboardPage.xaml.cs
@@ -14,4 +14,4 @@ public partial class DashboardPage : INavigableView<DashboardViewModel>
}
public DashboardViewModel ViewModel { get; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Pages/DiskCleanupPage.xaml b/optimizerDuck/UI/Pages/DiskCleanupPage.xaml
index ae8eece..8328c47 100644
--- a/optimizerDuck/UI/Pages/DiskCleanupPage.xaml
+++ b/optimizerDuck/UI/Pages/DiskCleanupPage.xaml
@@ -1,416 +1,431 @@
<Page
- x:Class="optimizerDuck.UI.Pages.DiskCleanupPage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:cleanup1="clr-namespace:optimizerDuck.Domain.Optimizations.Models.Cleanup"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:local="clr-namespace:optimizerDuck.UI.Pages"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- Title="DiskCleanupPage"
- Margin="0,32,0,0"
- d:DataContext="{d:DesignInstance local:DiskCleanupPage}"
- d:DesignHeight="1200"
- d:DesignWidth="800"
- ui:Design.Background="Black"
- ui:Design.Foreground="White"
- Foreground="{DynamicResource TextFillColorPrimaryBrush}"
- ScrollViewer.CanContentScroll="False"
- mc:Ignorable="d">
- <Page.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
- <converters:BooleanToVisibilityConverter
- x:Key="InverseBooleanToVisibilityConverter"
- False="Visible"
- True="Collapsed" />
- <converters:SizeToBrushConverter x:Key="SizeToBrushConverter" />
- </Page.Resources>
+ x:Class="optimizerDuck.UI.Pages.DiskCleanupPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:cleanup1="clr-namespace:optimizerDuck.Domain.Optimizations.Models.Cleanup"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:local="clr-namespace:optimizerDuck.UI.Pages"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ Title="DiskCleanupPage"
+ Margin="0,32,0,0"
+ d:DataContext="{d:DesignInstance local:DiskCleanupPage}"
+ d:DesignHeight="1200"
+ d:DesignWidth="800"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ ScrollViewer.CanContentScroll="False"
+ mc:Ignorable="d"
+>
+ <Page.Resources>
+ <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
+ <converters:BooleanToVisibilityConverter
+ x:Key="InverseBooleanToVisibilityConverter"
+ False="Visible"
+ True="Collapsed"
+ />
+ <converters:SizeToBrushConverter x:Key="SizeToBrushConverter" />
+ </Page.Resources>
- <Grid RowDefinitions="Auto,*">
- <!-- Header -->
- <StackPanel Margin="0,0,0,20">
- <ui:TextBlock
- FontTypography="Title"
- Text="{ext:Loc DiskCleanup.Header.Title}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Margin="0,4,0,0"
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc DiskCleanup.Header.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
+ <Grid RowDefinitions="Auto,*">
+ <!-- Header -->
+ <StackPanel Margin="0,0,0,20">
+ <ui:TextBlock
+ FontTypography="Title"
+ Text="{ext:Loc DiskCleanup.Header.Title}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc DiskCleanup.Header.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
- <!-- Loading state (initial scan) -->
- <Border Grid.Row="1" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
- <StackPanel
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Orientation="Vertical">
- <ui:ProgressRing
- Width="48"
- Height="48"
- Margin="0,0,0,12"
- HorizontalAlignment="Center"
- IsIndeterminate="True" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc DiskCleanup.Loading}" />
- <ui:TextBlock
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc DiskCleanup.Header.Description}" />
- </StackPanel>
- </Border>
+ <!-- Loading state (initial scan) -->
+ <Border
+ Grid.Row="1"
+ Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
+ <ui:ProgressRing
+ Width="48"
+ Height="48"
+ Margin="0,0,0,12"
+ HorizontalAlignment="Center"
+ IsIndeterminate="True"
+ />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc DiskCleanup.Loading}"
+ />
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc DiskCleanup.Header.Description}"
+ />
+ </StackPanel>
+ </Border>
- <!-- Main content -->
+ <!-- Main content -->
+ <Border
+ Grid.Row="1"
+ CornerRadius="6"
+ Visibility="{Binding ViewModel.HasData, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <Grid RowDefinitions="Auto,Auto,Auto,*">
+ <!-- Summary card with Scan button / Indicator -->
<Border
- Grid.Row="1"
- CornerRadius="6"
- Visibility="{Binding ViewModel.HasData, Converter={StaticResource BooleanToVisibilityConverter}}">
- <Grid RowDefinitions="Auto,Auto,Auto,*">
-
- <!-- Summary card with Scan button / Indicator -->
- <Border
- Margin="0,0,0,12"
- Padding="16"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="8">
- <Grid ColumnDefinitions="Auto,*,Auto">
- <!-- Icon -->
- <Border
- Width="44"
- Height="44"
- Margin="0,0,16,0"
- VerticalAlignment="Center"
- CornerRadius="22">
- <ui:SymbolIcon
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontSize="22"
- Symbol="HardDrive20" />
- </Border>
+ Margin="0,0,0,12"
+ Padding="16"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="8"
+ >
+ <Grid ColumnDefinitions="Auto,*,Auto">
+ <!-- Icon -->
+ <Border
+ Width="44"
+ Height="44"
+ Margin="0,0,16,0"
+ VerticalAlignment="Center"
+ CornerRadius="22"
+ >
+ <ui:SymbolIcon
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ FontSize="22"
+ Symbol="HardDrive20"
+ />
+ </Border>
- <!-- Info -->
- <StackPanel Grid.Column="1" VerticalAlignment="Center">
- <ui:TextBlock FontTypography="BodyStrong" Text="{ext:Loc DiskCleanup.TotalSpace}" />
- <ui:TextBlock
- Margin="0,2,0,0"
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc DiskCleanup.ItemsAndFilesSelected,
+ <!-- Info -->
+ <StackPanel Grid.Column="1" VerticalAlignment="Center">
+ <ui:TextBlock FontTypography="BodyStrong" Text="{ext:Loc DiskCleanup.TotalSpace}" />
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc DiskCleanup.ItemsAndFilesSelected,
{Binding ViewModel.TotalSelectedSizeFormatted},
{Binding ViewModel.SelectedCount},
- {Binding ViewModel.TotalSelectedFileCount}}" />
- </StackPanel>
+ {Binding ViewModel.TotalSelectedFileCount}}"
+ />
+ </StackPanel>
- <!-- Scan button -->
- <ui:Button
- Grid.Column="2"
- VerticalAlignment="Center"
- Appearance="Primary"
- Command="{Binding ViewModel.ScanCommand}"
- Content="{ext:Loc DiskCleanup.Button.Scan}"
- Icon="{ui:SymbolIcon Search24,
+ <!-- Scan button -->
+ <ui:Button
+ Grid.Column="2"
+ VerticalAlignment="Center"
+ Appearance="Primary"
+ Command="{Binding ViewModel.ScanCommand}"
+ Content="{ext:Loc DiskCleanup.Button.Scan}"
+ Icon="{ui:SymbolIcon Search24,
FontSize=18}"
- Visibility="{Binding ViewModel.IsScanning, Converter={StaticResource InverseBooleanToVisibilityConverter}}" />
-
- <!-- Scanning indicator -->
- <StackPanel
- Grid.Column="2"
- VerticalAlignment="Center"
- Orientation="Horizontal"
- Visibility="{Binding ViewModel.IsScanning, Converter={StaticResource BooleanToVisibilityConverter}}">
- <ui:ProgressRing
- Width="16"
- Height="16"
- Margin="0,0,8,0"
- IsIndeterminate="True" />
- <ui:TextBlock
- VerticalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc DiskCleanup.Scanning}" />
- </StackPanel>
- </Grid>
- </Border>
-
- <!-- Sort toolbar -->
- <WrapPanel
- Grid.Row="1"
- Margin="0,0,0,8"
- Orientation="Horizontal">
+ Visibility="{Binding ViewModel.IsScanning, Converter={StaticResource InverseBooleanToVisibilityConverter}}"
+ />
- <!-- Sort By -->
- <ComboBox
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- SelectedIndex="{Binding ViewModel.SelectedSortByIndex}"
- ToolTip="{ext:Loc Common.SortBy}"
- ToolTipService.BetweenShowDelay="160"
- ToolTipService.Placement="Top">
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="Storage24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Size}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="TextSortAscending24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Name}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="Folder24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Path}" />
- </Grid>
- </ComboBoxItem>
- </ComboBox>
- </WrapPanel>
+ <!-- Scanning indicator -->
+ <StackPanel
+ Grid.Column="2"
+ VerticalAlignment="Center"
+ Orientation="Horizontal"
+ Visibility="{Binding ViewModel.IsScanning, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <ui:ProgressRing Width="16" Height="16" Margin="0,0,8,0" IsIndeterminate="True" />
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc DiskCleanup.Scanning}"
+ />
+ </StackPanel>
+ </Grid>
+ </Border>
- <!-- Action buttons -->
- <StackPanel
- Grid.Row="2"
- Margin="0,0,0,12"
- Orientation="Horizontal">
+ <!-- Sort toolbar -->
+ <WrapPanel Grid.Row="1" Margin="0,0,0,8" Orientation="Horizontal">
+ <!-- Sort By -->
+ <ComboBox
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ SelectedIndex="{Binding ViewModel.SelectedSortByIndex}"
+ ToolTip="{ext:Loc Common.SortBy}"
+ ToolTipService.BetweenShowDelay="160"
+ ToolTipService.Placement="Top"
+ >
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,6,0" HorizontalAlignment="Left" Symbol="Storage24" />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Size}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ HorizontalAlignment="Left"
+ Symbol="TextSortAscending24"
+ />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Name}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,6,0" HorizontalAlignment="Left" Symbol="Folder24" />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Path}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ </ComboBox>
+ </WrapPanel>
- <!-- Clean button -->
- <ui:Button
- Appearance="Danger"
- Command="{Binding ViewModel.CleanSelectedCommand}"
- IsEnabled="{Binding ViewModel.CanClean}">
- <ui:Button.Content>
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- FontSize="18"
- Symbol="Delete24" />
- <TextBlock Text="{ext:Loc DiskCleanup.Button.CleanSelected, {Binding ViewModel.TotalSelectedSizeFormatted}}" />
- </StackPanel>
- </ui:Button.Content>
- </ui:Button>
+ <!-- Action buttons -->
+ <StackPanel Grid.Row="2" Margin="0,0,0,12" Orientation="Horizontal">
+ <!-- Clean button -->
+ <ui:Button
+ Appearance="Danger"
+ Command="{Binding ViewModel.CleanSelectedCommand}"
+ IsEnabled="{Binding ViewModel.CanClean}"
+ >
+ <ui:Button.Content>
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon Margin="0,0,6,0" FontSize="18" Symbol="Delete24" />
+ <TextBlock Text="{ext:Loc DiskCleanup.Button.CleanSelected, {Binding ViewModel.TotalSelectedSizeFormatted}}" />
+ </StackPanel>
+ </ui:Button.Content>
+ </ui:Button>
- <Separator Margin="4,0,4,0" />
+ <Separator Margin="4,0,4,0" />
- <!-- Select/Deselect All -->
- <ui:Button Command="{Binding ViewModel.SelectAllCommand}">
- <ui:Button.Style>
- <Style BasedOn="{StaticResource {x:Type ui:Button}}" TargetType="ui:Button">
- <Setter Property="Appearance" Value="Success" />
- <Setter Property="Content" Value="{ext:Loc DiskCleanup.Button.SelectAll}" />
- <Setter Property="Icon">
- <Setter.Value>
- <ui:SymbolIcon FontSize="18" Symbol="CheckboxChecked24" />
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding ViewModel.IsAllSelected}" Value="True">
- <Setter Property="Appearance" Value="Danger" />
- <Setter Property="Content" Value="{ext:Loc DiskCleanup.Button.DeselectAll}" />
- <Setter Property="Icon">
- <Setter.Value>
- <ui:SymbolIcon FontSize="18" Symbol="CheckboxUnchecked24" />
- </Setter.Value>
- </Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ui:Button.Style>
- </ui:Button>
- </StackPanel>
+ <!-- Select/Deselect All -->
+ <ui:Button Command="{Binding ViewModel.SelectAllCommand}">
+ <ui:Button.Style>
+ <Style BasedOn="{StaticResource {x:Type ui:Button}}" TargetType="ui:Button">
+ <Setter Property="Appearance" Value="Success" />
+ <Setter Property="Content" Value="{ext:Loc DiskCleanup.Button.SelectAll}" />
+ <Setter Property="Icon">
+ <Setter.Value>
+ <ui:SymbolIcon FontSize="18" Symbol="CheckboxChecked24" />
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding ViewModel.IsAllSelected}" Value="True">
+ <Setter Property="Appearance" Value="Danger" />
+ <Setter Property="Content" Value="{ext:Loc DiskCleanup.Button.DeselectAll}" />
+ <Setter Property="Icon">
+ <Setter.Value>
+ <ui:SymbolIcon FontSize="18" Symbol="CheckboxUnchecked24" />
+ </Setter.Value>
+ </Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ui:Button.Style>
+ </ui:Button>
+ </StackPanel>
- <!-- Items list (virtualized) -->
- <ItemsControl Grid.Row="3" ItemsSource="{Binding ViewModel.CleanupItems}">
- <ItemsControl.Template>
- <ControlTemplate TargetType="ItemsControl">
- <ScrollViewer HorizontalScrollBarVisibility="Disabled">
- <ItemsPresenter Margin="0,0,16,0" />
- </ScrollViewer>
- </ControlTemplate>
- </ItemsControl.Template>
+ <!-- Items list (virtualized) -->
+ <ItemsControl Grid.Row="3" ItemsSource="{Binding ViewModel.CleanupItems}">
+ <ItemsControl.Template>
+ <ControlTemplate TargetType="ItemsControl">
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled">
+ <ItemsPresenter Margin="0,0,16,0" />
+ </ScrollViewer>
+ </ControlTemplate>
+ </ItemsControl.Template>
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <VirtualizingStackPanel />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <VirtualizingStackPanel />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate DataType="{x:Type cleanup1:CleanupItem}">
- <Border
- Margin="0,0,0,4"
- Padding="14,10"
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- CornerRadius="6">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate DataType="{x:Type cleanup1:CleanupItem}">
+ <Border
+ Margin="0,0,0,4"
+ Padding="14,10"
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ CornerRadius="6"
+ >
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
- <!-- Checkbox -->
- <CheckBox
- Grid.Column="0"
- Margin="0,0,12,0"
- VerticalAlignment="Center"
- IsChecked="{Binding IsSelected, Mode=TwoWay}" />
+ <!-- Checkbox -->
+ <CheckBox
+ Grid.Column="0"
+ Margin="0,0,12,0"
+ VerticalAlignment="Center"
+ IsChecked="{Binding IsSelected, Mode=TwoWay}"
+ />
- <!-- Icon with circle background -->
- <Border
- Grid.Column="1"
- Width="38"
- Height="38"
- Margin="0,0,14,0"
- VerticalAlignment="Center"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="19">
- <ui:SymbolIcon
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontSize="20"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Symbol="{Binding Icon}" />
- </Border>
+ <!-- Icon with circle background -->
+ <Border
+ Grid.Column="1"
+ Width="38"
+ Height="38"
+ Margin="0,0,14,0"
+ VerticalAlignment="Center"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="19"
+ >
+ <ui:SymbolIcon
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ FontSize="20"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Symbol="{Binding Icon}"
+ />
+ </Border>
- <!-- Info -->
- <StackPanel Grid.Column="2" VerticalAlignment="Center">
- <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />
- <ui:TextBlock
- Margin="0,2,0,0"
- Appearance="Disabled"
- FontTypography="Body"
- Text="{Binding Description}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Margin="0,2,0,0"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{Binding Path}"
- TextTrimming="CharacterEllipsis" />
+ <!-- Info -->
+ <StackPanel Grid.Column="2" VerticalAlignment="Center">
+ <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ Appearance="Disabled"
+ FontTypography="Body"
+ Text="{Binding Description}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{Binding Path}"
+ TextTrimming="CharacterEllipsis"
+ />
- <Border
- Margin="0,6,0,0"
- HorizontalAlignment="Left"
- CornerRadius="8">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Visibility" Value="{Binding IsScanned, Converter={StaticResource BooleanToVisibilityConverter}}" />
- <Setter Property="Padding" Value="8,3" />
- <Setter Property="Background" Value="{Binding SizeBytes, Converter={StaticResource SizeToBrushConverter}}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsScanning}" Value="True">
- <Setter Property="Visibility" Value="Collapsed" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsCleaning}" Value="True">
- <Setter Property="Visibility" Value="Collapsed" />
- </DataTrigger>
- <DataTrigger Binding="{Binding FormattedSize}" Value="0 B">
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="Padding" Value="0,3" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <Grid>
- <Border>
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Visibility" Value="Visible" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding FormattedSize}" Value="0 B">
- <Setter Property="Visibility" Value="Collapsed" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <StackPanel VerticalAlignment="Center" Orientation="Horizontal">
- <ui:TextBlock
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text="{Binding FormattedSize}" />
- <ui:TextBlock
- Margin="6,0,6,0"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Opacity="0.8"
- Text="•" />
- <ui:TextBlock
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text="{ext:Loc DiskCleanup.FilesCount,
- {Binding FileCount}}" />
- </StackPanel>
- </Border>
- <Border>
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Visibility" Value="Collapsed" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding FormattedSize}" Value="0 B">
- <Setter Property="Visibility" Value="Visible" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <ui:TextBlock
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{ext:Loc DiskCleanup.EmptySize}" />
- </Border>
- </Grid>
- </Border>
- </StackPanel>
+ <Border Margin="0,6,0,0" HorizontalAlignment="Left" CornerRadius="8">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter
+ Property="Visibility"
+ Value="{Binding IsScanned, Converter={StaticResource BooleanToVisibilityConverter}}"
+ />
+ <Setter Property="Padding" Value="8,3" />
+ <Setter
+ Property="Background"
+ Value="{Binding SizeBytes, Converter={StaticResource SizeToBrushConverter}}"
+ />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsScanning}" Value="True">
+ <Setter Property="Visibility" Value="Collapsed" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsCleaning}" Value="True">
+ <Setter Property="Visibility" Value="Collapsed" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding FormattedSize}" Value="0 B">
+ <Setter Property="Background" Value="Transparent" />
+ <Setter Property="Padding" Value="0,3" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <Grid>
+ <Border>
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Visible" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding FormattedSize}" Value="0 B">
+ <Setter Property="Visibility" Value="Collapsed" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <StackPanel VerticalAlignment="Center" Orientation="Horizontal">
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Text="{Binding FormattedSize}"
+ />
+ <ui:TextBlock
+ Margin="6,0,6,0"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Opacity="0.8"
+ Text="•"
+ />
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Text="{ext:Loc DiskCleanup.FilesCount,
+ {Binding FileCount}}"
+ />
+ </StackPanel>
+ </Border>
+ <Border>
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding FormattedSize}" Value="0 B">
+ <Setter Property="Visibility" Value="Visible" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Text="{ext:Loc DiskCleanup.EmptySize}"
+ />
+ </Border>
+ </Grid>
+ </Border>
+ </StackPanel>
- <!-- Scanning / Cleaning spinners -->
- <StackPanel
- Grid.Column="3"
- Margin="14,0,0,0"
- HorizontalAlignment="Right"
- VerticalAlignment="Center">
- <ui:ProgressRing
- Width="22"
- Height="22"
- IsIndeterminate="True"
- Visibility="{Binding IsScanning, Converter={StaticResource BooleanToVisibilityConverter}}" />
- <ui:ProgressRing
- Width="22"
- Height="22"
- IsIndeterminate="True"
- Visibility="{Binding IsCleaning, Converter={StaticResource BooleanToVisibilityConverter}}" />
- </StackPanel>
- </Grid>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </Grid>
- </Border>
- </Grid>
-</Page>
\ No newline at end of file
+ <!-- Scanning / Cleaning spinners -->
+ <StackPanel
+ Grid.Column="3"
+ Margin="14,0,0,0"
+ HorizontalAlignment="Right"
+ VerticalAlignment="Center"
+ >
+ <ui:ProgressRing
+ Width="22"
+ Height="22"
+ IsIndeterminate="True"
+ Visibility="{Binding IsScanning, Converter={StaticResource BooleanToVisibilityConverter}}"
+ />
+ <ui:ProgressRing
+ Width="22"
+ Height="22"
+ IsIndeterminate="True"
+ Visibility="{Binding IsCleaning, Converter={StaticResource BooleanToVisibilityConverter}}"
+ />
+ </StackPanel>
+ </Grid>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </Grid>
+ </Border>
+ </Grid>
+</Page>
diff --git a/optimizerDuck/UI/Pages/DiskCleanupPage.xaml.cs b/optimizerDuck/UI/Pages/DiskCleanupPage.xaml.cs
index 7a98ffc..0d47d87 100644
--- a/optimizerDuck/UI/Pages/DiskCleanupPage.xaml.cs
+++ b/optimizerDuck/UI/Pages/DiskCleanupPage.xaml.cs
@@ -14,4 +14,4 @@ public partial class DiskCleanupPage : INavigableView<DiskCleanupViewModel>
}
public DiskCleanupViewModel ViewModel { get; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPage.xaml b/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPage.xaml
index fba71dd..53b00d5 100644
--- a/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPage.xaml
+++ b/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPage.xaml
@@ -1,168 +1,175 @@
<Page
- x:Class="optimizerDuck.UI.Pages.Features.FeatureCategoryPage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:features="clr-namespace:optimizerDuck.UI.Pages.Features"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- Title="{Binding ViewModel.CategoryName}"
- Margin="0,32,0,0"
- d:DataContext="{d:DesignInstance features:FeatureCategoryPage}"
- d:DesignHeight="650"
- d:DesignWidth="800"
- ui:Design.Background="Black"
- ui:Design.Foreground="White"
- Foreground="{DynamicResource TextFillColorPrimaryBrush}"
- ScrollViewer.CanContentScroll="False"
- mc:Ignorable="d">
+ x:Class="optimizerDuck.UI.Pages.Features.FeatureCategoryPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:features="clr-namespace:optimizerDuck.UI.Pages.Features"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ Title="{Binding ViewModel.CategoryName}"
+ Margin="0,32,0,0"
+ d:DataContext="{d:DesignInstance features:FeatureCategoryPage}"
+ d:DesignHeight="650"
+ d:DesignWidth="800"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ ScrollViewer.CanContentScroll="False"
+ mc:Ignorable="d"
+>
+ <Page.Resources>
+ <converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
+ </Page.Resources>
- <Page.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
- </Page.Resources>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
+ <StackPanel Grid.Row="0" Margin="0,0,0,16">
+ <StackPanel Margin="0,0,0,8" Orientation="Horizontal">
+ <ui:SymbolIcon
+ Margin="0,0,12,0"
+ VerticalAlignment="Center"
+ FontSize="24"
+ Symbol="{Binding ViewModel.CategoryIcon}"
+ />
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ FontTypography="Title"
+ Text="{Binding ViewModel.CategoryName}"
+ />
+ </StackPanel>
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{Binding ViewModel.CategoryDescription}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
- <StackPanel Grid.Row="0" Margin="0,0,0,16">
- <StackPanel Margin="0,0,0,8" Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,12,0"
- VerticalAlignment="Center"
- FontSize="24"
- Symbol="{Binding ViewModel.CategoryIcon}" />
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="Title"
- Text="{Binding ViewModel.CategoryName}" />
- </StackPanel>
- <ui:TextBlock
- Appearance="Secondary"
- Text="{Binding ViewModel.CategoryDescription}"
- TextWrapping="Wrap" />
- </StackPanel>
-
- <WrapPanel
- Grid.Row="1"
- Margin="0,0,0,16"
- Orientation="Horizontal">
- <ui:TextBox
- MinWidth="200"
- Margin="0,0,8,0"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Icon="{ui:SymbolIcon Search24}"
- PlaceholderText="{ext:Loc Common.Search.Placeholder}"
- Text="{Binding ViewModel.SearchText, UpdateSourceTrigger=PropertyChanged}" />
-
- <ComboBox
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- SelectedIndex="{Binding ViewModel.SelectedSortByIndex}"
- ToolTip="{ext:Loc Common.SortBy}"
- ToolTipService.BetweenShowDelay="160"
- ToolTipService.Placement="Top">
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="TextSortAscending24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Name}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="ToggleRight24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Status}" />
- </Grid>
- </ComboBoxItem>
- </ComboBox>
- </WrapPanel>
+ <WrapPanel Grid.Row="1" Margin="0,0,0,16" Orientation="Horizontal">
+ <ui:TextBox
+ MinWidth="200"
+ Margin="0,0,8,0"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Icon="{ui:SymbolIcon Search24}"
+ PlaceholderText="{ext:Loc Common.Search.Placeholder}"
+ Text="{Binding ViewModel.SearchText, UpdateSourceTrigger=PropertyChanged}"
+ />
- <ScrollViewer
- Grid.Row="2"
- HorizontalScrollBarVisibility="Disabled"
- VerticalScrollBarVisibility="Auto">
+ <ComboBox
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ SelectedIndex="{Binding ViewModel.SelectedSortByIndex}"
+ ToolTip="{ext:Loc Common.SortBy}"
+ ToolTipService.BetweenShowDelay="160"
+ ToolTipService.Placement="Top"
+ >
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ HorizontalAlignment="Left"
+ Symbol="TextSortAscending24"
+ />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Name}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,6,0" HorizontalAlignment="Left" Symbol="ToggleRight24" />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Status}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ </ComboBox>
+ </WrapPanel>
- <!-- Sections -->
- <ItemsControl Margin="0,0,16,0" ItemsSource="{Binding ViewModel.Sections}">
+ <ScrollViewer
+ Grid.Row="2"
+ HorizontalScrollBarVisibility="Disabled"
+ VerticalScrollBarVisibility="Auto"
+ >
+ <!-- Sections -->
+ <ItemsControl Margin="0,0,16,0" ItemsSource="{Binding ViewModel.Sections}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <StackPanel Margin="0,0,0,10">
+ <ui:TextBlock Margin="0,0,0,6" FontTypography="BodyStrong" Text="{Binding Name}" />
+ <ItemsControl ItemsSource="{Binding Features}">
<ItemsControl.ItemTemplate>
- <DataTemplate>
- <StackPanel Margin="0,0,0,10">
- <ui:TextBlock
- Margin="0,0,0,6"
- FontTypography="BodyStrong"
- Text="{Binding Name}" />
- <ItemsControl ItemsSource="{Binding Features}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <ui:CardControl Margin="0,0,0,4">
- <ui:CardControl.Icon>
- <ui:SymbolIcon Symbol="{Binding Icon}" />
- </ui:CardControl.Icon>
- <ui:CardControl.Header>
- <StackPanel VerticalAlignment="Center">
- <ui:TextBlock
- FontTypography="Body"
- Text="{Binding Name}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Margin="0,4,0,0"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{Binding Description}"
- TextTrimming="WordEllipsis"
- TextWrapping="Wrap" />
- </StackPanel>
- </ui:CardControl.Header>
- <ui:ToggleSwitch
- HorizontalAlignment="Right"
- VerticalAlignment="Center"
- Command="{Binding ToggleCommand}"
- Cursor="Hand"
- IsChecked="{Binding IsEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
- OffContent="{ext:Loc Common.Toggle.Off}"
- OnContent="{ext:Loc Common.Toggle.On}" />
- </ui:CardControl>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
+ <DataTemplate>
+ <ui:CardControl Margin="0,0,0,4">
+ <ui:CardControl.Icon>
+ <ui:SymbolIcon Symbol="{Binding Icon}" />
+ </ui:CardControl.Icon>
+ <ui:CardControl.Header>
+ <StackPanel VerticalAlignment="Center">
+ <ui:TextBlock
+ FontTypography="Body"
+ Text="{Binding Name}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{Binding Description}"
+ TextTrimming="WordEllipsis"
+ TextWrapping="Wrap"
+ />
</StackPanel>
- </DataTemplate>
+ </ui:CardControl.Header>
+ <ui:ToggleSwitch
+ HorizontalAlignment="Right"
+ VerticalAlignment="Center"
+ Command="{Binding ToggleCommand}"
+ Cursor="Hand"
+ IsChecked="{Binding IsEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
+ OffContent="{ext:Loc Common.Toggle.Off}"
+ OnContent="{ext:Loc Common.Toggle.On}"
+ />
+ </ui:CardControl>
+ </DataTemplate>
</ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
-
- <Border Grid.Row="2" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BoolToVisibilityConverter}}">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Width="48"
- Height="48"
- Margin="0,0,0,16"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsIndeterminate="True" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc Features.Loading}" />
+ </ItemsControl>
</StackPanel>
- </Border>
- </Grid>
-</Page>
\ No newline at end of file
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
+
+ <Border
+ Grid.Row="2"
+ Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BoolToVisibilityConverter}}"
+ >
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+ <ui:ProgressRing
+ Width="48"
+ Height="48"
+ Margin="0,0,0,16"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsIndeterminate="True"
+ />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Features.Loading}"
+ />
+ </StackPanel>
+ </Border>
+ </Grid>
+</Page>
diff --git a/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPage.xaml.cs b/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPage.xaml.cs
index 3f430dd..4d19fef 100644
--- a/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPage.xaml.cs
+++ b/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPage.xaml.cs
@@ -13,4 +13,4 @@ public partial class FeatureCategoryPage : INavigableView<FeatureCategoryViewMod
}
public FeatureCategoryViewModel ViewModel { get; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPages.cs b/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPages.cs
index 959ae8a..6e1a343 100644
--- a/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPages.cs
+++ b/optimizerDuck/UI/Pages/Features/Categories/FeatureCategoryPages.cs
@@ -4,7 +4,8 @@ namespace optimizerDuck.UI.Pages.Features;
public sealed class PreferencesFeatureCategory : FeatureCategoryPage
{
- public PreferencesFeatureCategory(FeatureCategoryViewModel viewModel) : base(viewModel)
+ public PreferencesFeatureCategory(FeatureCategoryViewModel viewModel)
+ : base(viewModel)
{
InitializeComponent();
}
@@ -12,7 +13,8 @@ public sealed class PreferencesFeatureCategory : FeatureCategoryPage
public sealed class SystemFeatureCategory : FeatureCategoryPage
{
- public SystemFeatureCategory(FeatureCategoryViewModel viewModel) : base(viewModel)
+ public SystemFeatureCategory(FeatureCategoryViewModel viewModel)
+ : base(viewModel)
{
InitializeComponent();
}
@@ -20,7 +22,8 @@ public sealed class SystemFeatureCategory : FeatureCategoryPage
public sealed class GamingFeatureCategory : FeatureCategoryPage
{
- public GamingFeatureCategory(FeatureCategoryViewModel viewModel) : base(viewModel)
+ public GamingFeatureCategory(FeatureCategoryViewModel viewModel)
+ : base(viewModel)
{
InitializeComponent();
}
@@ -28,8 +31,9 @@ public sealed class GamingFeatureCategory : FeatureCategoryPage
public sealed class DesktopFeatureCategory : FeatureCategoryPage
{
- public DesktopFeatureCategory(FeatureCategoryViewModel viewModel) : base(viewModel)
+ public DesktopFeatureCategory(FeatureCategoryViewModel viewModel)
+ : base(viewModel)
{
InitializeComponent();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Pages/Features/FeaturesPage.xaml b/optimizerDuck/UI/Pages/Features/FeaturesPage.xaml
index 063a6da..577d4a4 100644
--- a/optimizerDuck/UI/Pages/Features/FeaturesPage.xaml
+++ b/optimizerDuck/UI/Pages/Features/FeaturesPage.xaml
@@ -1,120 +1,131 @@
<Page
- Foreground="{DynamicResource TextFillColorPrimaryBrush}"
- Margin="0,32,0,0"
- ScrollViewer.CanContentScroll="False"
- Title="Features"
- d:DataContext="{d:DesignInstance pages:FeaturesPage}"
- d:DesignHeight="650"
- d:DesignWidth="800"
- mc:Ignorable="d"
- ui:Design.Background="Black"
- ui:Design.Foreground="White"
- x:Class="optimizerDuck.UI.Pages.FeaturesPage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:pages="clr-namespace:optimizerDuck.UI.Pages"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- xmlns:vm="clr-namespace:optimizerDuck.UI.ViewModels.Pages"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ Margin="0,32,0,0"
+ ScrollViewer.CanContentScroll="False"
+ Title="Features"
+ d:DataContext="{d:DesignInstance pages:FeaturesPage}"
+ d:DesignHeight="650"
+ d:DesignWidth="800"
+ mc:Ignorable="d"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ x:Class="optimizerDuck.UI.Pages.FeaturesPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:pages="clr-namespace:optimizerDuck.UI.Pages"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:vm="clr-namespace:optimizerDuck.UI.ViewModels.Pages"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <Page.Resources>
+ <converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
+ <converters:WidthToColumnConverter x:Key="WidthToColumnConverter" />
+ </Page.Resources>
- <Page.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
- <converters:WidthToColumnConverter x:Key="WidthToColumnConverter" />
- </Page.Resources>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
+ <StackPanel Grid.Row="0" Margin="42,0,42,16">
+ <ui:TextBlock FontTypography="Title" Margin="0,0,0,8" Text="{ext:Loc Features.Title}" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Features.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
- <StackPanel Grid.Row="0" Margin="42,0,42,16">
- <ui:TextBlock
- FontTypography="Title"
- Margin="0,0,0,8"
- Text="{ext:Loc Features.Title}" />
- <ui:TextBlock
- Appearance="Secondary"
- Text="{ext:Loc Features.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
-
- <ui:VirtualizingItemsControl
- Grid.Row="1"
- ItemsSource="{Binding ViewModel.Categories}"
- Margin="42,0,42,0">
- <ui:VirtualizingItemsControl.Template>
- <ControlTemplate TargetType="ItemsControl">
- <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
- <ItemsPresenter />
- </ScrollViewer>
- </ControlTemplate>
- </ui:VirtualizingItemsControl.Template>
+ <ui:VirtualizingItemsControl
+ Grid.Row="1"
+ ItemsSource="{Binding ViewModel.Categories}"
+ Margin="42,0,42,0"
+ >
+ <ui:VirtualizingItemsControl.Template>
+ <ControlTemplate TargetType="ItemsControl">
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
+ <ItemsPresenter />
+ </ScrollViewer>
+ </ControlTemplate>
+ </ui:VirtualizingItemsControl.Template>
- <ui:VirtualizingItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <UniformGrid Columns="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ScrollViewer}, Converter={StaticResource WidthToColumnConverter}}" VerticalAlignment="Top" />
- </ItemsPanelTemplate>
- </ui:VirtualizingItemsControl.ItemsPanel>
+ <ui:VirtualizingItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <UniformGrid
+ Columns="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ScrollViewer}, Converter={StaticResource WidthToColumnConverter}}"
+ VerticalAlignment="Top"
+ />
+ </ItemsPanelTemplate>
+ </ui:VirtualizingItemsControl.ItemsPanel>
- <ui:VirtualizingItemsControl.ItemContainerStyle>
- <Style TargetType="ContentPresenter">
- <Setter Property="Margin" Value="5" />
- <Setter Property="HorizontalAlignment" Value="Stretch" />
- </Style>
- </ui:VirtualizingItemsControl.ItemContainerStyle>
+ <ui:VirtualizingItemsControl.ItemContainerStyle>
+ <Style TargetType="ContentPresenter">
+ <Setter Property="Margin" Value="5" />
+ <Setter Property="HorizontalAlignment" Value="Stretch" />
+ </Style>
+ </ui:VirtualizingItemsControl.ItemContainerStyle>
- <ui:VirtualizingItemsControl.ItemTemplate>
- <DataTemplate DataType="{x:Type vm:FeatureCategoryItemViewModel}">
- <ui:CardAction
- Command="{Binding DataContext.ViewModel.NavigateToCategoryCommand, RelativeSource={RelativeSource AncestorType=Page}}"
- CommandParameter="{Binding}"
- IsChevronVisible="False"
- Padding="20,16">
- <Grid RowDefinitions="Auto,Auto,Auto">
- <ui:SymbolIcon
- FontSize="32"
- Grid.Row="0"
- HorizontalAlignment="Left"
- Margin="0,0,0,12"
- Symbol="{Binding Icon}" />
+ <ui:VirtualizingItemsControl.ItemTemplate>
+ <DataTemplate DataType="{x:Type vm:FeatureCategoryItemViewModel}">
+ <ui:CardAction
+ Command="{Binding DataContext.ViewModel.NavigateToCategoryCommand, RelativeSource={RelativeSource AncestorType=Page}}"
+ CommandParameter="{Binding}"
+ IsChevronVisible="False"
+ Padding="20,16"
+ >
+ <Grid RowDefinitions="Auto,Auto,Auto">
+ <ui:SymbolIcon
+ FontSize="32"
+ Grid.Row="0"
+ HorizontalAlignment="Left"
+ Margin="0,0,0,12"
+ Symbol="{Binding Icon}"
+ />
- <ui:TextBlock
- FontTypography="Subtitle"
- Grid.Row="1"
- Margin="0,0,0,6"
- Text="{Binding Name}"
- TextWrapping="Wrap" />
+ <ui:TextBlock
+ FontTypography="Subtitle"
+ Grid.Row="1"
+ Margin="0,0,0,6"
+ Text="{Binding Name}"
+ TextWrapping="Wrap"
+ />
- <ui:TextBlock
- Appearance="Secondary"
- FontTypography="Body"
- Grid.Row="2"
- Text="{Binding Description}"
- TextWrapping="Wrap" />
- </Grid>
- </ui:CardAction>
- </DataTemplate>
- </ui:VirtualizingItemsControl.ItemTemplate>
- </ui:VirtualizingItemsControl>
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Body"
+ Grid.Row="2"
+ Text="{Binding Description}"
+ TextWrapping="Wrap"
+ />
+ </Grid>
+ </ui:CardAction>
+ </DataTemplate>
+ </ui:VirtualizingItemsControl.ItemTemplate>
+ </ui:VirtualizingItemsControl>
- <Border Grid.Row="1" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BoolToVisibilityConverter}}">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Height="48"
- HorizontalAlignment="Center"
- IsIndeterminate="True"
- Margin="0,0,0,16"
- VerticalAlignment="Center"
- Width="48" />
- <ui:TextBlock
- FontTypography="BodyStrong"
- HorizontalAlignment="Center"
- Text="{ext:Loc ToggleFeatures.Loading}" />
- </StackPanel>
- </Border>
- </Grid>
-</Page>
\ No newline at end of file
+ <Border
+ Grid.Row="1"
+ Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BoolToVisibilityConverter}}"
+ >
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+ <ui:ProgressRing
+ Height="48"
+ HorizontalAlignment="Center"
+ IsIndeterminate="True"
+ Margin="0,0,0,16"
+ VerticalAlignment="Center"
+ Width="48"
+ />
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ HorizontalAlignment="Center"
+ Text="{ext:Loc ToggleFeatures.Loading}"
+ />
+ </StackPanel>
+ </Border>
+ </Grid>
+</Page>
diff --git a/optimizerDuck/UI/Pages/Features/FeaturesPage.xaml.cs b/optimizerDuck/UI/Pages/Features/FeaturesPage.xaml.cs
index 9ed3272..a9c7827 100644
--- a/optimizerDuck/UI/Pages/Features/FeaturesPage.xaml.cs
+++ b/optimizerDuck/UI/Pages/Features/FeaturesPage.xaml.cs
@@ -16,4 +16,4 @@ public partial class FeaturesPage : INavigableView<FeaturesViewModel>
}
public FeaturesViewModel ViewModel { get; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml b/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml
index b8939c0..234eecc 100644
--- a/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml
+++ b/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml
@@ -1,418 +1,451 @@
<Page
- x:Class="optimizerDuck.UI.Pages.Optimizations.OptimizationPage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:optimization="clr-namespace:optimizerDuck.Domain.Optimizations.Models"
- xmlns:optimizations="clr-namespace:optimizerDuck.UI.Pages.Optimizations"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- Title="OptimizationPage"
- Margin="0,32,0,0"
- d:DataContext="{d:DesignInstance optimizations:OptimizationPage}"
- d:DesignHeight="650"
- d:DesignWidth="800"
- ui:Design.Background="Black"
- ui:Design.Foreground="White"
- Foreground="{DynamicResource TextFillColorPrimaryBrush}"
- ScrollViewer.CanContentScroll="False"
- mc:Ignorable="d">
- <Page.Resources>
- <converters:WidthToColumnConverter x:Key="WidthToColumnConverter" />
- <converters:ZeroToVisibilityConverter x:Key="ZeroToVisibilityConverter" />
- <converters:GreaterThanZeroToVisibilityConverter x:Key="GreaterThanZeroToVisibilityConverter" />
- <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
- <converters:BooleanToVisibilityConverter
- x:Key="InverseBooleanToVisibilityConverter"
- False="Visible"
- True="Collapsed" />
- <converters:NullToVisibilityConverter
- x:Key="NullToVisibilityConverter"
- False="Visible"
- True="Collapsed" />
- </Page.Resources>
+ x:Class="optimizerDuck.UI.Pages.Optimizations.OptimizationPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:optimization="clr-namespace:optimizerDuck.Domain.Optimizations.Models"
+ xmlns:optimizations="clr-namespace:optimizerDuck.UI.Pages.Optimizations"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ Title="OptimizationPage"
+ Margin="0,32,0,0"
+ d:DataContext="{d:DesignInstance optimizations:OptimizationPage}"
+ d:DesignHeight="650"
+ d:DesignWidth="800"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ ScrollViewer.CanContentScroll="False"
+ mc:Ignorable="d"
+>
+ <Page.Resources>
+ <converters:WidthToColumnConverter x:Key="WidthToColumnConverter" />
+ <converters:ZeroToVisibilityConverter x:Key="ZeroToVisibilityConverter" />
+ <converters:GreaterThanZeroToVisibilityConverter x:Key="GreaterThanZeroToVisibilityConverter" />
+ <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
+ <converters:BooleanToVisibilityConverter
+ x:Key="InverseBooleanToVisibilityConverter"
+ False="Visible"
+ True="Collapsed"
+ />
+ <converters:NullToVisibilityConverter
+ x:Key="NullToVisibilityConverter"
+ False="Visible"
+ True="Collapsed"
+ />
+ </Page.Resources>
- <Grid>
- <!-- Main Content -->
- <Grid RowDefinitions="Auto,*" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource InverseBooleanToVisibilityConverter}}">
- <!-- Toolbar -->
- <WrapPanel
- Grid.Row="0"
- Margin="5,0,5,10"
- VerticalAlignment="Center"
- Orientation="Horizontal">
+ <Grid>
+ <!-- Main Content -->
+ <Grid
+ RowDefinitions="Auto,*"
+ Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource InverseBooleanToVisibilityConverter}}"
+ >
+ <!-- Toolbar -->
+ <WrapPanel Grid.Row="0" Margin="5,0,5,10" VerticalAlignment="Center" Orientation="Horizontal">
+ <!-- Search -->
+ <ui:TextBox
+ MinWidth="200"
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ Icon="{ui:SymbolIcon Search24}"
+ PlaceholderText="{ext:Loc Common.Search.Placeholder}"
+ Text="{Binding ViewModel.SearchText, UpdateSourceTrigger=PropertyChanged}"
+ />
- <!-- Search -->
- <ui:TextBox
- MinWidth="200"
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- Icon="{ui:SymbolIcon Search24}"
- PlaceholderText="{ext:Loc Common.Search.Placeholder}"
- Text="{Binding ViewModel.SearchText, UpdateSourceTrigger=PropertyChanged}" />
+ <!-- Filter by Risk -->
+ <ComboBox
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ SelectedIndex="{Binding ViewModel.SelectedRiskFilterIndex}"
+ ToolTip="{ext:Loc Common.Filter}"
+ ToolTipService.BetweenShowDelay="160"
+ ToolTipService.Placement="Top"
+ >
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,6,0" HorizontalAlignment="Left" Symbol="Filter24" />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.Filter.All}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ Foreground="{DynamicResource SystemFillColorSuccessBrush}"
+ Symbol="ShieldCheckmark24"
+ />
+ <TextBlock Grid.Column="1" Text="{ext:Loc Optimizer.UI.Risk.Safe}" />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ Foreground="{DynamicResource SystemFillColorCautionBrush}"
+ Symbol="Warning24"
+ />
+ <TextBlock Grid.Column="1" Text="{ext:Loc Optimizer.UI.Risk.Moderate}" />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Symbol="ShieldError24"
+ />
+ <TextBlock Grid.Column="1" Text="{ext:Loc Optimizer.UI.Risk.Risky}" />
+ </Grid>
+ </ComboBoxItem>
+ </ComboBox>
- <!-- Filter by Risk -->
- <ComboBox
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- SelectedIndex="{Binding ViewModel.SelectedRiskFilterIndex}"
- ToolTip="{ext:Loc Common.Filter}"
- ToolTipService.BetweenShowDelay="160"
- ToolTipService.Placement="Top">
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="Filter24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.Filter.All}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- Foreground="{DynamicResource SystemFillColorSuccessBrush}"
- Symbol="ShieldCheckmark24" />
- <TextBlock Grid.Column="1" Text="{ext:Loc Optimizer.UI.Risk.Safe}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- Foreground="{DynamicResource SystemFillColorCautionBrush}"
- Symbol="Warning24" />
- <TextBlock Grid.Column="1" Text="{ext:Loc Optimizer.UI.Risk.Moderate}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Symbol="ShieldError24" />
- <TextBlock Grid.Column="1" Text="{ext:Loc Optimizer.UI.Risk.Risky}" />
- </Grid>
- </ComboBoxItem>
- </ComboBox>
+ <!-- Sort By -->
+ <ComboBox
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ SelectedIndex="{Binding ViewModel.SelectedSortByIndex}"
+ ToolTip="{ext:Loc Common.SortBy}"
+ ToolTipService.BetweenShowDelay="160"
+ ToolTipService.Placement="Top"
+ >
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,6,0" HorizontalAlignment="Left" Symbol="Filter24" />
+ <TextBlock Grid.Column="1" HorizontalAlignment="Left">
+ <Run Text="{ext:Loc Common.SortBy.Risk}" />
+ <Run Text=" &amp; " />
+ <Run Text="{ext:Loc Common.SortBy.Status}" />
+ </TextBlock>
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ HorizontalAlignment="Left"
+ Symbol="TextSortAscending24"
+ />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Name}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,6,0" HorizontalAlignment="Left" Symbol="Shield24" />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Risk}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,6,0" HorizontalAlignment="Left" Symbol="ToggleRight24" />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Status}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ </ComboBox>
- <!-- Sort By -->
- <ComboBox
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- SelectedIndex="{Binding ViewModel.SelectedSortByIndex}"
- ToolTip="{ext:Loc Common.SortBy}"
- ToolTipService.BetweenShowDelay="160"
- ToolTipService.Placement="Top">
+ <!-- Hide Applied toggle -->
+ <ToggleButton
+ Margin="0,0,0,0"
+ VerticalAlignment="Stretch"
+ IsChecked="{Binding ViewModel.HideApplied}"
+ Visibility="{Binding ViewModel.HasAppliedOptimizations, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon Margin="0,0,6,0" Symbol="EyeOff24" />
+ <TextBlock Text="{ext:Loc Optimizer.Menu.HideApplied}" />
+ </StackPanel>
+ </ToggleButton>
+ </WrapPanel>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="Filter24" />
- <TextBlock Grid.Column="1" HorizontalAlignment="Left">
- <Run Text="{ext:Loc Common.SortBy.Risk}" />
- <Run Text=" &amp; " />
- <Run Text="{ext:Loc Common.SortBy.Status}" />
- </TextBlock>
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="TextSortAscending24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Name}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="Shield24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Risk}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="ToggleRight24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Status}" />
- </Grid>
- </ComboBoxItem>
- </ComboBox>
+ <!-- No search results -->
+ <StackPanel
+ Grid.Row="1"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Visibility="{Binding ViewModel.Optimizations.Count, Converter={StaticResource ZeroToVisibilityConverter}}"
+ >
+ <ui:SymbolIcon
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ FontSize="36"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Symbol="SearchInfo24"
+ />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc Bloatware.Search.NoResults}"
+ />
+ </StackPanel>
- <!-- Hide Applied toggle -->
- <ToggleButton
- Margin="0,0,0,0"
- VerticalAlignment="Stretch"
- IsChecked="{Binding ViewModel.HideApplied}"
- Visibility="{Binding ViewModel.HasAppliedOptimizations, Converter={StaticResource BooleanToVisibilityConverter}}">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon Margin="0,0,6,0" Symbol="EyeOff24" />
- <TextBlock Text="{ext:Loc Optimizer.Menu.HideApplied}" />
- </StackPanel>
- </ToggleButton>
- </WrapPanel>
+ <!-- Optimization Cards -->
+ <ui:VirtualizingItemsControl
+ Grid.Row="1"
+ ItemsSource="{Binding ViewModel.Optimizations}"
+ Visibility="{Binding ViewModel.Optimizations.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}"
+ >
+ <ui:VirtualizingItemsControl.Template>
+ <ControlTemplate TargetType="ItemsControl">
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled">
+ <ItemsPresenter Margin="0,0,7,0" />
+ </ScrollViewer>
+ </ControlTemplate>
+ </ui:VirtualizingItemsControl.Template>
+ <ui:VirtualizingItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <UniformGrid
+ VerticalAlignment="Top"
+ Columns="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ScrollViewer}, Converter={StaticResource WidthToColumnConverter}}"
+ />
+ </ItemsPanelTemplate>
+ </ui:VirtualizingItemsControl.ItemsPanel>
+ <ui:VirtualizingItemsControl.ItemContainerStyle>
+ <Style TargetType="ContentPresenter">
+ <Setter Property="Margin" Value="5" />
+ <Setter Property="HorizontalAlignment" Value="Stretch" />
+ </Style>
+ </ui:VirtualizingItemsControl.ItemContainerStyle>
- <!-- No search results -->
- <StackPanel
- Grid.Row="1"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Visibility="{Binding ViewModel.Optimizations.Count, Converter={StaticResource ZeroToVisibilityConverter}}">
- <ui:SymbolIcon
- Margin="0,0,0,10"
- HorizontalAlignment="Center"
- FontSize="36"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Symbol="SearchInfo24" />
+ <ui:VirtualizingItemsControl.ItemTemplate>
+ <DataTemplate DataType="{x:Type optimization:BaseOptimization}">
+ <Border
+ Padding="20,10"
+ Background="{DynamicResource CardBackground}"
+ BorderBrush="{DynamicResource CardBorderBrush}"
+ BorderThickness="1"
+ CornerRadius="5"
+ >
+ <Grid RowDefinitions="Auto,Auto,Auto,Auto,*">
<ui:TextBlock
- HorizontalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc Bloatware.Search.NoResults}" />
- </StackPanel>
+ Grid.Row="0"
+ Appearance="Disabled"
+ FontTypography="Caption"
+ Text="{Binding Id}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Grid.Row="1"
+ FontTypography="Subtitle"
+ Text="{Binding Name}"
+ TextWrapping="Wrap"
+ />
- <!-- Optimization Cards -->
- <ui:VirtualizingItemsControl
- Grid.Row="1"
- ItemsSource="{Binding ViewModel.Optimizations}"
- Visibility="{Binding ViewModel.Optimizations.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">
- <ui:VirtualizingItemsControl.Template>
- <ControlTemplate TargetType="ItemsControl">
- <ScrollViewer HorizontalScrollBarVisibility="Disabled">
- <ItemsPresenter Margin="0,0,7,0" />
- </ScrollViewer>
- </ControlTemplate>
- </ui:VirtualizingItemsControl.Template>
- <ui:VirtualizingItemsControl.ItemsPanel>
+ <ui:VirtualizingItemsControl
+ Grid.Row="2"
+ Margin="0,2,0,2"
+ ItemsSource="{Binding TagDisplays}"
+ >
+ <ui:VirtualizingItemsControl.ItemsPanel>
<ItemsPanelTemplate>
- <UniformGrid VerticalAlignment="Top" Columns="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ScrollViewer}, Converter={StaticResource WidthToColumnConverter}}" />
+ <WrapPanel HorizontalAlignment="Left" VerticalAlignment="Top" />
</ItemsPanelTemplate>
- </ui:VirtualizingItemsControl.ItemsPanel>
- <ui:VirtualizingItemsControl.ItemContainerStyle>
+ </ui:VirtualizingItemsControl.ItemsPanel>
+ <ui:VirtualizingItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
- <Setter Property="Margin" Value="5" />
- <Setter Property="HorizontalAlignment" Value="Stretch" />
+ <Setter Property="Margin" Value="0,0,2,2" />
+ <Setter Property="HorizontalAlignment" Value="Left" />
</Style>
- </ui:VirtualizingItemsControl.ItemContainerStyle>
-
- <ui:VirtualizingItemsControl.ItemTemplate>
- <DataTemplate DataType="{x:Type optimization:BaseOptimization}">
- <Border
- Padding="20,10"
- Background="{DynamicResource CardBackground}"
- BorderBrush="{DynamicResource CardBorderBrush}"
- BorderThickness="1"
- CornerRadius="5">
- <Grid RowDefinitions="Auto,Auto,Auto,Auto,*">
- <ui:TextBlock
- Grid.Row="0"
- Appearance="Disabled"
- FontTypography="Caption"
- Text="{Binding Id}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Grid.Row="1"
- FontTypography="Subtitle"
- Text="{Binding Name}"
- TextWrapping="Wrap" />
-
- <ui:VirtualizingItemsControl
- Grid.Row="2"
- Margin="0,2,0,2"
- ItemsSource="{Binding TagDisplays}">
- <ui:VirtualizingItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel HorizontalAlignment="Left" VerticalAlignment="Top" />
- </ItemsPanelTemplate>
- </ui:VirtualizingItemsControl.ItemsPanel>
- <ui:VirtualizingItemsControl.ItemContainerStyle>
- <Style TargetType="ContentPresenter">
- <Setter Property="Margin" Value="0,0,2,2" />
- <Setter Property="HorizontalAlignment" Value="Left" />
- </Style>
- </ui:VirtualizingItemsControl.ItemContainerStyle>
- <ui:VirtualizingItemsControl.ItemTemplate>
- <DataTemplate>
- <Border
- Padding="4,2"
- HorizontalAlignment="Left"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="5">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,5,0"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Symbol="{Binding Icon}" />
+ </ui:VirtualizingItemsControl.ItemContainerStyle>
+ <ui:VirtualizingItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border
+ Padding="4,2"
+ HorizontalAlignment="Left"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="5"
+ >
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Margin="0,0,5,0"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Symbol="{Binding Icon}"
+ />
- <ui:TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text="{Binding Display}"
- TextWrapping="Wrap" />
- </StackPanel>
- </Border>
- </DataTemplate>
- </ui:VirtualizingItemsControl.ItemTemplate>
- </ui:VirtualizingItemsControl>
-
- <ui:TextBlock
- Grid.Row="3"
- Margin="0,10,0,0"
- FontTypography="Body"
- Text="{Binding ShortDescription}"
- TextTrimming="WordEllipsis"
- TextWrapping="Wrap" />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Text="{Binding Display}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </Border>
+ </DataTemplate>
+ </ui:VirtualizingItemsControl.ItemTemplate>
+ </ui:VirtualizingItemsControl>
- <Grid
- Grid.Row="4"
- Margin="0,10,0,0"
- VerticalAlignment="Bottom"
- ColumnDefinitions="*,Auto">
- <Grid RowDefinitions="Auto,Auto">
- <Border
- Padding="4,2"
- HorizontalAlignment="Left"
- CornerRadius="5">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding Risk}" Value="Moderate">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding Risk}" Value="Risky">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,5,0"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Symbol="{Binding RiskVisual.Icon}" />
+ <ui:TextBlock
+ Grid.Row="3"
+ Margin="0,10,0,0"
+ FontTypography="Body"
+ Text="{Binding ShortDescription}"
+ TextTrimming="WordEllipsis"
+ TextWrapping="Wrap"
+ />
- <ui:TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorInverseBrush}"
- Text="{Binding RiskVisual.Display}"
- TextWrapping="Wrap" />
- </StackPanel>
- </Border>
+ <Grid
+ Grid.Row="4"
+ Margin="0,10,0,0"
+ VerticalAlignment="Bottom"
+ ColumnDefinitions="*,Auto"
+ >
+ <Grid RowDefinitions="Auto,Auto">
+ <Border Padding="4,2" HorizontalAlignment="Left" CornerRadius="5">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource SystemFillColorSuccessBrush}"
+ />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Risk}" Value="Moderate">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource SystemFillColorCautionBrush}"
+ />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Risk}" Value="Risky">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource SystemFillColorCriticalBrush}"
+ />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Margin="0,0,5,0"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Symbol="{Binding RiskVisual.Icon}"
+ />
- <Border
- Grid.Row="1"
- Margin="0,5,0,0"
- Padding="4,2"
- HorizontalAlignment="Left"
- Background="{DynamicResource CardBackgroundDisabled}"
- CornerRadius="5"
- ToolTip="{Binding State.AppliedAt}"
- ToolTipService.InitialShowDelay="150"
- ToolTipService.Placement="Top"
- Visibility="{Binding State.AppliedAt, Converter={StaticResource NullToVisibilityConverter}}">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon Margin="0,0,6,0" Symbol="CheckmarkCircle24" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontTypography="Caption"
- Text="{Binding State.RelativeTime}"
- TextWrapping="Wrap" />
- </StackPanel>
- </Border>
- </Grid>
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Text="{Binding RiskVisual.Display}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </Border>
- <StackPanel
- Grid.Column="1"
- Margin="10,0,0,0"
- VerticalAlignment="Bottom"
- Orientation="Horizontal">
- <ui:ToggleSwitch
- Margin="0,0,5,0"
- HorizontalAlignment="Right"
- VerticalAlignment="Center"
- Command="{Binding DataContext.ViewModel.ToggleOptimizationCommand, RelativeSource={RelativeSource AncestorType=Page}}"
- CommandParameter="{Binding}"
- Cursor="Hand"
- IsChecked="{Binding State.IsApplied, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- <ui:Button
- HorizontalAlignment="Right"
- VerticalAlignment="Bottom"
- Background="Transparent"
- BorderBrush="Transparent"
- Command="{Binding DataContext.ViewModel.ViewSourceOnGitHubCommand, RelativeSource={RelativeSource AncestorType=Page}}"
- CommandParameter="{Binding}"
- Cursor="Hand"
- Icon="{ui:SymbolIcon Open24}"
- ToolTip="{ext:Loc Optimizer.Menu.ViewSource}" />
- <ui:Button
- HorizontalAlignment="Right"
- VerticalAlignment="Bottom"
- Background="Transparent"
- BorderBrush="Transparent"
- Command="{Binding DataContext.ViewModel.ShowDetailsCommand, RelativeSource={RelativeSource AncestorType=Page}}"
- CommandParameter="{Binding}"
- Cursor="Hand"
- Icon="{ui:SymbolIcon MoreVertical24}" />
- </StackPanel>
- </Grid>
- </Grid>
- </Border>
- </DataTemplate>
- </ui:VirtualizingItemsControl.ItemTemplate>
- </ui:VirtualizingItemsControl>
- </Grid>
+ <Border
+ Grid.Row="1"
+ Margin="0,5,0,0"
+ Padding="4,2"
+ HorizontalAlignment="Left"
+ Background="{DynamicResource CardBackgroundDisabled}"
+ CornerRadius="5"
+ ToolTip="{Binding State.AppliedAt}"
+ ToolTipService.InitialShowDelay="150"
+ ToolTipService.Placement="Top"
+ Visibility="{Binding State.AppliedAt, Converter={StaticResource NullToVisibilityConverter}}"
+ >
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon Margin="0,0,6,0" Symbol="CheckmarkCircle24" />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ FontTypography="Caption"
+ Text="{Binding State.RelativeTime}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </Border>
+ </Grid>
- <!-- Loading Indicator -->
- <Border Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Width="48"
- Height="48"
- Margin="0,0,0,16"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsIndeterminate="True" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc Optimizations.Loading}" />
- <ui:TextBlock
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc Optimizations.Loading.Hint}" />
- </StackPanel>
- </Border>
+ <StackPanel
+ Grid.Column="1"
+ Margin="10,0,0,0"
+ VerticalAlignment="Bottom"
+ Orientation="Horizontal"
+ >
+ <ui:ToggleSwitch
+ Margin="0,0,5,0"
+ HorizontalAlignment="Right"
+ VerticalAlignment="Center"
+ Command="{Binding DataContext.ViewModel.ToggleOptimizationCommand, RelativeSource={RelativeSource AncestorType=Page}}"
+ CommandParameter="{Binding}"
+ Cursor="Hand"
+ IsChecked="{Binding State.IsApplied, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+ />
+ <ui:Button
+ HorizontalAlignment="Right"
+ VerticalAlignment="Bottom"
+ Background="Transparent"
+ BorderBrush="Transparent"
+ Command="{Binding DataContext.ViewModel.ViewSourceOnGitHubCommand, RelativeSource={RelativeSource AncestorType=Page}}"
+ CommandParameter="{Binding}"
+ Cursor="Hand"
+ Icon="{ui:SymbolIcon Open24}"
+ ToolTip="{ext:Loc Optimizer.Menu.ViewSource}"
+ />
+ <ui:Button
+ HorizontalAlignment="Right"
+ VerticalAlignment="Bottom"
+ Background="Transparent"
+ BorderBrush="Transparent"
+ Command="{Binding DataContext.ViewModel.ShowDetailsCommand, RelativeSource={RelativeSource AncestorType=Page}}"
+ CommandParameter="{Binding}"
+ Cursor="Hand"
+ Icon="{ui:SymbolIcon MoreVertical24}"
+ />
+ </StackPanel>
+ </Grid>
+ </Grid>
+ </Border>
+ </DataTemplate>
+ </ui:VirtualizingItemsControl.ItemTemplate>
+ </ui:VirtualizingItemsControl>
</Grid>
-</Page>
\ No newline at end of file
+
+ <!-- Loading Indicator -->
+ <Border Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+ <ui:ProgressRing
+ Width="48"
+ Height="48"
+ Margin="0,0,0,16"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsIndeterminate="True"
+ />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Optimizations.Loading}"
+ />
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc Optimizations.Loading.Hint}"
+ />
+ </StackPanel>
+ </Border>
+ </Grid>
+</Page>
diff --git a/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml.cs b/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml.cs
index 257ecd1..28529ac 100644
--- a/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml.cs
+++ b/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPage.xaml.cs
@@ -14,4 +14,4 @@ public partial class OptimizationPage : INavigableView<OptimizationCategoryViewM
}
public OptimizationCategoryViewModel ViewModel { get; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPages.cs b/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPages.cs
index 4ef933d..437948f 100644
--- a/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPages.cs
+++ b/optimizerDuck/UI/Pages/Optimize/Categories/OptimizationPages.cs
@@ -4,7 +4,8 @@ namespace optimizerDuck.UI.Pages.Optimizations;
public sealed class PowerManagementOptimizerPage : OptimizationPage
{
- public PowerManagementOptimizerPage(OptimizationCategoryViewModel viewModel) : base(viewModel)
+ public PowerManagementOptimizerPage(OptimizationCategoryViewModel viewModel)
+ : base(viewModel)
{
InitializeComponent();
}
@@ -12,7 +13,8 @@ public sealed class PowerManagementOptimizerPage : OptimizationPage
public sealed class UserExperienceOptimizerPage : OptimizationPage
{
- public UserExperienceOptimizerPage(OptimizationCategoryViewModel viewModel) : base(viewModel)
+ public UserExperienceOptimizerPage(OptimizationCategoryViewModel viewModel)
+ : base(viewModel)
{
InitializeComponent();
}
@@ -20,7 +22,8 @@ public sealed class UserExperienceOptimizerPage : OptimizationPage
public sealed class BloatwareAndServicesOptimizerPage : OptimizationPage
{
- public BloatwareAndServicesOptimizerPage(OptimizationCategoryViewModel viewModel) : base(viewModel)
+ public BloatwareAndServicesOptimizerPage(OptimizationCategoryViewModel viewModel)
+ : base(viewModel)
{
InitializeComponent();
}
@@ -28,7 +31,8 @@ public sealed class BloatwareAndServicesOptimizerPage : OptimizationPage
public sealed class GpuOptimizerPage : OptimizationPage
{
- public GpuOptimizerPage(OptimizationCategoryViewModel viewModel) : base(viewModel)
+ public GpuOptimizerPage(OptimizationCategoryViewModel viewModel)
+ : base(viewModel)
{
InitializeComponent();
}
@@ -36,7 +40,8 @@ public sealed class GpuOptimizerPage : OptimizationPage
public sealed class PerformanceOptimizerPage : OptimizationPage
{
- public PerformanceOptimizerPage(OptimizationCategoryViewModel viewModel) : base(viewModel)
+ public PerformanceOptimizerPage(OptimizationCategoryViewModel viewModel)
+ : base(viewModel)
{
InitializeComponent();
}
@@ -44,8 +49,9 @@ public sealed class PerformanceOptimizerPage : OptimizationPage
public sealed class SecurityAndPrivacyOptimizerPage : OptimizationPage
{
- public SecurityAndPrivacyOptimizerPage(OptimizationCategoryViewModel viewModel) : base(viewModel)
+ public SecurityAndPrivacyOptimizerPage(OptimizationCategoryViewModel viewModel)
+ : base(viewModel)
{
InitializeComponent();
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Pages/Optimize/OptimizePage.xaml b/optimizerDuck/UI/Pages/Optimize/OptimizePage.xaml
index 2207817..4c125cf 100644
--- a/optimizerDuck/UI/Pages/Optimize/OptimizePage.xaml
+++ b/optimizerDuck/UI/Pages/Optimize/OptimizePage.xaml
@@ -1,32 +1,34 @@
<Page
- Foreground="{DynamicResource TextFillColorPrimaryBrush}"
- Margin="0,32,0,0"
- ScrollViewer.CanContentScroll="False"
- Title="OptimizerPage"
- d:DataContext="{d:DesignInstance pages:OptimizePage}"
- d:DesignHeight="650"
- d:DesignWidth="800"
- mc:Ignorable="d"
- ui:Design.Background="Black"
- ui:Design.Foreground="White"
- x:Class="optimizerDuck.UI.Pages.OptimizePage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:pages="clr-namespace:optimizerDuck.UI.Pages"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
- <Grid>
- <ui:NavigationView
- FrameMargin="0"
- IsBackButtonVisible="Collapsed"
- IsFooterSeparatorVisible="False"
- IsPaneToggleVisible="False"
- IsTopSeparatorVisible="False"
- Margin="0"
- MenuItemsSource="{Binding ViewModel.OptimizationCategories}"
- Padding="42,0,42,0"
- PaneDisplayMode="Top"
- x:Name="RootNavigation" />
- </Grid>
-</Page>
\ No newline at end of file
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ Margin="0,32,0,0"
+ ScrollViewer.CanContentScroll="False"
+ Title="OptimizerPage"
+ d:DataContext="{d:DesignInstance pages:OptimizePage}"
+ d:DesignHeight="650"
+ d:DesignWidth="800"
+ mc:Ignorable="d"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ x:Class="optimizerDuck.UI.Pages.OptimizePage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:pages="clr-namespace:optimizerDuck.UI.Pages"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <Grid>
+ <ui:NavigationView
+ FrameMargin="0"
+ IsBackButtonVisible="Collapsed"
+ IsFooterSeparatorVisible="False"
+ IsPaneToggleVisible="False"
+ IsTopSeparatorVisible="False"
+ Margin="0"
+ MenuItemsSource="{Binding ViewModel.OptimizationCategories}"
+ Padding="42,0,42,0"
+ PaneDisplayMode="Top"
+ x:Name="RootNavigation"
+ />
+ </Grid>
+</Page>
diff --git a/optimizerDuck/UI/Pages/Optimize/OptimizePage.xaml.cs b/optimizerDuck/UI/Pages/Optimize/OptimizePage.xaml.cs
index 36b8aeb..9f8d595 100644
--- a/optimizerDuck/UI/Pages/Optimize/OptimizePage.xaml.cs
+++ b/optimizerDuck/UI/Pages/Optimize/OptimizePage.xaml.cs
@@ -22,11 +22,14 @@ public partial class OptimizePage : INavigableView<OptimizeViewModel>
private void OnOptimizationsLoaded()
{
- Dispatcher.BeginInvoke(() =>
- {
- var first = ViewModel.OptimizationCategories.FirstOrDefault();
- if (first?.TargetPageType != null)
- RootNavigation.Navigate(first.TargetPageType);
- }, DispatcherPriority.ContextIdle);
+ Dispatcher.BeginInvoke(
+ () =>
+ {
+ var first = ViewModel.OptimizationCategories.FirstOrDefault();
+ if (first?.TargetPageType != null)
+ RootNavigation.Navigate(first.TargetPageType);
+ },
+ DispatcherPriority.ContextIdle
+ );
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml b/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml
index 22b3545..9feaab2 100644
--- a/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml
+++ b/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml
@@ -1,427 +1,464 @@
<Page
- x:Class="optimizerDuck.UI.Pages.ScheduledTasksPage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:local="clr-namespace:optimizerDuck.UI.Pages"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:scheduledTask="clr-namespace:optimizerDuck.Domain.Optimizations.Models.ScheduledTask"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- Title="ScheduledTasksPage"
- Margin="0,32,0,0"
- d:DataContext="{d:DesignInstance local:ScheduledTasksPage}"
- d:DesignHeight="1200"
- d:DesignWidth="800"
- ui:Design.Background="Black"
- ui:Design.Foreground="White"
- Foreground="{DynamicResource TextFillColorPrimaryBrush}"
- ScrollViewer.CanContentScroll="False"
- mc:Ignorable="d">
+ x:Class="optimizerDuck.UI.Pages.ScheduledTasksPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:local="clr-namespace:optimizerDuck.UI.Pages"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:scheduledTask="clr-namespace:optimizerDuck.Domain.Optimizations.Models.ScheduledTask"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ Title="ScheduledTasksPage"
+ Margin="0,32,0,0"
+ d:DataContext="{d:DesignInstance local:ScheduledTasksPage}"
+ d:DesignHeight="1200"
+ d:DesignWidth="800"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ ScrollViewer.CanContentScroll="False"
+ mc:Ignorable="d"
+>
+ <Page.Resources>
+ <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
+ <BooleanToVisibilityConverter x:Key="WpfBoolToVis" />
+ <converters:ZeroToVisibilityConverter x:Key="ZeroToVisibilityConverter" />
+ <converters:GreaterThanZeroToVisibilityConverter x:Key="GreaterThanZeroToVisibilityConverter" />
+ </Page.Resources>
- <Page.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
- <BooleanToVisibilityConverter x:Key="WpfBoolToVis" />
- <converters:ZeroToVisibilityConverter x:Key="ZeroToVisibilityConverter" />
- <converters:GreaterThanZeroToVisibilityConverter x:Key="GreaterThanZeroToVisibilityConverter" />
- </Page.Resources>
-
- <Grid RowDefinitions="Auto, *">
- <!-- Header -->
- <StackPanel Margin="0,0,0,20">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
- <StackPanel Grid.Column="0">
- <ui:TextBlock FontTypography="Title" Text="{ext:Loc ScheduledTasks.Header.Title}" />
- <ui:TextBlock
- Margin="0,4,0,0"
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc ScheduledTasks.Header.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- <WrapPanel
- Grid.Column="1"
- VerticalAlignment="Center"
- Orientation="Horizontal">
- <ui:Button
- Margin="0,0,8,0"
- Appearance="Secondary"
- Command="{Binding ViewModel.OpenTaskSchedulerCommand}"
- Content="{ext:Loc ScheduledTasks.Menu.OpenSettings}"
- Icon="{ui:SymbolIcon Settings24,
- FontSize=18}" />
- <ui:Button
- Appearance="Primary"
- Command="{Binding ViewModel.RefreshCommand}"
- Content="{ext:Loc StartupManager.Menu.Refresh}"
- Icon="{ui:SymbolIcon ArrowClockwise24,
- FontSize=18}" />
- </WrapPanel>
- </Grid>
+ <Grid RowDefinitions="Auto, *">
+ <!-- Header -->
+ <StackPanel Margin="0,0,0,20">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <StackPanel Grid.Column="0">
+ <ui:TextBlock FontTypography="Title" Text="{ext:Loc ScheduledTasks.Header.Title}" />
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc ScheduledTasks.Header.Description}"
+ TextWrapping="Wrap"
+ />
</StackPanel>
+ <WrapPanel Grid.Column="1" VerticalAlignment="Center" Orientation="Horizontal">
+ <ui:Button
+ Margin="0,0,8,0"
+ Appearance="Secondary"
+ Command="{Binding ViewModel.OpenTaskSchedulerCommand}"
+ Content="{ext:Loc ScheduledTasks.Menu.OpenSettings}"
+ Icon="{ui:SymbolIcon Settings24,
+ FontSize=18}"
+ />
+ <ui:Button
+ Appearance="Primary"
+ Command="{Binding ViewModel.RefreshCommand}"
+ Content="{ext:Loc StartupManager.Menu.Refresh}"
+ Icon="{ui:SymbolIcon ArrowClockwise24,
+ FontSize=18}"
+ />
+ </WrapPanel>
+ </Grid>
+ </StackPanel>
- <!-- Loading Indicator -->
- <Border Grid.Row="1" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Width="48"
- Height="48"
- Margin="0,0,0,16"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsIndeterminate="True" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc ScheduledTasks.Loading}" />
- <ui:TextBlock
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc ScheduledTasks.Loading.Hint}" />
- </StackPanel>
- </Border>
-
- <!-- Main Content -->
- <Grid Grid.Row="1">
- <Grid.Style>
- <Style TargetType="Grid">
- <Setter Property="Visibility" Value="Collapsed" />
- <Style.Triggers>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding ViewModel.IsNotLoading}" Value="True" />
- <Condition Binding="{Binding ViewModel.IsLoading}" Value="False" />
- </MultiDataTrigger.Conditions>
- <Setter Property="Visibility" Value="Visible" />
- </MultiDataTrigger>
- </Style.Triggers>
- </Style>
- </Grid.Style>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <!-- Toolbar -->
- <WrapPanel
- Grid.Row="0"
- Margin="0,0,16,12"
- Orientation="Horizontal">
- <!-- Search -->
- <ui:TextBox
- MinWidth="200"
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- Icon="{ui:SymbolIcon Search24}"
- PlaceholderText="{ext:Loc Common.Search.Placeholder}"
- Text="{Binding ViewModel.SearchText, UpdateSourceTrigger=PropertyChanged}" />
+ <!-- Loading Indicator -->
+ <Border
+ Grid.Row="1"
+ Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+ <ui:ProgressRing
+ Width="48"
+ Height="48"
+ Margin="0,0,0,16"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsIndeterminate="True"
+ />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc ScheduledTasks.Loading}"
+ />
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc ScheduledTasks.Loading.Hint}"
+ />
+ </StackPanel>
+ </Border>
- <!-- Sort By -->
- <ComboBox
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- SelectedIndex="{Binding ViewModel.SortByIndex}"
- ToolTip="{ext:Loc Common.SortBy}">
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="TextSortAscending24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Name}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="ToggleRight24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Status}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="Folder24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Path}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="Flash24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.State}" />
- </Grid>
- </ComboBoxItem>
- </ComboBox>
+ <!-- Main Content -->
+ <Grid Grid.Row="1">
+ <Grid.Style>
+ <Style TargetType="Grid">
+ <Setter Property="Visibility" Value="Collapsed" />
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding ViewModel.IsNotLoading}" Value="True" />
+ <Condition Binding="{Binding ViewModel.IsLoading}" Value="False" />
+ </MultiDataTrigger.Conditions>
+ <Setter Property="Visibility" Value="Visible" />
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Grid.Style>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+ <!-- Toolbar -->
+ <WrapPanel Grid.Row="0" Margin="0,0,16,12" Orientation="Horizontal">
+ <!-- Search -->
+ <ui:TextBox
+ MinWidth="200"
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ Icon="{ui:SymbolIcon Search24}"
+ PlaceholderText="{ext:Loc Common.Search.Placeholder}"
+ Text="{Binding ViewModel.SearchText, UpdateSourceTrigger=PropertyChanged}"
+ />
- <!-- Hide Microsoft -->
- <ui:ToggleSwitch
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- Cursor="Hand"
- IsChecked="{Binding ViewModel.HideMicrosoftTasks, Mode=TwoWay}"
- OffContent="{ext:Loc ScheduledTasks.HideMicrosoft}"
- OnContent="{ext:Loc ScheduledTasks.HideMicrosoft}" />
- </WrapPanel>
+ <!-- Sort By -->
+ <ComboBox
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ SelectedIndex="{Binding ViewModel.SortByIndex}"
+ ToolTip="{ext:Loc Common.SortBy}"
+ >
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ HorizontalAlignment="Left"
+ Symbol="TextSortAscending24"
+ />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Name}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,6,0" HorizontalAlignment="Left" Symbol="ToggleRight24" />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Status}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,6,0" HorizontalAlignment="Left" Symbol="Folder24" />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Path}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon Margin="0,0,6,0" HorizontalAlignment="Left" Symbol="Flash24" />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.State}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ </ComboBox>
- <!-- No search results -->
- <StackPanel
- Grid.Row="1"
- Margin="0,64,0,32"
- HorizontalAlignment="Center"
- VerticalAlignment="Top"
- Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource ZeroToVisibilityConverter}}">
- <ui:SymbolIcon
- Margin="0,0,0,10"
- HorizontalAlignment="Center"
- FontSize="36"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Symbol="SearchInfo24" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc Bloatware.Search.NoResults}" />
- </StackPanel>
+ <!-- Hide Microsoft -->
+ <ui:ToggleSwitch
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ Cursor="Hand"
+ IsChecked="{Binding ViewModel.HideMicrosoftTasks, Mode=TwoWay}"
+ OffContent="{ext:Loc ScheduledTasks.HideMicrosoft}"
+ OnContent="{ext:Loc ScheduledTasks.HideMicrosoft}"
+ />
+ </WrapPanel>
- <!-- Task List -->
- <ScrollViewer Grid.Row="1" Margin="0,0,0,0">
- <ItemsControl ItemsSource="{Binding ViewModel.Tasks}" Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">
- <ItemsControl.ItemTemplate>
- <DataTemplate DataType="{x:Type scheduledTask:ScheduledTaskModel}">
- <Border
- Margin="0,0,16,6"
- Padding="16,12"
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- CornerRadius="6">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
+ <!-- No search results -->
+ <StackPanel
+ Grid.Row="1"
+ Margin="0,64,0,32"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Top"
+ Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource ZeroToVisibilityConverter}}"
+ >
+ <ui:SymbolIcon
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ FontSize="36"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Symbol="SearchInfo24"
+ />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc Bloatware.Search.NoResults}"
+ />
+ </StackPanel>
- <!-- Task Logo -->
- <Image
- Grid.Column="0"
- Width="36"
- Height="36"
- Margin="0,0,12,0"
- VerticalAlignment="Center"
- Source="{Binding LogoImage}"
- Stretch="UniformToFill" />
+ <!-- Task List -->
+ <ScrollViewer Grid.Row="1" Margin="0,0,0,0">
+ <ItemsControl
+ ItemsSource="{Binding ViewModel.Tasks}"
+ Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}"
+ >
+ <ItemsControl.ItemTemplate>
+ <DataTemplate DataType="{x:Type scheduledTask:ScheduledTaskModel}">
+ <Border
+ Margin="0,0,16,6"
+ Padding="16,12"
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ CornerRadius="6"
+ >
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
- <!-- Task info -->
- <StackPanel
- Grid.Column="1"
- Margin="0,0,12,0"
- VerticalAlignment="Center">
+ <!-- Task Logo -->
+ <Image
+ Grid.Column="0"
+ Width="36"
+ Height="36"
+ Margin="0,0,12,0"
+ VerticalAlignment="Center"
+ Source="{Binding LogoImage}"
+ Stretch="UniformToFill"
+ />
- <!-- Row 1: Name + State badge -->
- <DockPanel LastChildFill="False">
- <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />
- <Border
- Margin="8,0,0,0"
- Padding="6,1"
- VerticalAlignment="Center"
- CornerRadius="4">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Background" Value="{DynamicResource CardBackgroundFillColorSecondaryBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsReady}" Value="True">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsRunning}" Value="True">
- <Setter Property="Background" Value="{DynamicResource AccentButtonBackground}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsDisabledState}" Value="True">
- <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- x:Name="StateIcon"
- Margin="0,0,4,0"
- FontSize="10">
- <ui:SymbolIcon.Style>
- <Style TargetType="ui:SymbolIcon">
- <Setter Property="Symbol" Value="Circle24" />
- <Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsReady}" Value="True">
- <Setter Property="Symbol" Value="CheckmarkCircle24" />
- <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsRunning}" Value="True">
- <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
- <Setter Property="Symbol" Value="Play24" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsDisabledState}" Value="True">
- <Setter Property="Symbol" Value="Dismiss24" />
- <Setter Property="Foreground" Value="{DynamicResource TextFillColorInverseBrush}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ui:SymbolIcon.Style>
- </ui:SymbolIcon>
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{Binding ElementName=StateIcon, Path=Foreground}"
- Text="{Binding State}" />
- </StackPanel>
- </Border>
- </DockPanel>
+ <!-- Task info -->
+ <StackPanel Grid.Column="1" Margin="0,0,12,0" VerticalAlignment="Center">
+ <!-- Row 1: Name + State badge -->
+ <DockPanel LastChildFill="False">
+ <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />
+ <Border
+ Margin="8,0,0,0"
+ Padding="6,1"
+ VerticalAlignment="Center"
+ CornerRadius="4"
+ >
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsReady}" Value="True">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource SystemFillColorSuccessBrush}"
+ />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsRunning}" Value="True">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource AccentButtonBackground}"
+ />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsDisabledState}" Value="True">
+ <Setter
+ Property="Background"
+ Value="{DynamicResource SystemFillColorCriticalBrush}"
+ />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon x:Name="StateIcon" Margin="0,0,4,0" FontSize="10">
+ <ui:SymbolIcon.Style>
+ <Style TargetType="ui:SymbolIcon">
+ <Setter Property="Symbol" Value="Circle24" />
+ <Setter
+ Property="Foreground"
+ Value="{DynamicResource TextFillColorPrimaryBrush}"
+ />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsReady}" Value="True">
+ <Setter Property="Symbol" Value="CheckmarkCircle24" />
+ <Setter
+ Property="Foreground"
+ Value="{DynamicResource TextFillColorInverseBrush}"
+ />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsRunning}" Value="True">
+ <Setter
+ Property="Foreground"
+ Value="{DynamicResource TextFillColorInverseBrush}"
+ />
+ <Setter Property="Symbol" Value="Play24" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsDisabledState}" Value="True">
+ <Setter Property="Symbol" Value="Dismiss24" />
+ <Setter
+ Property="Foreground"
+ Value="{DynamicResource TextFillColorInverseBrush}"
+ />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ui:SymbolIcon.Style>
+ </ui:SymbolIcon>
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ FontTypography="Caption"
+ Foreground="{Binding ElementName=StateIcon, Path=Foreground}"
+ Text="{Binding State}"
+ />
+ </StackPanel>
+ </Border>
+ </DockPanel>
- <!-- Row 2: Description -->
- <ui:TextBlock
- Margin="0,4,0,0"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{Binding Description}"
- TextWrapping="Wrap" />
+ <!-- Row 2: Description -->
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{Binding Description}"
+ TextWrapping="Wrap"
+ />
- <!-- Row 3: Path -->
- <ui:TextBlock
- Margin="0,2,0,0"
- Appearance="Disabled"
- FontTypography="Caption"
- Text="{Binding FullPath}" />
+ <!-- Row 3: Path -->
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ Appearance="Disabled"
+ FontTypography="Caption"
+ Text="{Binding FullPath}"
+ />
- <!-- Row 4: Trigger badges -->
- <ItemsControl Margin="0,4,0,0" ItemsSource="{Binding TriggerTypes}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border
- Margin="0,0,4,2"
- Padding="6,2"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,4,0"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Symbol="Timer24" />
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{Binding}" />
- </StackPanel>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
+ <!-- Row 4: Trigger badges -->
+ <ItemsControl Margin="0,4,0,0" ItemsSource="{Binding TriggerTypes}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel Orientation="Horizontal" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border
+ Margin="0,0,4,2"
+ Padding="6,2"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ >
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Margin="0,0,4,0"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Symbol="Timer24"
+ />
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Text="{Binding}"
+ />
+ </StackPanel>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
- <!-- Row 5: Action summary -->
- <ui:TextBlock
- Margin="0,2,0,0"
- Appearance="Disabled"
- FontTypography="Caption"
- Text="{Binding ActionSummary}"
- TextTrimming="CharacterEllipsis" />
- </StackPanel>
+ <!-- Row 5: Action summary -->
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ Appearance="Disabled"
+ FontTypography="Caption"
+ Text="{Binding ActionSummary}"
+ TextTrimming="CharacterEllipsis"
+ />
+ </StackPanel>
- <!-- Actions -->
- <StackPanel
- Grid.Column="2"
- VerticalAlignment="Center"
- Orientation="Horizontal">
- <ui:Button
- Margin="0,0,4,0"
- Padding="8"
- Appearance="Transparent"
- Command="{Binding DataContext.ViewModel.ViewDetailsCommand, RelativeSource={RelativeSource AncestorType=Page}}"
- CommandParameter="{Binding}"
- Icon="{ui:SymbolIcon Info24,
+ <!-- Actions -->
+ <StackPanel Grid.Column="2" VerticalAlignment="Center" Orientation="Horizontal">
+ <ui:Button
+ Margin="0,0,4,0"
+ Padding="8"
+ Appearance="Transparent"
+ Command="{Binding DataContext.ViewModel.ViewDetailsCommand, RelativeSource={RelativeSource AncestorType=Page}}"
+ CommandParameter="{Binding}"
+ Icon="{ui:SymbolIcon Info24,
FontSize=16}"
- ToolTip="{ext:Loc ScheduledTasks.Action.Details}" />
- <!-- Run: visible only when not running -->
- <ui:Button
- Margin="0,0,4,0"
- Padding="8"
- Appearance="Transparent"
- Command="{Binding DataContext.ViewModel.RunTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"
- CommandParameter="{Binding}"
- Icon="{ui:SymbolIcon Play24,
+ ToolTip="{ext:Loc ScheduledTasks.Action.Details}"
+ />
+ <!-- Run: visible only when not running -->
+ <ui:Button
+ Margin="0,0,4,0"
+ Padding="8"
+ Appearance="Transparent"
+ Command="{Binding DataContext.ViewModel.RunTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"
+ CommandParameter="{Binding}"
+ Icon="{ui:SymbolIcon Play24,
FontSize=16}"
- ToolTip="{ext:Loc ScheduledTasks.Action.Run}">
- <ui:Button.Style>
- <Style BasedOn="{StaticResource {x:Type ui:Button}}" TargetType="ui:Button">
- <Setter Property="Visibility" Value="Visible" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsRunning}" Value="True">
- <Setter Property="Visibility" Value="Collapsed" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ui:Button.Style>
- </ui:Button>
- <!-- Stop: visible only when running -->
- <ui:Button
- Margin="0,0,4,0"
- Padding="8"
- Appearance="Transparent"
- Command="{Binding DataContext.ViewModel.StopTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"
- CommandParameter="{Binding}"
- Icon="{ui:SymbolIcon Stop24,
+ ToolTip="{ext:Loc ScheduledTasks.Action.Run}"
+ >
+ <ui:Button.Style>
+ <Style BasedOn="{StaticResource {x:Type ui:Button}}" TargetType="ui:Button">
+ <Setter Property="Visibility" Value="Visible" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsRunning}" Value="True">
+ <Setter Property="Visibility" Value="Collapsed" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ui:Button.Style>
+ </ui:Button>
+ <!-- Stop: visible only when running -->
+ <ui:Button
+ Margin="0,0,4,0"
+ Padding="8"
+ Appearance="Transparent"
+ Command="{Binding DataContext.ViewModel.StopTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"
+ CommandParameter="{Binding}"
+ Icon="{ui:SymbolIcon Stop24,
FontSize=16}"
- ToolTip="{ext:Loc ScheduledTasks.Action.Stop}"
- Visibility="{Binding IsRunning, Converter={StaticResource WpfBoolToVis}}" />
- <ui:Button
- Margin="0,0,8,0"
- Padding="8"
- Appearance="Transparent"
- Command="{Binding DataContext.ViewModel.DeleteTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"
- CommandParameter="{Binding}"
- Icon="{ui:SymbolIcon Delete24,
+ ToolTip="{ext:Loc ScheduledTasks.Action.Stop}"
+ Visibility="{Binding IsRunning, Converter={StaticResource WpfBoolToVis}}"
+ />
+ <ui:Button
+ Margin="0,0,8,0"
+ Padding="8"
+ Appearance="Transparent"
+ Command="{Binding DataContext.ViewModel.DeleteTaskCommand, RelativeSource={RelativeSource AncestorType=Page}}"
+ CommandParameter="{Binding}"
+ Icon="{ui:SymbolIcon Delete24,
FontSize=16}"
- ToolTip="{ext:Loc ScheduledTasks.Action.Delete}" />
- <ui:ToggleSwitch
- VerticalAlignment="Center"
- Cursor="Hand"
- IsChecked="{Binding IsEnabled, Mode=TwoWay}"
- OffContent="{ext:Loc Common.Toggle.Off}"
- OnContent="{ext:Loc Common.Toggle.On}" />
- </StackPanel>
- </Grid>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
- </Grid>
+ ToolTip="{ext:Loc ScheduledTasks.Action.Delete}"
+ />
+ <ui:ToggleSwitch
+ VerticalAlignment="Center"
+ Cursor="Hand"
+ IsChecked="{Binding IsEnabled, Mode=TwoWay}"
+ OffContent="{ext:Loc Common.Toggle.Off}"
+ OnContent="{ext:Loc Common.Toggle.On}"
+ />
+ </StackPanel>
+ </Grid>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
</Grid>
-</Page>
\ No newline at end of file
+ </Grid>
+</Page>
diff --git a/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml.cs b/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml.cs
index ac56132..1bc93c9 100644
--- a/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml.cs
+++ b/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml.cs
@@ -13,4 +13,4 @@ public partial class ScheduledTasksPage : INavigableView<ScheduledTasksViewModel
}
public ScheduledTasksViewModel ViewModel { get; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Pages/SettingsPage.xaml b/optimizerDuck/UI/Pages/SettingsPage.xaml
index 4ea7a02..504660f 100644
--- a/optimizerDuck/UI/Pages/SettingsPage.xaml
+++ b/optimizerDuck/UI/Pages/SettingsPage.xaml
@@ -1,330 +1,387 @@
<Page
- x:Class="optimizerDuck.UI.Pages.SettingsPage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:pages="clr-namespace:optimizerDuck.UI.Pages"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- Title="SettingsPage"
- Margin="0,32,0,0"
- d:DataContext="{d:DesignInstance pages:SettingsPage}"
- d:DesignHeight="1200"
- d:DesignWidth="800"
- ui:Design.Background="Black"
- ui:Design.Foreground="White"
- Foreground="{DynamicResource TextFillColorPrimaryBrush}"
- mc:Ignorable="d">
+ x:Class="optimizerDuck.UI.Pages.SettingsPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:pages="clr-namespace:optimizerDuck.UI.Pages"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ Title="SettingsPage"
+ Margin="0,32,0,0"
+ d:DataContext="{d:DesignInstance pages:SettingsPage}"
+ d:DesignHeight="1200"
+ d:DesignWidth="800"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ mc:Ignorable="d"
+>
+ <Page.Resources>
+ <converters:ThemeToIndexConverter x:Key="ThemeToIndexConverter" />
+ </Page.Resources>
- <Page.Resources>
- <converters:ThemeToIndexConverter x:Key="ThemeToIndexConverter" />
- </Page.Resources>
+ <StackPanel>
+ <ui:TextBlock
+ FontTypography="Title"
+ Text="{ext:Loc Settings.Header.Title}"
+ TextWrapping="Wrap"
+ />
- <StackPanel>
- <ui:TextBlock
- FontTypography="Title"
- Text="{ext:Loc Settings.Header.Title}"
- TextWrapping="Wrap" />
-
- <StackPanel Margin="0,20,0,0">
+ <StackPanel Margin="0,20,0,0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Appearance.Header}"
+ TextWrapping="Wrap"
+ />
+ <ui:CardControl Icon="{ui:SymbolIcon Globe24}">
+ <ui:CardControl.Header>
+ <StackPanel>
<ui:TextBlock
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.Appearance.Header}"
- TextWrapping="Wrap" />
- <ui:CardControl Icon="{ui:SymbolIcon Globe24}">
- <ui:CardControl.Header>
- <StackPanel>
- <ui:TextBlock
- Margin="0"
- FontTypography="BodyStrong"
- Foreground="{DynamicResource TextFillColorPrimaryBrush}"
- Text="{ext:Loc Settings.Appearance.LanguageSelector.Title}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Appearance="Secondary"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{ext:Loc Settings.Appearance.LanguageSelector.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- </ui:CardControl.Header>
- <ComboBox
- DisplayMemberPath="DisplayName"
- ItemsSource="{Binding ViewModel.Languages}"
- SelectedValue="{Binding ViewModel.SelectedCultureName, Mode=TwoWay}"
- SelectedValuePath="Culture.Name" />
- </ui:CardControl>
- <ui:CardControl Icon="{ui:SymbolIcon Color24}">
- <ui:CardControl.Header>
- <StackPanel>
- <ui:TextBlock
- Margin="0"
- Appearance="Primary"
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.Appearance.ThemeSelector.Title}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Appearance="Secondary"
- Text="{ext:Loc Settings.Appearance.ThemeSelector.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- </ui:CardControl.Header>
- <ComboBox SelectedIndex="{Binding ViewModel.CurrentApplicationTheme, Converter={StaticResource ThemeToIndexConverter}, Mode=TwoWay}">
- <ComboBoxItem Content="{ext:Loc Settings.Appearance.ThemeSelector.Light}" />
- <ComboBoxItem Content="{ext:Loc Settings.Appearance.ThemeSelector.Dark}" />
- <ComboBoxItem Content="{ext:Loc Settings.Appearance.ThemeSelector.HighContrast}" />
- </ComboBox>
- </ui:CardControl>
-
- <StackPanel Margin="0,20,0,0">
- <ui:TextBlock
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.Optimize.Header}"
- TextWrapping="Wrap" />
+ Margin="0"
+ FontTypography="BodyStrong"
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ Text="{ext:Loc Settings.Appearance.LanguageSelector.Title}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Text="{ext:Loc Settings.Appearance.LanguageSelector.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </ui:CardControl.Header>
+ <ComboBox
+ DisplayMemberPath="DisplayName"
+ ItemsSource="{Binding ViewModel.Languages}"
+ SelectedValue="{Binding ViewModel.SelectedCultureName, Mode=TwoWay}"
+ SelectedValuePath="Culture.Name"
+ />
+ </ui:CardControl>
+ <ui:CardControl Icon="{ui:SymbolIcon Color24}">
+ <ui:CardControl.Header>
+ <StackPanel>
+ <ui:TextBlock
+ Margin="0"
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Appearance.ThemeSelector.Title}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.Appearance.ThemeSelector.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </ui:CardControl.Header>
+ <ComboBox SelectedIndex="{Binding ViewModel.CurrentApplicationTheme, Converter={StaticResource ThemeToIndexConverter}, Mode=TwoWay}">
+ <ComboBoxItem Content="{ext:Loc Settings.Appearance.ThemeSelector.Light}" />
+ <ComboBoxItem Content="{ext:Loc Settings.Appearance.ThemeSelector.Dark}" />
+ <ComboBoxItem Content="{ext:Loc Settings.Appearance.ThemeSelector.HighContrast}" />
+ </ComboBox>
+ </ui:CardControl>
- <ui:CardControl>
- <ui:CardControl.Icon>
- <ui:SymbolIcon Foreground="{DynamicResource SystemFillColorCriticalBrush}" Symbol="Clock24" />
- </ui:CardControl.Icon>
- <ui:CardControl.Header>
- <StackPanel>
- <ui:TextBlock
- Margin="0"
- Appearance="Primary"
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.Optimize.ShellTimeout.Title}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Appearance="Secondary"
- Text="{ext:Loc Settings.Optimize.ShellTimeout.Description}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Text="{ext:Loc Settings.Optimize.ShellTimeout.Warning}"
- TextWrapping="Wrap" />
- </StackPanel>
- </ui:CardControl.Header>
+ <StackPanel Margin="0,20,0,0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Optimize.Header}"
+ TextWrapping="Wrap"
+ />
- <ui:NumberBox
- Minimum="1000"
- SmallChange="1000"
- Value="{Binding ViewModel.ShellTimeoutMs, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- </ui:CardControl>
+ <ui:CardControl>
+ <ui:CardControl.Icon>
+ <ui:SymbolIcon
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Symbol="Clock24"
+ />
+ </ui:CardControl.Icon>
+ <ui:CardControl.Header>
+ <StackPanel>
+ <ui:TextBlock
+ Margin="0"
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Optimize.ShellTimeout.Title}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.Optimize.ShellTimeout.Description}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Text="{ext:Loc Settings.Optimize.ShellTimeout.Warning}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </ui:CardControl.Header>
- <ui:CardControl Icon="{ui:SymbolIcon Alert24}">
- <ui:CardControl.Header>
- <StackPanel>
- <ui:TextBlock
- Margin="0"
- Appearance="Primary"
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.Optimize.ShowCompletionNotification.Title}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Appearance="Secondary"
- Text="{ext:Loc Settings.Optimize.ShowCompletionNotification.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- </ui:CardControl.Header>
+ <ui:NumberBox
+ Minimum="1000"
+ SmallChange="1000"
+ Value="{Binding ViewModel.ShellTimeoutMs, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+ />
+ </ui:CardControl>
- <ui:ToggleSwitch Command="{Binding ViewModel.ToggleShowCompletionNotificationCommand}" IsChecked="{Binding ViewModel.ShowSnackbarNotificationAfterAppliedSuccessfully, Mode=TwoWay}" />
- </ui:CardControl>
+ <ui:CardControl Icon="{ui:SymbolIcon Alert24}">
+ <ui:CardControl.Header>
+ <StackPanel>
+ <ui:TextBlock
+ Margin="0"
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Optimize.ShowCompletionNotification.Title}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.Optimize.ShowCompletionNotification.Description}"
+ TextWrapping="Wrap"
+ />
</StackPanel>
+ </ui:CardControl.Header>
- <StackPanel Margin="0,20,0,0">
- <ui:TextBlock
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.Bloatware.Header}"
- TextWrapping="Wrap" />
+ <ui:ToggleSwitch
+ Command="{Binding ViewModel.ToggleShowCompletionNotificationCommand}"
+ IsChecked="{Binding ViewModel.ShowSnackbarNotificationAfterAppliedSuccessfully, Mode=TwoWay}"
+ />
+ </ui:CardControl>
+ </StackPanel>
- <ui:CardControl Icon="{ui:SymbolIcon UninstallApp24}">
- <ui:CardControl.Header>
- <StackPanel>
- <ui:TextBlock
- Margin="0"
- Appearance="Primary"
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.Bloatware.RemoveProvisioned.Title}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Appearance="Secondary"
- Text="{ext:Loc Settings.Bloatware.RemoveProvisioned.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- </ui:CardControl.Header>
+ <StackPanel Margin="0,20,0,0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Bloatware.Header}"
+ TextWrapping="Wrap"
+ />
- <ui:ToggleSwitch Command="{Binding ViewModel.ToggleRemoveProvisionedCommand}" IsChecked="{Binding ViewModel.RemoveProvisioned, Mode=TwoWay}" />
- </ui:CardControl>
+ <ui:CardControl Icon="{ui:SymbolIcon UninstallApp24}">
+ <ui:CardControl.Header>
+ <StackPanel>
+ <ui:TextBlock
+ Margin="0"
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Bloatware.RemoveProvisioned.Title}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.Bloatware.RemoveProvisioned.Description}"
+ TextWrapping="Wrap"
+ />
</StackPanel>
+ </ui:CardControl.Header>
- <StackPanel Margin="0,20,0,0">
- <ui:TextBlock
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.Advanced.Header}"
- TextWrapping="Wrap" />
+ <ui:ToggleSwitch
+ Command="{Binding ViewModel.ToggleRemoveProvisionedCommand}"
+ IsChecked="{Binding ViewModel.RemoveProvisioned, Mode=TwoWay}"
+ />
+ </ui:CardControl>
+ </StackPanel>
- <ui:CardAction Command="{Binding ViewModel.ClearResourcesCommand}">
- <ui:CardAction.Icon>
- <ui:SymbolIcon Foreground="{DynamicResource SystemFillColorCriticalBrush}" Symbol="Archive24" />
- </ui:CardAction.Icon>
- <StackPanel>
- <ui:TextBlock
- Margin="0"
- Appearance="Primary"
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.Advanced.ClearResources.Title}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Appearance="Secondary"
- Text="{ext:Loc Settings.Advanced.ClearResources.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- </ui:CardAction>
+ <StackPanel Margin="0,20,0,0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Advanced.Header}"
+ TextWrapping="Wrap"
+ />
- <ui:CardAction Command="{Binding ViewModel.ClearAllRevertDataCommand}">
- <ui:CardAction.Icon>
- <ui:SymbolIcon Foreground="{DynamicResource SystemFillColorCriticalBrush}" Symbol="DatabaseLightning20" />
- </ui:CardAction.Icon>
- <StackPanel>
- <ui:TextBlock
- Margin="0"
- Appearance="Primary"
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.Advanced.ClearRevertDatas.Title}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Appearance="Secondary"
- Text="{ext:Loc Settings.Advanced.ClearRevertDatas.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- </ui:CardAction>
+ <ui:CardAction Command="{Binding ViewModel.ClearResourcesCommand}">
+ <ui:CardAction.Icon>
+ <ui:SymbolIcon
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Symbol="Archive24"
+ />
+ </ui:CardAction.Icon>
+ <StackPanel>
+ <ui:TextBlock
+ Margin="0"
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Advanced.ClearResources.Title}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.Advanced.ClearResources.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </ui:CardAction>
+
+ <ui:CardAction Command="{Binding ViewModel.ClearAllRevertDataCommand}">
+ <ui:CardAction.Icon>
+ <ui:SymbolIcon
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Symbol="DatabaseLightning20"
+ />
+ </ui:CardAction.Icon>
+ <StackPanel>
+ <ui:TextBlock
+ Margin="0"
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Advanced.ClearRevertDatas.Title}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.Advanced.ClearRevertDatas.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </ui:CardAction>
- <ui:CardAction
- Command="{Binding ViewModel.OpenRootDirCommand}"
- Icon="{ui:SymbolIcon Folder24}"
- IsChevronVisible="False">
- <Grid ColumnDefinitions="* Auto">
- <StackPanel>
- <ui:TextBlock
- Margin="0"
- Appearance="Primary"
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.Advanced.OpenRootDir.Title}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Appearance="Secondary"
- Text="{ext:Loc Settings.Advanced.OpenRootDir.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- <ui:SymbolIcon
- Grid.Column="1"
- FontSize="20"
- Symbol="Open24" />
- </Grid>
- </ui:CardAction>
+ <ui:CardAction
+ Command="{Binding ViewModel.OpenRootDirCommand}"
+ Icon="{ui:SymbolIcon Folder24}"
+ IsChevronVisible="False"
+ >
+ <Grid ColumnDefinitions="* Auto">
+ <StackPanel>
+ <ui:TextBlock
+ Margin="0"
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Advanced.OpenRootDir.Title}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.Advanced.OpenRootDir.Description}"
+ TextWrapping="Wrap"
+ />
</StackPanel>
+ <ui:SymbolIcon Grid.Column="1" FontSize="20" Symbol="Open24" />
+ </Grid>
+ </ui:CardAction>
+ </StackPanel>
- <StackPanel Margin="0,20,0,0">
- <ui:TextBlock
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.About.Header}"
- TextWrapping="Wrap" />
+ <StackPanel Margin="0,20,0,0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.About.Header}"
+ TextWrapping="Wrap"
+ />
- <ui:CardAction
- Command="{Binding ViewModel.OpenWebsiteCommand}"
- CommandParameter="Web"
- IsChevronVisible="False">
- <ui:CardAction.Icon>
- <ui:ImageIcon Height="25" Source="pack://application:,,,/optimizerDuck;component/Resources/Images/Duck.png" />
- </ui:CardAction.Icon>
+ <ui:CardAction
+ Command="{Binding ViewModel.OpenWebsiteCommand}"
+ CommandParameter="Web"
+ IsChevronVisible="False"
+ >
+ <ui:CardAction.Icon>
+ <ui:ImageIcon
+ Height="25"
+ Source="pack://application:,,,/optimizerDuck;component/Resources/Images/Duck.png"
+ />
+ </ui:CardAction.Icon>
- <Grid ColumnDefinitions="* Auto">
- <StackPanel>
- <ui:TextBlock
- Appearance="Primary"
- FontTypography="BodyStrong"
- Text="optimizerDuck"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Appearance="Secondary"
- Text="{ext:Loc Settings.About.Duck.Description,
+ <Grid ColumnDefinitions="* Auto">
+ <StackPanel>
+ <ui:TextBlock
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Text="optimizerDuck"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.About.Duck.Description,
{Binding ViewModel.Version}}"
- TextWrapping="Wrap" />
- </StackPanel>
- <ui:SymbolIcon
- Grid.Column="1"
- FontSize="20"
- Symbol="Open24" />
- </Grid>
- </ui:CardAction>
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ <ui:SymbolIcon Grid.Column="1" FontSize="20" Symbol="Open24" />
+ </Grid>
+ </ui:CardAction>
- <ui:CardAction
- Command="{Binding ViewModel.OpenWebsiteCommand}"
- CommandParameter="Help"
- Icon="{ui:SymbolIcon ChatBubblesQuestion24}"
- IsChevronVisible="False">
- <Grid ColumnDefinitions="* Auto">
- <StackPanel>
- <ui:TextBlock
- Padding="0"
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.About.NeedHelp.Title}" />
- <ui:TextBlock
- Appearance="Secondary"
- Text="{ext:Loc Settings.About.NeedHelp.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
+ <ui:CardAction
+ Command="{Binding ViewModel.OpenWebsiteCommand}"
+ CommandParameter="Help"
+ Icon="{ui:SymbolIcon ChatBubblesQuestion24}"
+ IsChevronVisible="False"
+ >
+ <Grid ColumnDefinitions="* Auto">
+ <StackPanel>
+ <ui:TextBlock
+ Padding="0"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.About.NeedHelp.Title}"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.About.NeedHelp.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
- <ui:SymbolIcon
- Grid.Column="1"
- FontSize="20"
- Symbol="Open24" />
- </Grid>
- </ui:CardAction>
+ <ui:SymbolIcon Grid.Column="1" FontSize="20" Symbol="Open24" />
+ </Grid>
+ </ui:CardAction>
- <ui:CardAction
- VerticalAlignment="Stretch"
- Command="{Binding ViewModel.OpenAcknowledgementsCommand}"
- IsChevronVisible="False">
- <ui:CardAction.Icon>
- <ui:SymbolIcon Symbol="DocumentHeart24" />
- </ui:CardAction.Icon>
+ <ui:CardAction
+ VerticalAlignment="Stretch"
+ Command="{Binding ViewModel.OpenAcknowledgementsCommand}"
+ IsChevronVisible="False"
+ >
+ <ui:CardAction.Icon>
+ <ui:SymbolIcon Symbol="DocumentHeart24" />
+ </ui:CardAction.Icon>
- <Grid ColumnDefinitions="* Auto">
- <StackPanel>
- <ui:TextBlock
- Appearance="Primary"
- FontTypography="BodyStrong"
- Text="{ext:Loc Settings.About.Acknowledgements.Title}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Appearance="Secondary"
- Text="{ext:Loc Settings.About.Acknowledgements.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
+ <Grid ColumnDefinitions="* Auto">
+ <StackPanel>
+ <ui:TextBlock
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.About.Acknowledgements.Title}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.About.Acknowledgements.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
- <ui:SymbolIcon
- Grid.Column="1"
- FontSize="20"
- Symbol="Open24" />
- </Grid>
- </ui:CardAction>
+ <ui:SymbolIcon Grid.Column="1" FontSize="20" Symbol="Open24" />
+ </Grid>
+ </ui:CardAction>
- <ui:TextBlock
- Margin="0,15,0,0"
- FontTypography="Subtitle"
- Text="{ext:Loc Settings.About.LearnMore}"
- TextTrimming="WordEllipsis"
- TextWrapping="Wrap" />
- <StackPanel Margin="7,0,0,0">
- <ui:HyperlinkButton Content="{ext:Loc Settings.About.LearnMore.Website}" NavigateUri="{Binding ViewModel.Website}" />
- <ui:HyperlinkButton Content="{ext:Loc Settings.About.LearnMore.Contribute}" NavigateUri="{Binding ViewModel.Contribute}" />
- <ui:HyperlinkButton Content="{ext:Loc Settings.About.LearnMore.Documentation}" NavigateUri="{Binding ViewModel.Documentation}" />
- <ui:HyperlinkButton Content="{ext:Loc Settings.About.LearnMore.Community}" NavigateUri="{Binding ViewModel.Community}" />
- <ui:HyperlinkButton Content="{ext:Loc Settings.About.LearnMore.Acknowledgements}" NavigateUri="{Binding ViewModel.Acknowledgements}" />
- </StackPanel>
- </StackPanel>
+ <ui:TextBlock
+ Margin="0,15,0,0"
+ FontTypography="Subtitle"
+ Text="{ext:Loc Settings.About.LearnMore}"
+ TextTrimming="WordEllipsis"
+ TextWrapping="Wrap"
+ />
+ <StackPanel Margin="7,0,0,0">
+ <ui:HyperlinkButton
+ Content="{ext:Loc Settings.About.LearnMore.Website}"
+ NavigateUri="{Binding ViewModel.Website}"
+ />
+ <ui:HyperlinkButton
+ Content="{ext:Loc Settings.About.LearnMore.Contribute}"
+ NavigateUri="{Binding ViewModel.Contribute}"
+ />
+ <ui:HyperlinkButton
+ Content="{ext:Loc Settings.About.LearnMore.Documentation}"
+ NavigateUri="{Binding ViewModel.Documentation}"
+ />
+ <ui:HyperlinkButton
+ Content="{ext:Loc Settings.About.LearnMore.Community}"
+ NavigateUri="{Binding ViewModel.Community}"
+ />
+ <ui:HyperlinkButton
+ Content="{ext:Loc Settings.About.LearnMore.Acknowledgements}"
+ NavigateUri="{Binding ViewModel.Acknowledgements}"
+ />
</StackPanel>
+ </StackPanel>
</StackPanel>
-</Page>
\ No newline at end of file
+ </StackPanel>
+</Page>
diff --git a/optimizerDuck/UI/Pages/SettingsPage.xaml.cs b/optimizerDuck/UI/Pages/SettingsPage.xaml.cs
index 9f2c5ad..152962a 100644
--- a/optimizerDuck/UI/Pages/SettingsPage.xaml.cs
+++ b/optimizerDuck/UI/Pages/SettingsPage.xaml.cs
@@ -13,4 +13,4 @@ public partial class SettingsPage : INavigableView<SettingsViewModel>
}
public SettingsViewModel ViewModel { get; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Pages/StartupManagerPage.xaml b/optimizerDuck/UI/Pages/StartupManagerPage.xaml
index 8e99d74..f9c02f0 100644
--- a/optimizerDuck/UI/Pages/StartupManagerPage.xaml
+++ b/optimizerDuck/UI/Pages/StartupManagerPage.xaml
@@ -1,565 +1,632 @@
<Page
- x:Class="optimizerDuck.UI.Pages.StartupManagerPage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:local="clr-namespace:optimizerDuck.UI.Pages"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:startupManager="clr-namespace:optimizerDuck.Domain.Optimizations.Models.StartupManager"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- Title="StartupManagerPage"
- Margin="0,32,0,0"
- d:DataContext="{d:DesignInstance local:StartupManagerPage}"
- d:DesignHeight="1200"
- d:DesignWidth="800"
- ui:Design.Background="Black"
- ui:Design.Foreground="White"
- Foreground="{DynamicResource TextFillColorPrimaryBrush}"
- ScrollViewer.CanContentScroll="False"
- mc:Ignorable="d">
+ x:Class="optimizerDuck.UI.Pages.StartupManagerPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:local="clr-namespace:optimizerDuck.UI.Pages"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:startupManager="clr-namespace:optimizerDuck.Domain.Optimizations.Models.StartupManager"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ Title="StartupManagerPage"
+ Margin="0,32,0,0"
+ d:DataContext="{d:DesignInstance local:StartupManagerPage}"
+ d:DesignHeight="1200"
+ d:DesignWidth="800"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ ScrollViewer.CanContentScroll="False"
+ mc:Ignorable="d"
+>
+ <Page.Resources>
+ <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
+ <converters:GreaterThanZeroToVisibilityConverter x:Key="GreaterThanZeroToVisibilityConverter" />
+ <converters:EmptyWhileNotLoadingConverter x:Key="EmptyWhileNotLoadingConverter" />
+ </Page.Resources>
- <Page.Resources>
- <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
- <converters:GreaterThanZeroToVisibilityConverter x:Key="GreaterThanZeroToVisibilityConverter" />
- <converters:EmptyWhileNotLoadingConverter x:Key="EmptyWhileNotLoadingConverter" />
- </Page.Resources>
-
- <Grid RowDefinitions="Auto, *">
- <!-- Header -->
- <StackPanel Margin="0,0,0,20">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
- <StackPanel Grid.Column="0">
- <ui:TextBlock FontTypography="Title" Text="{ext:Loc StartupManager.Header.Title}" />
- <ui:TextBlock
- Margin="0,4,0,0"
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc StartupManager.Header.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- <WrapPanel
- Grid.Column="1"
- VerticalAlignment="Center"
- Orientation="Horizontal">
- <ui:Button
- Appearance="Primary"
- Command="{Binding ViewModel.RefreshCommand}"
- Content="{ext:Loc StartupManager.Menu.Refresh}"
- Icon="{ui:SymbolIcon ArrowClockwise24,
- FontSize=18}" />
- </WrapPanel>
- </Grid>
+ <Grid RowDefinitions="Auto, *">
+ <!-- Header -->
+ <StackPanel Margin="0,0,0,20">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <StackPanel Grid.Column="0">
+ <ui:TextBlock FontTypography="Title" Text="{ext:Loc StartupManager.Header.Title}" />
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc StartupManager.Header.Description}"
+ TextWrapping="Wrap"
+ />
</StackPanel>
+ <WrapPanel Grid.Column="1" VerticalAlignment="Center" Orientation="Horizontal">
+ <ui:Button
+ Appearance="Primary"
+ Command="{Binding ViewModel.RefreshCommand}"
+ Content="{ext:Loc StartupManager.Menu.Refresh}"
+ Icon="{ui:SymbolIcon ArrowClockwise24,
+ FontSize=18}"
+ />
+ </WrapPanel>
+ </Grid>
+ </StackPanel>
+
+ <!-- Loading Indicator -->
+ <Border
+ Grid.Row="1"
+ Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+ <ui:ProgressRing
+ Width="48"
+ Height="48"
+ Margin="0,0,0,16"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsIndeterminate="True"
+ />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc StartupManager.Loading}"
+ />
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc StartupManager.Loading.Hint}"
+ />
+ </StackPanel>
+ </Border>
+
+ <!-- Empty State (no data at all) -->
+ <Border Grid.Row="1">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed" />
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding ViewModel.HasData}" Value="False" />
+ <Condition Binding="{Binding ViewModel.IsLoading}" Value="False" />
+ </MultiDataTrigger.Conditions>
+ <Setter Property="Visibility" Value="Visible" />
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
- <!-- Loading Indicator -->
- <Border Grid.Row="1" Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ui:ProgressRing
- Width="48"
- Height="48"
- Margin="0,0,0,16"
- HorizontalAlignment="Center"
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+ <ui:SymbolIcon
+ Margin="0,0,0,15"
+ HorizontalAlignment="Center"
+ FontSize="46"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Symbol="AppGeneric24"
+ />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ FontTypography="Subtitle"
+ Text="{ext:Loc StartupManager.Empty.Title}"
+ />
+ <ui:TextBlock
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc StartupManager.Empty.Description}"
+ />
+ <ui:Button
+ HorizontalAlignment="Center"
+ Appearance="Primary"
+ Command="{Binding ViewModel.RefreshCommand}"
+ Content="{ext:Loc StartupManager.Menu.Refresh}"
+ Icon="{ui:SymbolIcon ArrowClockwise24,
+ FontSize=18}"
+ />
+ </StackPanel>
+ </Border>
+
+ <!-- Main Content -->
+ <Border
+ Grid.Row="1"
+ Visibility="{Binding ViewModel.HasData, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <ScrollViewer>
+ <StackPanel Margin="0,0,16,0">
+ <!-- ═══════════ Startup Apps Section ═══════════ -->
+ <ui:CardExpander
+ Margin="0,0,0,12"
+ Icon="{ui:SymbolIcon Apps24}"
+ IsExpanded="True"
+ Visibility="{Binding ViewModel.HasApps, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <ui:CardExpander.Header>
+ <StackPanel>
+ <StackPanel Orientation="Horizontal">
+ <ui:TextBlock
VerticalAlignment="Center"
- IsIndeterminate="True" />
- <ui:TextBlock
- HorizontalAlignment="Center"
FontTypography="BodyStrong"
- Text="{ext:Loc StartupManager.Loading}" />
+ Text="{ext:Loc StartupManager.Apps.Title}"
+ />
+ <Border
+ Margin="8,0,0,0"
+ Padding="8,2"
+ VerticalAlignment="Center"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="10"
+ >
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ Appearance="Tertiary"
+ FontTypography="Caption"
+ Text="{ext:Loc StartupManager.Apps.CountSuffix,
+ {Binding ViewModel.Apps.Count}}"
+ />
+ </Border>
+ </StackPanel>
<ui:TextBlock
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc StartupManager.Loading.Hint}" />
- </StackPanel>
- </Border>
+ Margin="0,4,0,0"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc StartupManager.Apps.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </ui:CardExpander.Header>
- <!-- Empty State (no data at all) -->
- <Border Grid.Row="1">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Visibility" Value="Collapsed" />
- <Style.Triggers>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding ViewModel.HasData}" Value="False" />
- <Condition Binding="{Binding ViewModel.IsLoading}" Value="False" />
- </MultiDataTrigger.Conditions>
- <Setter Property="Visibility" Value="Visible" />
- </MultiDataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
+ <StackPanel>
+ <!-- Apps Toolbar -->
+ <WrapPanel Margin="0,0,0,8" Orientation="Horizontal">
+ <ui:TextBox
+ MinWidth="200"
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ Icon="{ui:SymbolIcon Search24}"
+ PlaceholderText="{ext:Loc Common.Search.Placeholder}"
+ Text="{Binding ViewModel.AppSearchText, UpdateSourceTrigger=PropertyChanged}"
+ />
+ <ComboBox
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ SelectedIndex="{Binding ViewModel.AppSortByIndex}"
+ ToolTip="{ext:Loc Common.SortBy}"
+ >
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ HorizontalAlignment="Left"
+ Symbol="TextSortAscending24"
+ />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Name}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ HorizontalAlignment="Left"
+ Symbol="ToggleRight24"
+ />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Status}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ HorizontalAlignment="Left"
+ Symbol="Folder24"
+ />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Path}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ </ComboBox>
+ <ui:Button
+ Padding="8"
+ VerticalAlignment="Center"
+ Appearance="Secondary"
+ Command="{Binding ViewModel.OpenStartupSettingsCommand}"
+ Icon="{ui:SymbolIcon Settings24,
+ FontSize=16}"
+ ToolTip="{ext:Loc StartupManager.Menu.OpenSettings}"
+ />
+ </WrapPanel>
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+ <!-- No search results (Apps) -->
+ <StackPanel
+ Margin="0,32,0,32"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ >
+ <StackPanel.Visibility>
+ <MultiBinding Converter="{StaticResource EmptyWhileNotLoadingConverter}">
+ <Binding Path="ViewModel.Apps.Count" />
+ <Binding Path="ViewModel.IsLoading" />
+ </MultiBinding>
+ </StackPanel.Visibility>
<ui:SymbolIcon
- Margin="0,0,0,15"
- HorizontalAlignment="Center"
- FontSize="46"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Symbol="AppGeneric24" />
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ FontSize="36"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Symbol="SearchInfo24"
+ />
<ui:TextBlock
- HorizontalAlignment="Center"
- FontTypography="Subtitle"
- Text="{ext:Loc StartupManager.Empty.Title}" />
- <ui:TextBlock
- Margin="0,0,0,10"
- HorizontalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc StartupManager.Empty.Description}" />
- <ui:Button
- HorizontalAlignment="Center"
- Appearance="Primary"
- Command="{Binding ViewModel.RefreshCommand}"
- Content="{ext:Loc StartupManager.Menu.Refresh}"
- Icon="{ui:SymbolIcon ArrowClockwise24,
- FontSize=18}" />
- </StackPanel>
- </Border>
+ HorizontalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc Bloatware.Search.NoResults}"
+ />
+ </StackPanel>
- <!-- Main Content -->
- <Border Grid.Row="1" Visibility="{Binding ViewModel.HasData, Converter={StaticResource BooleanToVisibilityConverter}}">
- <ScrollViewer>
- <StackPanel Margin="0,0,16,0">
- <!-- ═══════════ Startup Apps Section ═══════════ -->
- <ui:CardExpander
- Margin="0,0,0,12"
- Icon="{ui:SymbolIcon Apps24}"
- IsExpanded="True"
- Visibility="{Binding ViewModel.HasApps, Converter={StaticResource BooleanToVisibilityConverter}}">
- <ui:CardExpander.Header>
- <StackPanel>
- <StackPanel Orientation="Horizontal">
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc StartupManager.Apps.Title}" />
- <Border
- Margin="8,0,0,0"
- Padding="8,2"
- VerticalAlignment="Center"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="10">
-
- <ui:TextBlock
- VerticalAlignment="Center"
- Appearance="Tertiary"
- FontTypography="Caption"
- Text="{ext:Loc StartupManager.Apps.CountSuffix,
- {Binding ViewModel.Apps.Count}}" />
- </Border>
- </StackPanel>
+ <!-- Apps List -->
+ <ItemsControl
+ ItemsSource="{Binding ViewModel.Apps}"
+ Visibility="{Binding ViewModel.Apps.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}"
+ >
+ <ItemsControl.ItemTemplate>
+ <DataTemplate DataType="{x:Type startupManager:StartupApp}">
+ <Grid>
+ <ui:CardAction
+ x:Name="ActionCard"
+ Margin="0,0,0,4"
+ Padding="12,10"
+ Command="{Binding DataContext.ViewModel.OpenLocationCommand, RelativeSource={RelativeSource AncestorType=Page}}"
+ CommandParameter="{Binding}"
+ IsChevronVisible="False"
+ >
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <Image
+ Grid.Column="0"
+ Width="36"
+ Height="36"
+ Margin="0,0,12,0"
+ VerticalAlignment="Center"
+ Source="{Binding LogoImage}"
+ Stretch="UniformToFill"
+ />
+ <StackPanel Grid.Column="1" VerticalAlignment="Center">
+ <DockPanel LastChildFill="False">
+ <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />
+ <Border
+ Margin="8,0,0,0"
+ Padding="6,1"
+ VerticalAlignment="Center"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ >
<ui:TextBlock
- Margin="0,4,0,0"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc StartupManager.Apps.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- </ui:CardExpander.Header>
-
- <StackPanel>
- <!-- Apps Toolbar -->
- <WrapPanel Margin="0,0,0,8" Orientation="Horizontal">
- <ui:TextBox
- MinWidth="200"
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- Icon="{ui:SymbolIcon Search24}"
- PlaceholderText="{ext:Loc Common.Search.Placeholder}"
- Text="{Binding ViewModel.AppSearchText, UpdateSourceTrigger=PropertyChanged}" />
- <ComboBox
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- SelectedIndex="{Binding ViewModel.AppSortByIndex}"
- ToolTip="{ext:Loc Common.SortBy}">
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="TextSortAscending24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Name}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="ToggleRight24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Status}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="Folder24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Path}" />
- </Grid>
- </ComboBoxItem>
- </ComboBox>
- <ui:Button
- Padding="8"
- VerticalAlignment="Center"
- Appearance="Secondary"
- Command="{Binding ViewModel.OpenStartupSettingsCommand}"
- Icon="{ui:SymbolIcon Settings24,
- FontSize=16}"
- ToolTip="{ext:Loc StartupManager.Menu.OpenSettings}" />
- </WrapPanel>
-
- <!-- No search results (Apps) -->
- <StackPanel
- Margin="0,32,0,32"
- HorizontalAlignment="Center"
- VerticalAlignment="Center">
- <StackPanel.Visibility>
- <MultiBinding Converter="{StaticResource EmptyWhileNotLoadingConverter}">
- <Binding Path="ViewModel.Apps.Count" />
- <Binding Path="ViewModel.IsLoading" />
- </MultiBinding>
- </StackPanel.Visibility>
- <ui:SymbolIcon
- Margin="0,0,0,10"
- HorizontalAlignment="Center"
- FontSize="36"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Symbol="SearchInfo24" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc Bloatware.Search.NoResults}" />
- </StackPanel>
-
- <!-- Apps List -->
- <ItemsControl ItemsSource="{Binding ViewModel.Apps}" Visibility="{Binding ViewModel.Apps.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">
- <ItemsControl.ItemTemplate>
- <DataTemplate DataType="{x:Type startupManager:StartupApp}">
- <Grid>
- <ui:CardAction
- x:Name="ActionCard"
- Margin="0,0,0,4"
- Padding="12,10"
- Command="{Binding DataContext.ViewModel.OpenLocationCommand, RelativeSource={RelativeSource AncestorType=Page}}"
- CommandParameter="{Binding}"
- IsChevronVisible="False">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
- <Image
- Grid.Column="0"
- Width="36"
- Height="36"
- Margin="0,0,12,0"
- VerticalAlignment="Center"
- Source="{Binding LogoImage}"
- Stretch="UniformToFill" />
- <StackPanel Grid.Column="1" VerticalAlignment="Center">
- <DockPanel LastChildFill="False">
- <ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />
- <Border
- Margin="8,0,0,0"
- Padding="6,1"
- VerticalAlignment="Center"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4">
- <ui:TextBlock
- VerticalAlignment="Center"
- Appearance="Tertiary"
- FontTypography="Caption"
- Text="{Binding LocationDisplay}" />
- </Border>
- </DockPanel>
- <ui:TextBlock
- Margin="0,2,0,0"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{Binding Publisher}" />
- <ui:TextBlock
- Margin="0,2,0,0"
- Appearance="Disabled"
- FontTypography="Caption"
- Text="{Binding Command}"
- TextTrimming="CharacterEllipsis" />
- </StackPanel>
- <StackPanel Grid.Column="2" Orientation="Horizontal">
- <ui:ToggleSwitch
- Margin="0,0,16,0"
- VerticalAlignment="Center"
- Cursor="Hand"
- IsChecked="{Binding IsEnabled, Mode=TwoWay}"
- OffContent="{ext:Loc Common.Toggle.Off}"
- OnContent="{ext:Loc Common.Toggle.On}" />
- <ui:SymbolIcon FontSize="16" Symbol="Open24" />
- </StackPanel>
- </Grid>
- </ui:CardAction>
- </Grid>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </StackPanel>
- </ui:CardExpander>
+ VerticalAlignment="Center"
+ Appearance="Tertiary"
+ FontTypography="Caption"
+ Text="{Binding LocationDisplay}"
+ />
+ </Border>
+ </DockPanel>
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{Binding Publisher}"
+ />
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ Appearance="Disabled"
+ FontTypography="Caption"
+ Text="{Binding Command}"
+ TextTrimming="CharacterEllipsis"
+ />
+ </StackPanel>
+ <StackPanel Grid.Column="2" Orientation="Horizontal">
+ <ui:ToggleSwitch
+ Margin="0,0,16,0"
+ VerticalAlignment="Center"
+ Cursor="Hand"
+ IsChecked="{Binding IsEnabled, Mode=TwoWay}"
+ OffContent="{ext:Loc Common.Toggle.Off}"
+ OnContent="{ext:Loc Common.Toggle.On}"
+ />
+ <ui:SymbolIcon FontSize="16" Symbol="Open24" />
+ </StackPanel>
+ </Grid>
+ </ui:CardAction>
+ </Grid>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+ </ui:CardExpander>
- <!-- ═══════════ Scheduled Tasks Section ═══════════ -->
- <ui:CardExpander
- Margin="0,0,0,12"
- Icon="{ui:SymbolIcon CalculatorArrowClockwise24}"
- IsExpanded="True"
- Visibility="{Binding ViewModel.HasTasks, Converter={StaticResource BooleanToVisibilityConverter}}">
- <ui:CardExpander.Header>
- <StackPanel>
- <StackPanel Orientation="Horizontal">
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="BodyStrong"
- Text="{ext:Loc StartupManager.Tasks.Title}" />
- <Border
- Margin="8,0,0,0"
- Padding="8,2"
- VerticalAlignment="Center"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="10">
- <ui:TextBlock
- VerticalAlignment="Center"
- Appearance="Tertiary"
- FontTypography="Caption"
- Text="{ext:Loc StartupManager.Tasks.CountSuffix,
- {Binding ViewModel.Tasks.Count}}" />
- </Border>
- </StackPanel>
- <ui:TextBlock
- Margin="0,4,0,0"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{ext:Loc StartupManager.Tasks.Description}"
- TextWrapping="Wrap" />
- </StackPanel>
- </ui:CardExpander.Header>
+ <!-- ═══════════ Scheduled Tasks Section ═══════════ -->
+ <ui:CardExpander
+ Margin="0,0,0,12"
+ Icon="{ui:SymbolIcon CalculatorArrowClockwise24}"
+ IsExpanded="True"
+ Visibility="{Binding ViewModel.HasTasks, Converter={StaticResource BooleanToVisibilityConverter}}"
+ >
+ <ui:CardExpander.Header>
+ <StackPanel>
+ <StackPanel Orientation="Horizontal">
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc StartupManager.Tasks.Title}"
+ />
+ <Border
+ Margin="8,0,0,0"
+ Padding="8,2"
+ VerticalAlignment="Center"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="10"
+ >
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ Appearance="Tertiary"
+ FontTypography="Caption"
+ Text="{ext:Loc StartupManager.Tasks.CountSuffix,
+ {Binding ViewModel.Tasks.Count}}"
+ />
+ </Border>
+ </StackPanel>
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc StartupManager.Tasks.Description}"
+ TextWrapping="Wrap"
+ />
+ </StackPanel>
+ </ui:CardExpander.Header>
- <StackPanel>
- <!-- Tasks Toolbar -->
- <WrapPanel Margin="0,0,0,8" Orientation="Horizontal">
- <ui:TextBox
- MinWidth="200"
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- Icon="{ui:SymbolIcon Search24}"
- PlaceholderText="{ext:Loc Common.Search.Placeholder}"
- Text="{Binding ViewModel.TaskSearchText, UpdateSourceTrigger=PropertyChanged}" />
- <ComboBox
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- SelectedIndex="{Binding ViewModel.TaskSortByIndex}"
- ToolTip="{ext:Loc Common.SortBy}">
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="TextSortAscending24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Name}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="ToggleRight24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Status}" />
- </Grid>
- </ComboBoxItem>
- <ComboBoxItem HorizontalContentAlignment="Left">
- <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
- <ui:SymbolIcon
- Margin="0,0,6,0"
- HorizontalAlignment="Left"
- Symbol="Folder24" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Left"
- Text="{ext:Loc Common.SortBy.Path}" />
- </Grid>
- </ComboBoxItem>
- </ComboBox>
- <ui:ToggleSwitch
- Margin="0,0,8,0"
- VerticalAlignment="Center"
- Cursor="Hand"
- IsChecked="{Binding ViewModel.HideMicrosoftTasks, Mode=TwoWay}"
- OffContent="{ext:Loc StartupManager.Tasks.HideMicrosoft}"
- OnContent="{ext:Loc StartupManager.Tasks.HideMicrosoft}" />
- <ui:Button
- Padding="8"
- VerticalAlignment="Center"
- Appearance="Secondary"
- Command="{Binding ViewModel.OpenTaskSchedulerCommand}"
- Icon="{ui:SymbolIcon Settings24,
+ <StackPanel>
+ <!-- Tasks Toolbar -->
+ <WrapPanel Margin="0,0,0,8" Orientation="Horizontal">
+ <ui:TextBox
+ MinWidth="200"
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ Icon="{ui:SymbolIcon Search24}"
+ PlaceholderText="{ext:Loc Common.Search.Placeholder}"
+ Text="{Binding ViewModel.TaskSearchText, UpdateSourceTrigger=PropertyChanged}"
+ />
+ <ComboBox
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ SelectedIndex="{Binding ViewModel.TaskSortByIndex}"
+ ToolTip="{ext:Loc Common.SortBy}"
+ >
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ HorizontalAlignment="Left"
+ Symbol="TextSortAscending24"
+ />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Name}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ HorizontalAlignment="Left"
+ Symbol="ToggleRight24"
+ />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Status}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ <ComboBoxItem HorizontalContentAlignment="Left">
+ <Grid HorizontalAlignment="Left" ColumnDefinitions="Auto Auto">
+ <ui:SymbolIcon
+ Margin="0,0,6,0"
+ HorizontalAlignment="Left"
+ Symbol="Folder24"
+ />
+ <TextBlock
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ Text="{ext:Loc Common.SortBy.Path}"
+ />
+ </Grid>
+ </ComboBoxItem>
+ </ComboBox>
+ <ui:ToggleSwitch
+ Margin="0,0,8,0"
+ VerticalAlignment="Center"
+ Cursor="Hand"
+ IsChecked="{Binding ViewModel.HideMicrosoftTasks, Mode=TwoWay}"
+ OffContent="{ext:Loc StartupManager.Tasks.HideMicrosoft}"
+ OnContent="{ext:Loc StartupManager.Tasks.HideMicrosoft}"
+ />
+ <ui:Button
+ Padding="8"
+ VerticalAlignment="Center"
+ Appearance="Secondary"
+ Command="{Binding ViewModel.OpenTaskSchedulerCommand}"
+ Icon="{ui:SymbolIcon Settings24,
FontSize=16}"
- ToolTip="{ext:Loc ScheduledTasks.Menu.OpenSettings}" />
- </WrapPanel>
+ ToolTip="{ext:Loc ScheduledTasks.Menu.OpenSettings}"
+ />
+ </WrapPanel>
- <!-- No search results (Tasks) -->
- <StackPanel
- Margin="0,32,0,32"
- HorizontalAlignment="Center"
- VerticalAlignment="Center">
- <StackPanel.Visibility>
- <MultiBinding Converter="{StaticResource EmptyWhileNotLoadingConverter}">
- <Binding Path="ViewModel.Tasks.Count" />
- <Binding Path="ViewModel.IsLoading" />
- </MultiBinding>
- </StackPanel.Visibility>
- <ui:SymbolIcon
- Margin="0,0,0,10"
- HorizontalAlignment="Center"
- FontSize="36"
- Foreground="{DynamicResource SystemFillColorCriticalBrush}"
- Symbol="SearchInfo24" />
- <ui:TextBlock
- HorizontalAlignment="Center"
- Appearance="Secondary"
- FontTypography="Body"
- Text="{ext:Loc Bloatware.Search.NoResults}" />
- </StackPanel>
+ <!-- No search results (Tasks) -->
+ <StackPanel
+ Margin="0,32,0,32"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ >
+ <StackPanel.Visibility>
+ <MultiBinding Converter="{StaticResource EmptyWhileNotLoadingConverter}">
+ <Binding Path="ViewModel.Tasks.Count" />
+ <Binding Path="ViewModel.IsLoading" />
+ </MultiBinding>
+ </StackPanel.Visibility>
+ <ui:SymbolIcon
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ FontSize="36"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Symbol="SearchInfo24"
+ />
+ <ui:TextBlock
+ HorizontalAlignment="Center"
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc Bloatware.Search.NoResults}"
+ />
+ </StackPanel>
- <!-- Tasks List -->
- <ItemsControl ItemsSource="{Binding ViewModel.Tasks}" Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">
- <ItemsControl.ItemTemplate>
- <DataTemplate DataType="{x:Type startupManager:StartupTask}">
- <Border
- Margin="0,0,0,6"
- Padding="16,12"
- Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
- CornerRadius="6">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
+ <!-- Tasks List -->
+ <ItemsControl
+ ItemsSource="{Binding ViewModel.Tasks}"
+ Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}"
+ >
+ <ItemsControl.ItemTemplate>
+ <DataTemplate DataType="{x:Type startupManager:StartupTask}">
+ <Border
+ Margin="0,0,0,6"
+ Padding="16,12"
+ Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
+ CornerRadius="6"
+ >
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
- <Image
- Grid.Column="0"
- Width="36"
- Height="36"
- Margin="0,0,12,0"
- VerticalAlignment="Center"
- Source="{Binding LogoImage}"
- Stretch="UniformToFill" />
+ <Image
+ Grid.Column="0"
+ Width="36"
+ Height="36"
+ Margin="0,0,12,0"
+ VerticalAlignment="Center"
+ Source="{Binding LogoImage}"
+ Stretch="UniformToFill"
+ />
- <StackPanel
- Grid.Column="1"
- Margin="0,0,12,0"
- VerticalAlignment="Center">
- <ui:TextBlock FontTypography="BodyStrong" Text="{Binding TaskName}" />
- <ui:TextBlock
- Margin="0,4,0,0"
- Appearance="Secondary"
- FontTypography="Caption"
- Text="{Binding Description}"
- TextWrapping="Wrap" />
- <ui:TextBlock
- Margin="0,2,0,0"
- Appearance="Disabled"
- FontTypography="Caption"
- Text="{Binding TaskPath}" />
- <ItemsControl Margin="0,4,0,0" ItemsSource="{Binding TriggerTypes}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border
- Margin="0,0,4,2"
- Padding="6,2"
- Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
- CornerRadius="4">
- <StackPanel Orientation="Horizontal">
- <ui:SymbolIcon
- Margin="0,0,4,0"
- FontSize="15"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Symbol="Timer24" />
- <ui:TextBlock
- VerticalAlignment="Center"
- FontTypography="Caption"
- Foreground="{DynamicResource TextFillColorSecondaryBrush}"
- Text="{Binding}" />
- </StackPanel>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- <ui:TextBlock
- Margin="0,2,0,0"
- Appearance="Disabled"
- FontTypography="Caption"
- Text="{Binding ActionSummary}"
- TextTrimming="CharacterEllipsis" />
- </StackPanel>
+ <StackPanel Grid.Column="1" Margin="0,0,12,0" VerticalAlignment="Center">
+ <ui:TextBlock FontTypography="BodyStrong" Text="{Binding TaskName}" />
+ <ui:TextBlock
+ Margin="0,4,0,0"
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{Binding Description}"
+ TextWrapping="Wrap"
+ />
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ Appearance="Disabled"
+ FontTypography="Caption"
+ Text="{Binding TaskPath}"
+ />
+ <ItemsControl Margin="0,4,0,0" ItemsSource="{Binding TriggerTypes}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel Orientation="Horizontal" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border
+ Margin="0,0,4,2"
+ Padding="6,2"
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ >
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Margin="0,0,4,0"
+ FontSize="15"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Symbol="Timer24"
+ />
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Text="{Binding}"
+ />
+ </StackPanel>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ <ui:TextBlock
+ Margin="0,2,0,0"
+ Appearance="Disabled"
+ FontTypography="Caption"
+ Text="{Binding ActionSummary}"
+ TextTrimming="CharacterEllipsis"
+ />
+ </StackPanel>
- <StackPanel
- Grid.Column="2"
- VerticalAlignment="Center"
- Orientation="Horizontal">
- <ui:Button
- Margin="0,0,4,0"
- Padding="8"
- Appearance="Transparent"
- Command="{Binding DataContext.ViewModel.ViewTaskDetailsCommand, RelativeSource={RelativeSource AncestorType=Page}}"
- CommandParameter="{Binding}"
- Icon="{ui:SymbolIcon Info24,
+ <StackPanel
+ Grid.Column="2"
+ VerticalAlignment="Center"
+ Orientation="Horizontal"
+ >
+ <ui:Button
+ Margin="0,0,4,0"
+ Padding="8"
+ Appearance="Transparent"
+ Command="{Binding DataContext.ViewModel.ViewTaskDetailsCommand, RelativeSource={RelativeSource AncestorType=Page}}"
+ CommandParameter="{Binding}"
+ Icon="{ui:SymbolIcon Info24,
FontSize=16}"
- ToolTip="{ext:Loc ScheduledTasks.Action.Details}" />
- <ui:ToggleSwitch
- VerticalAlignment="Center"
- Cursor="Hand"
- IsChecked="{Binding IsEnabled, Mode=TwoWay}"
- OffContent="{ext:Loc Common.Toggle.Off}"
- OnContent="{ext:Loc Common.Toggle.On}" />
- </StackPanel>
- </Grid>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
+ ToolTip="{ext:Loc ScheduledTasks.Action.Details}"
+ />
+ <ui:ToggleSwitch
+ VerticalAlignment="Center"
+ Cursor="Hand"
+ IsChecked="{Binding IsEnabled, Mode=TwoWay}"
+ OffContent="{ext:Loc Common.Toggle.Off}"
+ OnContent="{ext:Loc Common.Toggle.On}"
+ />
</StackPanel>
- </ui:CardExpander>
- </StackPanel>
- </ScrollViewer>
- </Border>
- </Grid>
-</Page>
\ No newline at end of file
+ </Grid>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+ </ui:CardExpander>
+ </StackPanel>
+ </ScrollViewer>
+ </Border>
+ </Grid>
+</Page>
diff --git a/optimizerDuck/UI/Pages/StartupManagerPage.xaml.cs b/optimizerDuck/UI/Pages/StartupManagerPage.xaml.cs
index 4083feb..4f91479 100644
--- a/optimizerDuck/UI/Pages/StartupManagerPage.xaml.cs
+++ b/optimizerDuck/UI/Pages/StartupManagerPage.xaml.cs
@@ -13,4 +13,4 @@ public partial class StartupManagerPage : INavigableView<StartupManagerViewModel
}
public StartupManagerViewModel ViewModel { get; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/ViewModels/Dialogs/OptimizationDetailsViewModel.cs b/optimizerDuck/UI/ViewModels/Dialogs/OptimizationDetailsViewModel.cs
index 8436969..72da1c2 100644
--- a/optimizerDuck/UI/ViewModels/Dialogs/OptimizationDetailsViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Dialogs/OptimizationDetailsViewModel.cs
@@ -17,7 +17,8 @@ namespace optimizerDuck.UI.ViewModels.Dialogs;
public partial class OptimizationDetailsViewModel(
IOptimization optimization,
ISnackbarService snackbarService,
- ILogger logger) : ObservableObject
+ ILogger logger
+) : ObservableObject
{
public IOptimization Optimization { get; } = optimization;
@@ -25,17 +26,20 @@ public partial class OptimizationDetailsViewModel(
private async Task OpenRevertFileAsync()
{
var revertData = await RevertManager.IsAppliedAsync(Optimization.Id);
- if (!revertData) return;
+ if (!revertData)
+ return;
try
{
var filePath = Path.Combine(Shared.RevertDirectory, Optimization.Id + ".json");
- Process.Start(new ProcessStartInfo
- {
- FileName = "explorer.exe",
- Arguments = $"/select,\"{filePath}\"",
- UseShellExecute = true
- });
+ Process.Start(
+ new ProcessStartInfo
+ {
+ FileName = "explorer.exe",
+ Arguments = $"/select,\"{filePath}\"",
+ UseShellExecute = true,
+ }
+ );
}
catch (Exception ex)
{
@@ -46,7 +50,11 @@ public partial class OptimizationDetailsViewModel(
new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
TimeSpan.FromSeconds(5)
);
- logger.LogError(ex, "Failed to open revert file for optimization {Id}", Optimization.Id);
+ logger.LogError(
+ ex,
+ "Failed to open revert file for optimization {Id}",
+ Optimization.Id
+ );
}
}
@@ -64,7 +72,8 @@ public partial class OptimizationDetailsViewModel(
// Fetch source from GitHub raw content to find the class line number
try
{
- var rawUrl = $"https://raw.githubusercontent.com/itsfatduck/optimizerDuck/master/{relativePath}";
+ var rawUrl =
+ $"https://raw.githubusercontent.com/itsfatduck/optimizerDuck/master/{relativePath}";
using var httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(5) };
var source = await httpClient.GetStringAsync(rawUrl);
@@ -79,16 +88,16 @@ public partial class OptimizationDetailsViewModel(
}
catch (Exception ex)
{
- logger.LogWarning(ex, "Could not fetch source to find line number for {Class}", className);
+ logger.LogWarning(
+ ex,
+ "Could not fetch source to find line number for {Class}",
+ className
+ );
}
try
{
- Process.Start(new ProcessStartInfo
- {
- FileName = url,
- UseShellExecute = true
- });
+ Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true });
}
catch (Exception ex)
{
@@ -98,7 +107,8 @@ public partial class OptimizationDetailsViewModel(
Translations.Snackbar_OpenLinkFailed_Message,
ControlAppearance.Danger,
new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
- TimeSpan.FromSeconds(5));
+ TimeSpan.FromSeconds(5)
+ );
}
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/ViewModels/Dialogs/OptimizationResultDialogViewModel.cs b/optimizerDuck/UI/ViewModels/Dialogs/OptimizationResultDialogViewModel.cs
index 0a9ea95..815d3f9 100644
--- a/optimizerDuck/UI/ViewModels/Dialogs/OptimizationResultDialogViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Dialogs/OptimizationResultDialogViewModel.cs
@@ -14,4 +14,4 @@ public class OptimizationResultDialogViewModel : ObservableObject
public ObservableCollection<OperationStepResult> FailedSteps { get; }
public int FailedCount => FailedSteps.Count;
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/ViewModels/Dialogs/ProcessingViewModel.cs b/optimizerDuck/UI/ViewModels/Dialogs/ProcessingViewModel.cs
index 0a262f7..a879a26 100644
--- a/optimizerDuck/UI/ViewModels/Dialogs/ProcessingViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Dialogs/ProcessingViewModel.cs
@@ -5,10 +5,17 @@ namespace optimizerDuck.UI.ViewModels.Dialogs;
public partial class ProcessingViewModel : ObservableObject
{
- [ObservableProperty] private bool _isIndeterminate;
- [ObservableProperty] private string? _message;
- [ObservableProperty] private int _total;
- [ObservableProperty] private int _value;
+ [ObservableProperty]
+ private bool _isIndeterminate;
+
+ [ObservableProperty]
+ private string? _message;
+
+ [ObservableProperty]
+ private int _total;
+
+ [ObservableProperty]
+ private int _value;
public ProcessingViewModel()
{
@@ -22,4 +29,4 @@ public partial class ProcessingViewModel : ObservableObject
}
public IProgress<ProcessingProgress> ProgressReporter { get; }
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/ViewModels/Features/FeatureCategoryViewModel.cs b/optimizerDuck/UI/ViewModels/Features/FeatureCategoryViewModel.cs
index e61f1e6..ecf6e90 100644
--- a/optimizerDuck/UI/ViewModels/Features/FeatureCategoryViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Features/FeatureCategoryViewModel.cs
@@ -14,13 +14,27 @@ public partial class FeatureCategoryViewModel : ViewModel
private readonly List<FeatureViewModel> _allFeatures = [];
private readonly IFeatureCategory? _currentCategory;
- [ObservableProperty] private string _categoryDescription = string.Empty;
- [ObservableProperty] private SymbolRegular _categoryIcon;
- [ObservableProperty] private string _categoryName = string.Empty;
- [ObservableProperty] private bool _isLoading = true;
- [ObservableProperty] private string _searchText = string.Empty;
- [ObservableProperty] private ObservableCollection<FeatureSection> _sections = [];
- [ObservableProperty] private int _selectedSortByIndex;
+
+ [ObservableProperty]
+ private string _categoryDescription = string.Empty;
+
+ [ObservableProperty]
+ private SymbolRegular _categoryIcon;
+
+ [ObservableProperty]
+ private string _categoryName = string.Empty;
+
+ [ObservableProperty]
+ private bool _isLoading = true;
+
+ [ObservableProperty]
+ private string _searchText = string.Empty;
+
+ [ObservableProperty]
+ private ObservableCollection<FeatureSection> _sections = [];
+
+ [ObservableProperty]
+ private int _selectedSortByIndex;
public FeatureCategoryViewModel(IFeatureCategory category, ILoggerFactory loggerFactory)
{
@@ -34,7 +48,8 @@ public partial class FeatureCategoryViewModel : ViewModel
foreach (var feature in _currentCategory.Features)
_allFeatures.Add(new FeatureViewModel(feature, loggerFactory));
- foreach (var feature in _allFeatures) _ = feature.LoadStateAsync();
+ foreach (var feature in _allFeatures)
+ _ = feature.LoadStateAsync();
ApplyFilters();
IsLoading = false;
@@ -57,7 +72,8 @@ public partial class FeatureCategoryViewModel : ViewModel
private void ApplyFilters()
{
- if (_currentCategory == null) return;
+ if (_currentCategory == null)
+ return;
var filtered = _allFeatures.AsEnumerable();
@@ -65,14 +81,15 @@ public partial class FeatureCategoryViewModel : ViewModel
{
var search = SearchText.ToLowerInvariant();
filtered = filtered.Where(f =>
- f.Name.Contains(search, StringComparison.InvariantCultureIgnoreCase) ||
- f.Description.Contains(search, StringComparison.InvariantCultureIgnoreCase));
+ f.Name.Contains(search, StringComparison.InvariantCultureIgnoreCase)
+ || f.Description.Contains(search, StringComparison.InvariantCultureIgnoreCase)
+ );
}
var sortedFeatures = SelectedSortByIndex switch
{
1 => filtered.OrderByDescending(f => f.IsEnabled).ThenBy(f => f.Name).ToList(),
- _ => filtered.OrderBy(f => f.Name).ToList()
+ _ => filtered.OrderBy(f => f.Name).ToList(),
};
var grouped = sortedFeatures
@@ -86,11 +103,11 @@ public partial class FeatureCategoryViewModel : ViewModel
var section = new FeatureSection
{
Name = group.Key,
- Features = new ObservableCollection<FeatureViewModel>(group.ToList())
+ Features = new ObservableCollection<FeatureViewModel>(group.ToList()),
};
sections.Add(section);
}
Sections = sections;
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/ViewModels/Features/FeatureViewModel.cs b/optimizerDuck/UI/ViewModels/Features/FeatureViewModel.cs
index 064dd41..0fd0634 100644
--- a/optimizerDuck/UI/ViewModels/Features/FeatureViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Features/FeatureViewModel.cs
@@ -7,19 +7,26 @@ using Wpf.Ui.Controls;
namespace optimizerDuck.UI.ViewModels.Features;
-public partial class FeatureViewModel(IFeature feature, ILoggerFactory loggerFactory) : ObservableObject
+public partial class FeatureViewModel(IFeature feature, ILoggerFactory loggerFactory)
+ : ObservableObject
{
- private readonly ILogger<FeatureViewModel> _logger = loggerFactory.CreateLogger<FeatureViewModel>();
+ private readonly ILogger<FeatureViewModel> _logger =
+ loggerFactory.CreateLogger<FeatureViewModel>();
- [ObservableProperty] private string _description = feature.Description;
+ [ObservableProperty]
+ private string _description = feature.Description;
- [ObservableProperty] private bool _isEnabled;
+ [ObservableProperty]
+ private bool _isEnabled;
- [ObservableProperty] private bool _isLoading;
+ [ObservableProperty]
+ private bool _isLoading;
- [ObservableProperty] private string _name = feature.Name;
+ [ObservableProperty]
+ private string _name = feature.Name;
- [ObservableProperty] private string _section = feature.Section;
+ [ObservableProperty]
+ private string _section = feature.Section;
public SymbolRegular Icon => feature.Icon;
@@ -47,7 +54,8 @@ public partial class FeatureViewModel(IFeature feature, ILoggerFactory loggerFac
"===== START {Action} toggle feature {FeatureName} ({FeatureKey}) =====",
isEnabling ? "enabling" : "disabling",
feature.Name,
- feature.FeatureKey);
+ feature.FeatureKey
+ );
var scope = ExecutionScope.BeginForLogging(_logger);
@@ -71,7 +79,8 @@ public partial class FeatureViewModel(IFeature feature, ILoggerFactory loggerFac
"===== END {Action} toggle feature {FeatureName} ({FeatureKey}) =====",
isEnabling ? "enabling" : "disabling",
feature.Name,
- feature.FeatureKey);
+ feature.FeatureKey
+ );
}
catch (Exception ex)
{
@@ -83,4 +92,4 @@ public partial class FeatureViewModel(IFeature feature, ILoggerFactory loggerFac
IsLoading = false;
}
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs b/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs
index 2bdfa33..08ffbe3 100644
--- a/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs
@@ -16,8 +16,8 @@ using optimizerDuck.Domain.UI;
using optimizerDuck.Resources.Languages;
using optimizerDuck.Services;
using optimizerDuck.Services.Managers;
-using optimizerDuck.UI.ViewModels.Dialogs;
using optimizerDuck.UI.Dialogs;
+using optimizerDuck.UI.ViewModels.Dialogs;
using Wpf.Ui;
using Wpf.Ui.Controls;
using TextBlock = Wpf.Ui.Controls.TextBlock;
@@ -27,7 +27,10 @@ namespace optimizerDuck.UI.ViewModels.Optimizer;
public partial class OptimizationCategoryViewModel : ViewModel
{
private static readonly HttpClient httpClient = new() { Timeout = TimeSpan.FromSeconds(5) };
- private static readonly ConcurrentDictionary<string, (string Content, DateTime FetchedAt)> _sourceCache = new();
+ private static readonly ConcurrentDictionary<
+ string,
+ (string Content, DateTime FetchedAt)
+ > _sourceCache = new();
private static readonly TimeSpan SourceCacheTtl = TimeSpan.FromMinutes(5);
private readonly List<IOptimization> _allOptimizations = [];
@@ -39,20 +42,29 @@ public partial class OptimizationCategoryViewModel : ViewModel
private readonly OptimizationService _optimizationService;
private readonly RevertManager _revertManager;
private readonly ISnackbarService _snackbarService;
- [ObservableProperty] private bool _hideApplied;
- [ObservableProperty] private bool _isLoading;
+ [ObservableProperty]
+ private bool _hideApplied;
+
+ [ObservableProperty]
+ private bool _isLoading;
- [ObservableProperty] [NotifyCanExecuteChangedFor(nameof(ToggleOptimizationCommand))]
+ [ObservableProperty]
+ [NotifyCanExecuteChangedFor(nameof(ToggleOptimizationCommand))]
private bool _isProcessing;
- [ObservableProperty] private ObservableCollection<IOptimization> _optimizations = [];
+ [ObservableProperty]
+ private ObservableCollection<IOptimization> _optimizations = [];
// Search, Filter, Sort
- [ObservableProperty] private string _searchText = string.Empty;
+ [ObservableProperty]
+ private string _searchText = string.Empty;
- [ObservableProperty] private int _selectedRiskFilterIndex; // 0=All, 1=Safe, 2=Moderate, 3=Risky
- [ObservableProperty] private int _selectedSortByIndex; // 0=Risk & Status, 1=Name, 2=Risk, 3=Status
+ [ObservableProperty]
+ private int _selectedRiskFilterIndex; // 0=All, 1=Safe, 2=Moderate, 3=Risky
+
+ [ObservableProperty]
+ private int _selectedSortByIndex; // 0=Risk & Status, 1=Name, 2=Risk, 3=Status
public OptimizationCategoryViewModel(
IOptimizationCategory category,
@@ -61,7 +73,8 @@ public partial class OptimizationCategoryViewModel : ViewModel
ISnackbarService snackbarService,
IContentDialogService contentDialogService,
ILogger<OptimizationCategoryViewModel> logger,
- IOptionsMonitor<AppSettings> appOptionsMonitor)
+ IOptionsMonitor<AppSettings> appOptionsMonitor
+ )
{
_category = category;
_optimizationService = optimizationService;
@@ -143,23 +156,35 @@ public partial class OptimizationCategoryViewModel : ViewModel
{
_logger.LogInformation(
"===== START applying optimization {OptimizationName} ({OptimizationId}) =====",
- optimization.OptimizationKey, optimization.Id);
+ optimization.OptimizationKey,
+ optimization.Id
+ );
var applyResult = await RunWithProcessingDialogAsync(
optimization,
- progress => _optimizationService.ApplyAsync(optimization, progress));
+ progress => _optimizationService.ApplyAsync(optimization, progress)
+ );
// If result status is Failed, we can't retry it
if (applyResult.Status == OptimizationSuccessResult.Failed)
{
- ShowOperationOutcomeSnackbar(OperationNotificationState.Failed, OptimizationOperation.Apply,
- applyResult.Message, restorePointCreated);
-
- _logger.LogWarning("Apply failed for {Name}: {Message}",
- optimization.OptimizationKey, applyResult.Message);
+ ShowOperationOutcomeSnackbar(
+ OperationNotificationState.Failed,
+ OptimizationOperation.Apply,
+ applyResult.Message,
+ restorePointCreated
+ );
+
+ _logger.LogWarning(
+ "Apply failed for {Name}: {Message}",
+ optimization.OptimizationKey,
+ applyResult.Message
+ );
_logger.LogInformation(
"===== END applying optimization {OptimizationName} ({OptimizationId}) =====",
- optimization.OptimizationKey, optimization.Id);
+ optimization.OptimizationKey,
+ optimization.Id
+ );
await OptimizationService.UpdateOptimizationStateAsync(optimization);
return;
@@ -169,67 +194,109 @@ public partial class OptimizationCategoryViewModel : ViewModel
var retryOutcome = await HandleRetryableFailuresAsync(
optimization,
applyResult.FailedSteps,
- OptimizationOperation.Apply);
+ OptimizationOperation.Apply
+ );
await OptimizationService.UpdateOptimizationStateAsync(optimization);
- var notificationState = ResolveApplyNotificationState(applyResult, retryOutcome);
+ var notificationState = ResolveApplyNotificationState(
+ applyResult,
+ retryOutcome
+ );
- ShowOperationOutcomeSnackbar(notificationState, OptimizationOperation.Apply,
- applyResult.Message, restorePointCreated);
+ ShowOperationOutcomeSnackbar(
+ notificationState,
+ OptimizationOperation.Apply,
+ applyResult.Message,
+ restorePointCreated
+ );
if (notificationState == OperationNotificationState.Success)
- _logger.LogInformation("Successfully applied {Name}", optimization.OptimizationKey);
+ _logger.LogInformation(
+ "Successfully applied {Name}",
+ optimization.OptimizationKey
+ );
else if (notificationState == OperationNotificationState.Partial)
- _logger.LogWarning("Partially applied {Name}", optimization.OptimizationKey);
+ _logger.LogWarning(
+ "Partially applied {Name}",
+ optimization.OptimizationKey
+ );
else
_logger.LogWarning("Failed to apply {Name}", optimization.OptimizationKey);
_logger.LogInformation(
"===== END applying optimization {OptimizationName} ({OptimizationId}) =====",
- optimization.OptimizationKey, optimization.Id);
+ optimization.OptimizationKey,
+ optimization.Id
+ );
}
else
{
// Revert optimization if already applied
_logger.LogInformation(
"===== START reverting optimization {OptimizationName} ({OptimizationId}) =====",
- optimization.OptimizationKey, optimization.Id);
+ optimization.OptimizationKey,
+ optimization.Id
+ );
var revertResult = await RunWithProcessingDialogAsync(
optimization,
- progress => _optimizationService.RevertAsync(optimization, progress));
+ progress => _optimizationService.RevertAsync(optimization, progress)
+ );
var retryOutcome = await HandleRetryableFailuresAsync(
optimization,
revertResult.FailedSteps,
- OptimizationOperation.Revert);
+ OptimizationOperation.Revert
+ );
await OptimizationService.UpdateOptimizationStateAsync(optimization);
- var notificationState = ResolveRevertNotificationState(revertResult, retryOutcome);
+ var notificationState = ResolveRevertNotificationState(
+ revertResult,
+ retryOutcome
+ );
- ShowOperationOutcomeSnackbar(notificationState, OptimizationOperation.Revert,
- revertResult.Message, restorePointCreated);
+ ShowOperationOutcomeSnackbar(
+ notificationState,
+ OptimizationOperation.Revert,
+ revertResult.Message,
+ restorePointCreated
+ );
if (notificationState == OperationNotificationState.Success)
- _logger.LogInformation("Successfully reverted {Name}", optimization.OptimizationKey);
+ _logger.LogInformation(
+ "Successfully reverted {Name}",
+ optimization.OptimizationKey
+ );
else if (notificationState == OperationNotificationState.Partial)
- _logger.LogWarning("Partially reverted {Name}", optimization.OptimizationKey);
+ _logger.LogWarning(
+ "Partially reverted {Name}",
+ optimization.OptimizationKey
+ );
else
_logger.LogWarning("Failed to revert {Name}", optimization.OptimizationKey);
_logger.LogInformation(
"===== END reverting optimization {OptimizationName} ({OptimizationId}) =====",
- optimization.OptimizationKey, optimization.Id);
+ optimization.OptimizationKey,
+ optimization.Id
+ );
}
}
catch (Exception ex)
{
optimization.State.IsApplied = wasApplied; // revert UI state on failure
- _logger.LogError(ex, "Failed to toggle optimization {Name}", optimization.OptimizationKey);
+ _logger.LogError(
+ ex,
+ "Failed to toggle optimization {Name}",
+ optimization.OptimizationKey
+ );
_snackbarService.Show(
Translations.Optimization_Toggle_Snackbar_Error_Title,
- string.Format(Translations.Optimization_Toggle_Snackbar_Error_Message, ex.Message),
+ string.Format(
+ Translations.Optimization_Toggle_Snackbar_Error_Message,
+ ex.Message
+ ),
ControlAppearance.Danger,
new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
TimeSpan.FromSeconds(5)
@@ -249,13 +316,17 @@ public partial class OptimizationCategoryViewModel : ViewModel
[RelayCommand]
private async Task ShowDetailsAsync(IOptimization optimization)
{
- var dialogViewModel = new OptimizationDetailsViewModel(optimization, _snackbarService, _logger);
+ var dialogViewModel = new OptimizationDetailsViewModel(
+ optimization,
+ _snackbarService,
+ _logger
+ );
var dialogContent = new OptimizationDetailsDialog { DataContext = dialogViewModel };
var dialog = new ContentDialog
{
Title = BuildDialogTitle(optimization),
Content = dialogContent,
- CloseButtonText = Translations.Button_Ok
+ CloseButtonText = Translations.Button_Ok,
};
var result = await _contentDialogService.ShowAsync(dialog, CancellationToken.None);
}
@@ -274,11 +345,14 @@ public partial class OptimizationCategoryViewModel : ViewModel
// Fetch source from GitHub raw content to find the class line number
try
{
- var rawUrl = $"https://raw.githubusercontent.com/itsfatduck/optimizerDuck/master/{relativePath}";
+ var rawUrl =
+ $"https://raw.githubusercontent.com/itsfatduck/optimizerDuck/master/{relativePath}";
string source;
- if (_sourceCache.TryGetValue(rawUrl, out var cached)
- && DateTime.UtcNow - cached.FetchedAt < SourceCacheTtl)
+ if (
+ _sourceCache.TryGetValue(rawUrl, out var cached)
+ && DateTime.UtcNow - cached.FetchedAt < SourceCacheTtl
+ )
{
source = cached.Content;
}
@@ -298,16 +372,16 @@ public partial class OptimizationCategoryViewModel : ViewModel
}
catch (Exception ex)
{
- _logger.LogWarning(ex, "Could not fetch source to find line number for {Class}", className);
+ _logger.LogWarning(
+ ex,
+ "Could not fetch source to find line number for {Class}",
+ className
+ );
}
try
{
- Process.Start(new ProcessStartInfo
- {
- FileName = url,
- UseShellExecute = true
- });
+ Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true });
}
catch (Exception ex)
{
@@ -317,7 +391,8 @@ public partial class OptimizationCategoryViewModel : ViewModel
Translations.Snackbar_OpenLinkFailed_Message,
ControlAppearance.Danger,
new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
- TimeSpan.FromSeconds(5));
+ TimeSpan.FromSeconds(5)
+ );
}
}
@@ -327,7 +402,8 @@ public partial class OptimizationCategoryViewModel : ViewModel
private async Task LoadOptimizationStatesAsync()
{
- if (_allOptimizations.Count > 0) return;
+ if (_allOptimizations.Count > 0)
+ return;
IsLoading = true;
try
@@ -365,8 +441,9 @@ public partial class OptimizationCategoryViewModel : ViewModel
{
var search = SearchText.Trim();
query = query.Where(o =>
- o.Name.Contains(search, StringComparison.OrdinalIgnoreCase) ||
- o.ShortDescription.Contains(search, StringComparison.OrdinalIgnoreCase));
+ o.Name.Contains(search, StringComparison.OrdinalIgnoreCase)
+ || o.ShortDescription.Contains(search, StringComparison.OrdinalIgnoreCase)
+ );
}
// Filter by risk
@@ -375,7 +452,7 @@ public partial class OptimizationCategoryViewModel : ViewModel
1 => query.Where(o => o.Risk == OptimizationRisk.Safe),
2 => query.Where(o => o.Risk == OptimizationRisk.Moderate),
3 => query.Where(o => o.Risk == OptimizationRisk.Risky),
- _ => query
+ _ => query,
};
// Hide applied
@@ -388,7 +465,7 @@ public partial class OptimizationCategoryViewModel : ViewModel
1 => query.OrderBy(o => o.Name),
2 => query.OrderBy(o => o.Risk),
3 => query.OrderByDescending(o => o.State.IsApplied ? 1 : 0), // Status
- _ => query.OrderBy(o => o.Risk).ThenByDescending(o => o.State.IsApplied ? 1 : 0) // Risk & Status (default)
+ _ => query.OrderBy(o => o.Risk).ThenByDescending(o => o.State.IsApplied ? 1 : 0), // Risk & Status (default)
};
var filtered = query.ToList();
@@ -406,14 +483,15 @@ public partial class OptimizationCategoryViewModel : ViewModel
/// <returns>The result of the action.</returns>
private async Task<T> RunWithProcessingDialogAsync<T>(
IOptimization optimization,
- Func<IProgress<ProcessingProgress>, Task<T>> action)
+ Func<IProgress<ProcessingProgress>, Task<T>> action
+ )
{
var viewModel = new ProcessingViewModel();
var dialog = new ContentDialog
{
Title = BuildDialogTitle(optimization),
Content = new ProcessingDialog { DataContext = viewModel },
- IsFooterVisible = false
+ IsFooterVisible = false,
};
_ = _contentDialogService.ShowAsync(dialog, CancellationToken.None);
@@ -435,8 +513,11 @@ public partial class OptimizationCategoryViewModel : ViewModel
/// <param name="failedSteps">The failed steps.</param>
/// <param name="operation">The operation currently being processed.</param>
/// <returns>The retry outcome.</returns>
- private async Task<FailureResolutionOutcome> HandleRetryableFailuresAsync(IOptimization optimization,
- IReadOnlyList<OperationStepResult> failedSteps, OptimizationOperation operation)
+ private async Task<FailureResolutionOutcome> HandleRetryableFailuresAsync(
+ IOptimization optimization,
+ IReadOnlyList<OperationStepResult> failedSteps,
+ OptimizationOperation operation
+ )
{
if (failedSteps.Count == 0)
return FailureResolutionOutcome.NoFailures;
@@ -453,7 +534,7 @@ public partial class OptimizationCategoryViewModel : ViewModel
Title = BuildDialogTitle(optimization),
Content = dialogContent,
PrimaryButtonText = Translations.Button_Retry,
- CloseButtonText = Translations.Button_Cancel
+ CloseButtonText = Translations.Button_Cancel,
};
var result = await _contentDialogService.ShowAsync(dialog, CancellationToken.None);
@@ -462,13 +543,18 @@ public partial class OptimizationCategoryViewModel : ViewModel
if (operation == OptimizationOperation.Revert)
{
- remainingFailedSteps = (await RunWithProcessingDialogAsync(
+ remainingFailedSteps = (
+ await RunWithProcessingDialogAsync(
optimization,
- progress => OptimizationService.RetryFailedStepsAsync(
- remainingFailedSteps,
- true,
- _logger,
- progress)))
+ progress =>
+ OptimizationService.RetryFailedStepsAsync(
+ remainingFailedSteps,
+ true,
+ _logger,
+ progress
+ )
+ )
+ )
.OrderBy(s => s.Index)
.ToList();
@@ -482,20 +568,25 @@ public partial class OptimizationCategoryViewModel : ViewModel
else
{
var retryResult = await RunWithProcessingDialogAsync(
- optimization,
- progress => OptimizationService.RetryFailedStepsWithResultsAsync(
+ optimization,
+ progress =>
+ OptimizationService.RetryFailedStepsWithResultsAsync(
remainingFailedSteps,
false,
_logger,
- progress));
+ progress
+ )
+ );
- var newFailed = retryResult.FailedSteps
- .OrderBy(s => s.Index)
- .ToList();
+ var newFailed = retryResult.FailedSteps.OrderBy(s => s.Index).ToList();
foreach (var s in retryResult.RecoveredSteps.Where(s => s.RevertStep != null))
- await _revertManager.UpsertRevertStepAtIndexAsync(optimization.Id,
- optimization.OptimizationKey, s.Index, s.RevertStep!);
+ await _revertManager.UpsertRevertStepAtIndexAsync(
+ optimization.Id,
+ optimization.OptimizationKey,
+ s.Index,
+ s.RevertStep!
+ );
remainingFailedSteps = newFailed;
if (remainingFailedSteps.Count == 0)
@@ -506,10 +597,15 @@ public partial class OptimizationCategoryViewModel : ViewModel
return FailureResolutionOutcome.Recovered;
}
- private static OperationNotificationState ResolveApplyNotificationState(OptimizationResult applyResult,
- FailureResolutionOutcome retryOutcome)
+ private static OperationNotificationState ResolveApplyNotificationState(
+ OptimizationResult applyResult,
+ FailureResolutionOutcome retryOutcome
+ )
{
- if (applyResult.Status == OptimizationSuccessResult.Success || retryOutcome == FailureResolutionOutcome.Recovered)
+ if (
+ applyResult.Status == OptimizationSuccessResult.Success
+ || retryOutcome == FailureResolutionOutcome.Recovered
+ )
return OperationNotificationState.Success;
return retryOutcome == FailureResolutionOutcome.Deferred
@@ -517,8 +613,10 @@ public partial class OptimizationCategoryViewModel : ViewModel
: OperationNotificationState.Failed;
}
- private static OperationNotificationState ResolveRevertNotificationState(RevertResult revertResult,
- FailureResolutionOutcome retryOutcome)
+ private static OperationNotificationState ResolveRevertNotificationState(
+ RevertResult revertResult,
+ FailureResolutionOutcome retryOutcome
+ )
{
if (revertResult.Success || retryOutcome == FailureResolutionOutcome.Recovered)
return OperationNotificationState.Success;
@@ -535,16 +633,23 @@ public partial class OptimizationCategoryViewModel : ViewModel
/// <param name="operation">The type of operation.</param>
/// <param name="message">The message to show.</param>
/// <param name="restorePointCreated">Whether a restore point was created.</param>
- private void ShowOperationOutcomeSnackbar(OperationNotificationState notificationState,
+ private void ShowOperationOutcomeSnackbar(
+ OperationNotificationState notificationState,
OptimizationOperation operation,
- string message, bool restorePointCreated = false)
+ string message,
+ bool restorePointCreated = false
+ )
{
var showSuccess = _appOptionsMonitor.CurrentValue.Optimize.ShowCompletionNotification;
var finalMessage = message;
if (restorePointCreated && showSuccess)
- finalMessage += "\n" + string.Format(Translations.RestorePoint_Snackbar_Success_Message,
- Shared.RestorePointName);
+ finalMessage +=
+ "\n"
+ + string.Format(
+ Translations.RestorePoint_Snackbar_Success_Message,
+ Shared.RestorePointName
+ );
if (notificationState == OperationNotificationState.Success)
{
@@ -556,7 +661,8 @@ public partial class OptimizationCategoryViewModel : ViewModel
finalMessage,
ControlAppearance.Success,
new SymbolIcon { Symbol = SymbolRegular.CheckmarkCircle24, Filled = true },
- TimeSpan.FromSeconds(5));
+ TimeSpan.FromSeconds(5)
+ );
}
else if (notificationState == OperationNotificationState.Partial)
{
@@ -567,7 +673,8 @@ public partial class OptimizationCategoryViewModel : ViewModel
finalMessage,
ControlAppearance.Caution,
new SymbolIcon { Symbol = SymbolRegular.Warning24, Filled = true },
- TimeSpan.FromSeconds(5));
+ TimeSpan.FromSeconds(5)
+ );
}
else if (notificationState == OperationNotificationState.Failed)
{
@@ -578,7 +685,8 @@ public partial class OptimizationCategoryViewModel : ViewModel
finalMessage,
ControlAppearance.Danger,
new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
- TimeSpan.FromSeconds(5));
+ TimeSpan.FromSeconds(5)
+ );
}
}
@@ -596,7 +704,7 @@ public partial class OptimizationCategoryViewModel : ViewModel
PrimaryButtonText = Translations.Button_Ok,
SecondaryButtonText = Translations.Button_Skip,
- CloseButtonText = Translations.Button_Cancel
+ CloseButtonText = Translations.Button_Cancel,
};
var result = await _contentDialogService.ShowAsync(dialog, CancellationToken.None);
@@ -617,10 +725,14 @@ public partial class OptimizationCategoryViewModel : ViewModel
{
_snackbarService.Show(
Translations.RestorePoint_Snackbar_Success_Title,
- string.Format(Translations.RestorePoint_Snackbar_Success_Message, Shared.RestorePointName),
+ string.Format(
+ Translations.RestorePoint_Snackbar_Success_Message,
+ Shared.RestorePointName
+ ),
ControlAppearance.Success,
new SymbolIcon { Symbol = SymbolRegular.CheckmarkCircle24, Filled = true },
- TimeSpan.FromSeconds(5));
+ TimeSpan.FromSeconds(5)
+ );
break;
}
@@ -667,14 +779,14 @@ public partial class OptimizationCategoryViewModel : ViewModel
{
FontTypography = FontTypography.Caption,
Appearance = TextColor.Disabled,
- Text = optimization.Id.ToString()
+ Text = optimization.Id.ToString(),
},
new TextBlock
{
FontTypography = FontTypography.Subtitle,
- Text = optimization.Name
- }
- }
+ Text = optimization.Name,
+ },
+ },
};
}
@@ -682,20 +794,20 @@ public partial class OptimizationCategoryViewModel : ViewModel
{
NoFailures,
Recovered,
- Deferred
+ Deferred,
}
private enum OperationNotificationState
{
Success,
Partial,
- Failed
+ Failed,
}
private enum OptimizationOperation
{
Apply,
- Revert
+ Revert,
}
#endregion Helpers
diff --git a/optimizerDuck/UI/ViewModels/Pages/BloatwareViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/BloatwareViewModel.cs
index f443374..1a7acfb 100644
--- a/optimizerDuck/UI/ViewModels/Pages/BloatwareViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/BloatwareViewModel.cs
@@ -7,8 +7,8 @@ using optimizerDuck.Domain.Optimizations.Models.Bloatware;
using optimizerDuck.Domain.UI;
using optimizerDuck.Resources.Languages;
using optimizerDuck.Services;
-using optimizerDuck.UI.ViewModels.Dialogs;
using optimizerDuck.UI.Dialogs;
+using optimizerDuck.UI.ViewModels.Dialogs;
using Wpf.Ui;
using Wpf.Ui.Controls;
using AppXPackage = optimizerDuck.Domain.Optimizations.Models.Bloatware.AppXPackage;
@@ -25,14 +25,23 @@ public partial class BloatwareViewModel : ViewModel
private bool _isInitialized;
// Search, Filter, Sort
- [ObservableProperty] private string _searchText = string.Empty;
+ [ObservableProperty]
+ private string _searchText = string.Empty;
+
+ [ObservableProperty]
+ private int _selectedRiskFilterIndex; // 0=All, 1=Safe, 2=Caution
+
+ [ObservableProperty]
+ private int _selectedSortByIndex; // 0=Name, 1=Publisher, 2=Risk
- [ObservableProperty] private int _selectedRiskFilterIndex; // 0=All, 1=Safe, 2=Caution
- [ObservableProperty] private int _selectedSortByIndex; // 0=Name, 1=Publisher, 2=Risk
- [ObservableProperty] private bool isLoading;
+ [ObservableProperty]
+ private bool isLoading;
- public BloatwareViewModel(BloatwareService bloatwareService, IContentDialogService contentDialogService,
- ILogger<BloatwareViewModel> logger)
+ public BloatwareViewModel(
+ BloatwareService bloatwareService,
+ IContentDialogService contentDialogService,
+ ILogger<BloatwareViewModel> logger
+ )
{
_bloatwareService = bloatwareService;
_contentDialogService = contentDialogService;
@@ -101,9 +110,10 @@ public partial class BloatwareViewModel : ViewModel
{
var search = SearchText.Trim();
query = query.Where(p =>
- p.Name.Contains(search, StringComparison.OrdinalIgnoreCase) ||
- p.Publisher.Contains(search, StringComparison.OrdinalIgnoreCase) ||
- p.PackageFullName.Contains(search, StringComparison.OrdinalIgnoreCase));
+ p.Name.Contains(search, StringComparison.OrdinalIgnoreCase)
+ || p.Publisher.Contains(search, StringComparison.OrdinalIgnoreCase)
+ || p.PackageFullName.Contains(search, StringComparison.OrdinalIgnoreCase)
+ );
}
// Filter by risk
@@ -111,7 +121,7 @@ public partial class BloatwareViewModel : ViewModel
{
1 => query.Where(p => p.Risk == AppRisk.Safe),
2 => query.Where(p => p.Risk == AppRisk.Caution),
- _ => query
+ _ => query,
};
// Sort
@@ -120,7 +130,7 @@ public partial class BloatwareViewModel : ViewModel
0 => query.OrderBy(p => p.Name),
1 => query.OrderBy(p => p.Publisher),
2 => query.OrderBy(p => p.Risk),
- _ => query
+ _ => query,
};
// Detach PropertyChanged listeners before clearing to avoid unnecessary event overhead
@@ -172,10 +182,13 @@ public partial class BloatwareViewModel : ViewModel
Title = string.Format(Translations.BloatwareDialog_Confirmation_Title, SelectedCount),
Content = new BloatwareConfirmationDialog { DataContext = confirmationViewModel },
PrimaryButtonText = Translations.Button_Ok,
- CloseButtonText = Translations.Button_Cancel
+ CloseButtonText = Translations.Button_Cancel,
};
- var result = await _contentDialogService.ShowAsync(askForConfirmationDialog, CancellationToken.None);
+ var result = await _contentDialogService.ShowAsync(
+ askForConfirmationDialog,
+ CancellationToken.None
+ );
if (result != ContentDialogResult.Primary)
return;
@@ -184,32 +197,45 @@ public partial class BloatwareViewModel : ViewModel
{
Title = string.Format(Translations.BloatwareDialog_Title, toRemove.Count),
Content = new ProcessingDialog { DataContext = viewModel },
- IsFooterVisible = false
+ IsFooterVisible = false,
};
try
{
- _logger.LogInformation("===== START removing {Count} AppX Packages =====", toRemove.Count);
+ _logger.LogInformation(
+ "===== START removing {Count} AppX Packages =====",
+ toRemove.Count
+ );
_ = _contentDialogService.ShowAsync(dialog, CancellationToken.None);
for (var i = 0; i < toRemove.Count; i++)
{
var item = toRemove[i];
- viewModel.ProgressReporter.Report(new ProcessingProgress
- {
- Message = string.Format(Translations.BloatwareDialog_Removing, item.Name, i + 1, toRemove.Count),
- IsIndeterminate = false,
- Total = toRemove.Count,
- Value = i
- });
+ viewModel.ProgressReporter.Report(
+ new ProcessingProgress
+ {
+ Message = string.Format(
+ Translations.BloatwareDialog_Removing,
+ item.Name,
+ i + 1,
+ toRemove.Count
+ ),
+ IsIndeterminate = false,
+ Total = toRemove.Count,
+ Value = i,
+ }
+ );
await _bloatwareService.RemoveAppXPackage(item);
//await Task.Delay(500); // Simulate work
}
}
finally
{
- _logger.LogInformation("===== END removing {Count} AppX Packages =====", toRemove.Count);
+ _logger.LogInformation(
+ "===== END removing {Count} AppX Packages =====",
+ toRemove.Count
+ );
dialog.Hide();
await Refresh();
}
diff --git a/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs
index 96ce58d..efe5b89 100644
--- a/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs
@@ -22,21 +22,36 @@ public partial class DashboardViewModel : ViewModel
private readonly UpdaterService _updaterService;
private readonly DispatcherTimer _updateTimer;
- [ObservableProperty] private ApplicationTheme _currentApplicationTheme = ApplicationTheme.Unknown;
+
+ [ObservableProperty]
+ private ApplicationTheme _currentApplicationTheme = ApplicationTheme.Unknown;
private bool _isInitialized;
- [ObservableProperty] private bool _isLoading;
+ [ObservableProperty]
+ private bool _isLoading;
private bool _isUpdateInfoOpen;
- [ObservableProperty] private string? _latestVersion;
- [ObservableProperty] private DiskInfo _runtimeDisk = DiskInfo.Unknown;
- [ObservableProperty] private RamInfo _runtimeRam = RamInfo.Unknown;
- [ObservableProperty] private SystemSnapshot _systemInfo = SystemSnapshot.Unknown;
+ [ObservableProperty]
+ private string? _latestVersion;
+
+ [ObservableProperty]
+ private DiskInfo _runtimeDisk = DiskInfo.Unknown;
+
+ [ObservableProperty]
+ private RamInfo _runtimeRam = RamInfo.Unknown;
+
+ [ObservableProperty]
+ private SystemSnapshot _systemInfo = SystemSnapshot.Unknown;
private bool _updateNotified;
- public DashboardViewModel(SystemInfoService systemInfoService, ISnackbarService snackbarService,
- ILogger<DashboardViewModel> logger, UpdaterService updaterService, IContentDialogService contentDialogService)
+ public DashboardViewModel(
+ SystemInfoService systemInfoService,
+ ISnackbarService snackbarService,
+ ILogger<DashboardViewModel> logger,
+ UpdaterService updaterService,
+ IContentDialogService contentDialogService
+ )
{
_systemInfoService = systemInfoService;
_snackbarService = snackbarService;
@@ -44,10 +59,7 @@ public partial class DashboardViewModel : ViewModel
_updaterService = updaterService;
_contentDialogService = contentDialogService;
- _updateTimer = new DispatcherTimer
- {
- Interval = TimeSpan.FromSeconds(2)
- };
+ _updateTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(2) };
_updateTimer.Tick += async (s, e) => await UpdateRuntimeInfoAsync();
CurrentApplicationTheme = ApplicationThemeManager.GetAppTheme();
@@ -65,13 +77,15 @@ public partial class DashboardViewModel : ViewModel
_isUpdateInfoOpen = value;
OnPropertyChanged();
- if (!_isUpdateInfoOpen && _updateNotified) OpenLatestRelease();
+ if (!_isUpdateInfoOpen && _updateNotified)
+ OpenLatestRelease();
}
}
public override async Task OnNavigatedToAsync()
{
- if (IsLoading) return;
+ if (IsLoading)
+ return;
// Load system information when user navigates to the page
// This will also update the runtime RAM info
@@ -104,7 +118,8 @@ public partial class DashboardViewModel : ViewModel
private void OnThemeChanged(ApplicationTheme currentApplicationTheme, Color systemAccent)
{
- if (CurrentApplicationTheme != currentApplicationTheme) CurrentApplicationTheme = currentApplicationTheme;
+ if (CurrentApplicationTheme != currentApplicationTheme)
+ CurrentApplicationTheme = currentApplicationTheme;
}
#endregion Property Changed
@@ -125,28 +140,34 @@ public partial class DashboardViewModel : ViewModel
switch (action)
{
case "Discord":
- Process.Start(new ProcessStartInfo
- {
- FileName = Shared.DiscordInviteURL,
- UseShellExecute = true
- });
+ Process.Start(
+ new ProcessStartInfo
+ {
+ FileName = Shared.DiscordInviteURL,
+ UseShellExecute = true,
+ }
+ );
break;
case "GitHub":
- Process.Start(new ProcessStartInfo
- {
- FileName = Shared.GitHubRepoURL,
- UseShellExecute = true
- });
+ Process.Start(
+ new ProcessStartInfo
+ {
+ FileName = Shared.GitHubRepoURL,
+ UseShellExecute = true,
+ }
+ );
break;
case "Support":
case "Contribute":
- Process.Start(new ProcessStartInfo
- {
- FileName = Shared.ContributeURL,
- UseShellExecute = true
- });
+ Process.Start(
+ new ProcessStartInfo
+ {
+ FileName = Shared.ContributeURL,
+ UseShellExecute = true,
+ }
+ );
break;
}
}
@@ -171,27 +192,21 @@ public partial class DashboardViewModel : ViewModel
switch (action)
{
case "Settings":
- Process.Start(new ProcessStartInfo
- {
- FileName = "ms-settings:",
- UseShellExecute = true
- });
+ Process.Start(
+ new ProcessStartInfo { FileName = "ms-settings:", UseShellExecute = true }
+ );
break;
case "TaskManager":
- Process.Start(new ProcessStartInfo
- {
- FileName = "taskmgr",
- UseShellExecute = true
- });
+ Process.Start(
+ new ProcessStartInfo { FileName = "taskmgr", UseShellExecute = true }
+ );
break;
case "ControlPanel":
- Process.Start(new ProcessStartInfo
- {
- FileName = "control",
- UseShellExecute = true
- });
+ Process.Start(
+ new ProcessStartInfo { FileName = "control", UseShellExecute = true }
+ );
break;
}
}
@@ -252,11 +267,13 @@ public partial class DashboardViewModel : ViewModel
{
try
{
- Process.Start(new ProcessStartInfo
- {
- FileName = UpdaterService.LatestReleaseUrl,
- UseShellExecute = true
- });
+ Process.Start(
+ new ProcessStartInfo
+ {
+ FileName = UpdaterService.LatestReleaseUrl,
+ UseShellExecute = true,
+ }
+ );
}
catch (Exception ex)
{
@@ -272,4 +289,4 @@ public partial class DashboardViewModel : ViewModel
}
#endregion Helpers
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs
index dec0822..540ddbe 100644
--- a/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs
@@ -1,10 +1,10 @@
-using CommunityToolkit.Mvvm.ComponentModel;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.Logging;
using optimizerDuck.Resources.Languages;
using optimizerDuck.Services;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
using Wpf.Ui;
using Wpf.Ui.Controls;
using CleanupItem = optimizerDuck.Domain.Optimizations.Models.Cleanup.CleanupItem;
@@ -14,30 +14,42 @@ namespace optimizerDuck.UI.ViewModels.Pages;
public partial class DiskCleanupViewModel(
DiskCleanupService diskCleanupService,
ISnackbarService snackbarService,
- ILogger<DiskCleanupViewModel> logger) : ViewModel
+ ILogger<DiskCleanupViewModel> logger
+) : ViewModel
{
- [ObservableProperty] private ObservableCollection<CleanupItem> _cleanupItems = [];
+ [ObservableProperty]
+ private ObservableCollection<CleanupItem> _cleanupItems = [];
private bool _initialized;
- [ObservableProperty] private bool _isCleaning;
- [ObservableProperty] private bool _isLoading;
- [ObservableProperty] private bool _isScanning;
+
+ [ObservableProperty]
+ private bool _isCleaning;
+
+ [ObservableProperty]
+ private bool _isLoading;
+
+ [ObservableProperty]
+ private bool _isScanning;
private List<CleanupItem> _originalOrder = [];
// Sort
- [ObservableProperty] private int _selectedSortByIndex; // 0=Size, 1=Name, 2=Path
+ [ObservableProperty]
+ private int _selectedSortByIndex; // 0=Size, 1=Name, 2=Path
public bool HasData => CleanupItems.Count > 0 && !IsLoading;
public bool IsAllScanned => CleanupItems.Count > 0 && CleanupItems.All(i => i.IsScanned);
public int SelectedCount => CleanupItems.Count(i => i.IsSelected);
- public long TotalSelectedSizeBytes => CleanupItems.Where(i => i.IsSelected).Sum(i => i.SizeBytes);
+ public long TotalSelectedSizeBytes =>
+ CleanupItems.Where(i => i.IsSelected).Sum(i => i.SizeBytes);
public string TotalSelectedSizeFormatted => CleanupItem.FormatBytes(TotalSelectedSizeBytes);
- public long TotalSelectedFileCount => CleanupItems.Where(i => i.IsSelected).Sum(i => i.FileCount);
+ public long TotalSelectedFileCount =>
+ CleanupItems.Where(i => i.IsSelected).Sum(i => i.FileCount);
public long TotalSizeBytes => CleanupItems.Sum(i => i.SizeBytes);
public string TotalSizeFormatted => CleanupItem.FormatBytes(TotalSizeBytes);
public long TotalFileCount => CleanupItems.Sum(i => i.FileCount);
- public bool CanClean => SelectedCount > 0 && TotalSelectedSizeBytes > 0 && !IsCleaning && !IsScanning;
+ public bool CanClean =>
+ SelectedCount > 0 && TotalSelectedSizeBytes > 0 && !IsCleaning && !IsScanning;
public bool IsAllSelected => CleanupItems.Count > 0 && CleanupItems.All(i => i.IsSelected);
partial void OnSelectedSortByIndexChanged(int value)
@@ -47,7 +59,8 @@ public partial class DiskCleanupViewModel(
public override async Task OnNavigatedToAsync()
{
- if (_initialized) return;
+ if (_initialized)
+ return;
_initialized = true;
IsLoading = true;
@@ -60,8 +73,12 @@ public partial class DiskCleanupViewModel(
foreach (var item in CleanupItems)
item.PropertyChanged += (_, e) =>
{
- if (e.PropertyName is nameof(CleanupItem.IsSelected) or nameof(CleanupItem.SizeBytes)
- or nameof(CleanupItem.FileCount))
+ if (
+ e.PropertyName
+ is nameof(CleanupItem.IsSelected)
+ or nameof(CleanupItem.SizeBytes)
+ or nameof(CleanupItem.FileCount)
+ )
UpdateProperties();
};
}
@@ -77,14 +94,16 @@ public partial class DiskCleanupViewModel(
await ScanAsync();
- CleanupItems =
- new ObservableCollection<CleanupItem>(CleanupItems.OrderByDescending(i => i.SizeBytes).ToArray());
+ CleanupItems = new ObservableCollection<CleanupItem>(
+ CleanupItems.OrderByDescending(i => i.SizeBytes).ToArray()
+ );
}
[RelayCommand]
private async Task ScanAsync()
{
- if (IsScanning) return;
+ if (IsScanning)
+ return;
IsScanning = true;
try
@@ -105,7 +124,8 @@ public partial class DiskCleanupViewModel(
[RelayCommand]
private async Task CleanSelectedAsync()
{
- if (!CanClean) return;
+ if (!CanClean)
+ return;
IsCleaning = true;
try
@@ -120,14 +140,21 @@ public partial class DiskCleanupViewModel(
snackbarService.Show(
Translations.DiskCleanup_Complete_Title,
- string.Format(Translations.DiskCleanup_Complete_Message, CleanupItem.FormatBytes(freedBytes),
- $"{sw.Elapsed.TotalSeconds:0.0}s"),
+ string.Format(
+ Translations.DiskCleanup_Complete_Message,
+ CleanupItem.FormatBytes(freedBytes),
+ $"{sw.Elapsed.TotalSeconds:0.0}s"
+ ),
ControlAppearance.Success,
new SymbolIcon { Symbol = SymbolRegular.CheckmarkCircle24, Filled = true },
- TimeSpan.FromSeconds(5));
-
- logger.LogInformation("Disk cleanup completed, freed {Size} in {Duration}",
- CleanupItem.FormatBytes(freedBytes), sw.Elapsed);
+ TimeSpan.FromSeconds(5)
+ );
+
+ logger.LogInformation(
+ "Disk cleanup completed, freed {Size} in {Duration}",
+ CleanupItem.FormatBytes(freedBytes),
+ sw.Elapsed
+ );
}
catch (Exception ex)
{
@@ -137,7 +164,8 @@ public partial class DiskCleanupViewModel(
Translations.DiskCleanup_Error_Message,
ControlAppearance.Danger,
new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
- TimeSpan.FromSeconds(5));
+ TimeSpan.FromSeconds(5)
+ );
}
finally
{
@@ -163,7 +191,7 @@ public partial class DiskCleanupViewModel(
0 => CleanupItems.OrderByDescending(i => i.SizeBytes).ToList(),
1 => CleanupItems.OrderBy(i => i.Name).ToList(),
2 => CleanupItems.OrderBy(i => i.Path).ToList(),
- _ => _originalOrder.ToList()
+ _ => _originalOrder.ToList(),
};
for (var i = 0; i < sorted.Count; i++)
@@ -188,4 +216,4 @@ public partial class DiskCleanupViewModel(
OnPropertyChanged(nameof(CanClean));
OnPropertyChanged(nameof(IsAllSelected));
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/ViewModels/Pages/FeaturesViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/FeaturesViewModel.cs
index 14f8a86..9379ac4 100644
--- a/optimizerDuck/UI/ViewModels/Pages/FeaturesViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/FeaturesViewModel.cs
@@ -14,11 +14,14 @@ public partial class FeaturesViewModel : ObservableObject
private readonly INavigationService _navigationService;
private readonly FeatureRegistry _registry;
- [ObservableProperty] private ObservableCollection<FeatureCategoryItemViewModel> _categories = [];
+ [ObservableProperty]
+ private ObservableCollection<FeatureCategoryItemViewModel> _categories = [];
- [ObservableProperty] private bool _isLoading = true;
+ [ObservableProperty]
+ private bool _isLoading = true;
- [ObservableProperty] private string _searchText = string.Empty;
+ [ObservableProperty]
+ private string _searchText = string.Empty;
public FeaturesViewModel(INavigationService navigationService, FeatureRegistry registry)
{
@@ -30,19 +33,25 @@ public partial class FeaturesViewModel : ObservableObject
{
IsLoading = true;
- if (_registry.Categories.Length == 0) _registry.RegisterCategories();
+ if (_registry.Categories.Length == 0)
+ _registry.RegisterCategories();
var categoryViewModels = new ObservableCollection<FeatureCategoryItemViewModel>();
foreach (var category in _registry.Categories)
- categoryViewModels.Add(new FeatureCategoryItemViewModel
- {
- Name = category.Name,
- Description = category.Description,
- Icon = category.Icon,
- CategoryType = category.GetType(),
- PageType = category.GetType().GetCustomAttribute<FeatureCategoryAttribute>()?.PageType
- });
+ categoryViewModels.Add(
+ new FeatureCategoryItemViewModel
+ {
+ Name = category.Name,
+ Description = category.Description,
+ Icon = category.Icon,
+ CategoryType = category.GetType(),
+ PageType = category
+ .GetType()
+ .GetCustomAttribute<FeatureCategoryAttribute>()
+ ?.PageType,
+ }
+ );
Categories = categoryViewModels;
IsLoading = false;
@@ -53,15 +62,25 @@ public partial class FeaturesViewModel : ObservableObject
[RelayCommand]
private void NavigateToCategory(FeatureCategoryItemViewModel featureCategoryItem)
{
- if (featureCategoryItem.PageType != null) _navigationService.Navigate(featureCategoryItem.PageType);
+ if (featureCategoryItem.PageType != null)
+ _navigationService.Navigate(featureCategoryItem.PageType);
}
}
public partial class FeatureCategoryItemViewModel : ObservableObject
{
- [ObservableProperty] private Type? _categoryType;
- [ObservableProperty] private string _description = string.Empty;
- [ObservableProperty] private SymbolRegular _icon;
- [ObservableProperty] private string _name = string.Empty;
- [ObservableProperty] private Type? _pageType;
-}
\ No newline at end of file
+ [ObservableProperty]
+ private Type? _categoryType;
+
+ [ObservableProperty]
+ private string _description = string.Empty;
+
+ [ObservableProperty]
+ private SymbolRegular _icon;
+
+ [ObservableProperty]
+ private string _name = string.Empty;
+
+ [ObservableProperty]
+ private Type? _pageType;
+}
diff --git a/optimizerDuck/UI/ViewModels/Pages/OptimizeViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/OptimizeViewModel.cs
index ed6cc1c..f5f4bf5 100644
--- a/optimizerDuck/UI/ViewModels/Pages/OptimizeViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/OptimizeViewModel.cs
@@ -21,14 +21,19 @@ public class OptimizeViewModel(OptimizationRegistry optimizationService) : ViewM
return Task.CompletedTask;
foreach (var category in optimizationService.OptimizationCategories)
- OptimizationCategories.Add(new NavigationViewItem
- {
- Content = category.Name,
- TargetPageType = category.GetType().GetCustomAttribute<OptimizationCategoryAttribute>()!.PageType
- });
+ OptimizationCategories.Add(
+ new NavigationViewItem
+ {
+ Content = category.Name,
+ TargetPageType = category
+ .GetType()
+ .GetCustomAttribute<OptimizationCategoryAttribute>()!
+ .PageType,
+ }
+ );
OptimizationsLoaded?.Invoke();
_isInitialized = true;
return Task.CompletedTask;
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs
index b8feef4..a6db8b3 100644
--- a/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/ScheduledTasksViewModel.cs
@@ -19,19 +19,26 @@ public partial class ScheduledTasksViewModel : ViewModel
private readonly IContentDialogService _contentDialogService;
private readonly ILogger<ScheduledTasksViewModel> _logger;
private readonly ISnackbarService _snackbarService;
- [ObservableProperty] private bool _hideMicrosoftTasks = true;
+
+ [ObservableProperty]
+ private bool _hideMicrosoftTasks = true;
private bool _isInitialized;
- [ObservableProperty] [NotifyPropertyChangedFor(nameof(IsNotLoading))]
+ [ObservableProperty]
+ [NotifyPropertyChangedFor(nameof(IsNotLoading))]
private bool _isLoading;
- [ObservableProperty] private string _searchText = string.Empty;
- [ObservableProperty] private int _sortByIndex;
+ [ObservableProperty]
+ private string _searchText = string.Empty;
+
+ [ObservableProperty]
+ private int _sortByIndex;
public ScheduledTasksViewModel(
IContentDialogService contentDialogService,
ISnackbarService snackbarService,
- ILogger<ScheduledTasksViewModel> logger)
+ ILogger<ScheduledTasksViewModel> logger
+ )
{
_contentDialogService = contentDialogService;
_snackbarService = snackbarService;
@@ -74,7 +81,8 @@ public partial class ScheduledTasksViewModel : ViewModel
[RelayCommand]
private async Task ToggleTask(ScheduledTaskModel? task)
{
- if (task == null) return;
+ if (task == null)
+ return;
try
{
await Task.Run(() =>
@@ -82,12 +90,20 @@ public partial class ScheduledTasksViewModel : ViewModel
if (task.IsEnabled)
{
ScheduledTaskService.EnableTask(task.FullPath);
- _logger.LogInformation("Enabled task {Name} ({Path})", task.Name, task.FullPath);
+ _logger.LogInformation(
+ "Enabled task {Name} ({Path})",
+ task.Name,
+ task.FullPath
+ );
}
else
{
ScheduledTaskService.DisableTask(task.FullPath);
- _logger.LogInformation("Disabled task {Name} ({Path})", task.Name, task.FullPath);
+ _logger.LogInformation(
+ "Disabled task {Name} ({Path})",
+ task.Name,
+ task.FullPath
+ );
}
});
@@ -98,7 +114,8 @@ public partial class ScheduledTasksViewModel : ViewModel
string.Format(Translations.ScheduledTasks_Snackbar_Toggle_Message, task.Name),
ControlAppearance.Success,
new SymbolIcon { Symbol = SymbolRegular.CheckmarkCircle24, Filled = true },
- TimeSpan.FromSeconds(3));
+ TimeSpan.FromSeconds(3)
+ );
await RefreshTaskState(task);
}
@@ -116,14 +133,16 @@ public partial class ScheduledTasksViewModel : ViewModel
ex.Message,
ControlAppearance.Danger,
new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
- TimeSpan.FromSeconds(5));
+ TimeSpan.FromSeconds(5)
+ );
}
}
[RelayCommand]
private async Task RunTask(ScheduledTaskModel? task)
{
- if (task == null) return;
+ if (task == null)
+ return;
try
{
await Task.Run(() => ScheduledTaskService.RunTask(task.FullPath));
@@ -134,7 +153,8 @@ public partial class ScheduledTasksViewModel : ViewModel
string.Format(Translations.ScheduledTasks_Snackbar_Run_Message, task.Name),
ControlAppearance.Success,
new SymbolIcon { Symbol = SymbolRegular.Play24, Filled = true },
- TimeSpan.FromSeconds(3));
+ TimeSpan.FromSeconds(3)
+ );
await RefreshTaskState(task);
}
@@ -147,14 +167,16 @@ public partial class ScheduledTasksViewModel : ViewModel
ex.Message,
ControlAppearance.Danger,
new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
- TimeSpan.FromSeconds(5));
+ TimeSpan.FromSeconds(5)
+ );
}
}
[RelayCommand]
private async Task StopTask(ScheduledTaskModel? task)
{
- if (task == null) return;
+ if (task == null)
+ return;
try
{
await Task.Run(() => ScheduledTaskService.StopTask(task.FullPath));
@@ -165,7 +187,8 @@ public partial class ScheduledTasksViewModel : ViewModel
string.Format(Translations.ScheduledTasks_Snackbar_Stop_Message, task.Name),
ControlAppearance.Success,
new SymbolIcon { Symbol = SymbolRegular.Stop24, Filled = true },
- TimeSpan.FromSeconds(3));
+ TimeSpan.FromSeconds(3)
+ );
await RefreshTaskState(task);
}
@@ -178,25 +201,28 @@ public partial class ScheduledTasksViewModel : ViewModel
ex.Message,
ControlAppearance.Danger,
new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
- TimeSpan.FromSeconds(5));
+ TimeSpan.FromSeconds(5)
+ );
}
}
[RelayCommand]
private async Task DeleteTask(ScheduledTaskModel? task)
{
- if (task == null) return;
+ if (task == null)
+ return;
var dialog = new ContentDialog
{
Title = Translations.ScheduledTasks_Dialog_DeleteTitle,
Content = string.Format(Translations.ScheduledTasks_Dialog_DeleteMessage, task.Name),
PrimaryButtonText = Translations.Common_Delete,
- CloseButtonText = Translations.Common_Cancel
+ CloseButtonText = Translations.Common_Cancel,
};
var result = await _contentDialogService.ShowAsync(dialog, CancellationToken.None);
- if (result != ContentDialogResult.Primary) return;
+ if (result != ContentDialogResult.Primary)
+ return;
try
{
@@ -210,7 +236,8 @@ public partial class ScheduledTasksViewModel : ViewModel
string.Format(Translations.ScheduledTasks_Snackbar_Delete_Message, task.Name),
ControlAppearance.Success,
new SymbolIcon { Symbol = SymbolRegular.Delete24, Filled = true },
- TimeSpan.FromSeconds(3));
+ TimeSpan.FromSeconds(3)
+ );
}
catch (Exception ex)
{
@@ -221,21 +248,23 @@ public partial class ScheduledTasksViewModel : ViewModel
ex.Message,
ControlAppearance.Danger,
new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
- TimeSpan.FromSeconds(5));
+ TimeSpan.FromSeconds(5)
+ );
}
}
[RelayCommand]
private async Task ViewDetails(ScheduledTaskModel? task)
{
- if (task == null) return;
+ if (task == null)
+ return;
var dialogContent = new ScheduledTaskDetailsDialog { TaskModel = task };
var dialog = new ContentDialog
{
Title = task.Name,
Content = dialogContent,
- CloseButtonText = Translations.Button_Ok
+ CloseButtonText = Translations.Button_Ok,
};
await _contentDialogService.ShowAsync(dialog, CancellationToken.None);
@@ -302,7 +331,8 @@ public partial class ScheduledTasksViewModel : ViewModel
private void ApplyFilter()
{
// Unsubscribe
- foreach (var task in Tasks) task.PropertyChanged -= Task_PropertyChanged;
+ foreach (var task in Tasks)
+ task.PropertyChanged -= Task_PropertyChanged;
Tasks.Clear();
var search = SearchText.Trim();
@@ -314,7 +344,7 @@ public partial class ScheduledTasksViewModel : ViewModel
1 => _allTasks.OrderBy(t => !t.IsEnabled).ThenBy(t => t.Name),
2 => _allTasks.OrderBy(t => t.Path).ThenBy(t => t.Name),
3 => _allTasks.OrderBy(t => t.State).ThenBy(t => t.Name),
- _ => _allTasks.OrderBy(t => t.Name)
+ _ => _allTasks.OrderBy(t => t.Name),
};
foreach (var task in sorted)
@@ -322,11 +352,15 @@ public partial class ScheduledTasksViewModel : ViewModel
if (HideMicrosoftTasks && task.IsMicrosoftTask)
continue;
- if (hasSearch &&
- !task.Name.Contains(search, StringComparison.OrdinalIgnoreCase) &&
- !(task.Description?.Contains(search, StringComparison.OrdinalIgnoreCase) ?? false) &&
- !task.FullPath.Contains(search, StringComparison.OrdinalIgnoreCase) &&
- !task.ActionSummary.Contains(search, StringComparison.OrdinalIgnoreCase))
+ if (
+ hasSearch
+ && !task.Name.Contains(search, StringComparison.OrdinalIgnoreCase)
+ && !(
+ task.Description?.Contains(search, StringComparison.OrdinalIgnoreCase) ?? false
+ )
+ && !task.FullPath.Contains(search, StringComparison.OrdinalIgnoreCase)
+ && !task.ActionSummary.Contains(search, StringComparison.OrdinalIgnoreCase)
+ )
continue;
task.PropertyChanged -= Task_PropertyChanged;
@@ -339,7 +373,10 @@ public partial class ScheduledTasksViewModel : ViewModel
private async void Task_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
- if (e.PropertyName == nameof(ScheduledTaskModel.IsEnabled) && sender is ScheduledTaskModel task)
+ if (
+ e.PropertyName == nameof(ScheduledTaskModel.IsEnabled)
+ && sender is ScheduledTaskModel task
+ )
await ToggleTask(task);
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
index 47beaad..05fb3b8 100644
--- a/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
@@ -1,4 +1,8 @@
-using CommunityToolkit.Mvvm.ComponentModel;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Globalization;
+using System.Windows.Media;
+using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
@@ -8,10 +12,6 @@ using optimizerDuck.Domain.UI;
using optimizerDuck.Resources.Languages;
using optimizerDuck.Services;
using optimizerDuck.Services.Managers;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Globalization;
-using System.Windows.Media;
using Wpf.Ui;
using Wpf.Ui.Appearance;
using Wpf.Ui.Controls;
@@ -25,15 +25,24 @@ public partial class SettingsViewModel(
OptimizationRegistry optimizationRegistry,
IContentDialogService contentDialogService,
ISnackbarService snackbarService,
- ILogger<SettingsViewModel> logger) : ViewModel
+ ILogger<SettingsViewModel> logger
+) : ViewModel
{
- [ObservableProperty] private ApplicationTheme _currentApplicationTheme = ApplicationTheme.Unknown;
+ [ObservableProperty]
+ private ApplicationTheme _currentApplicationTheme = ApplicationTheme.Unknown;
private bool _isInitialized;
- [ObservableProperty] private bool _removeProvisioned;
- [ObservableProperty] private string _selectedCultureName = string.Empty;
- [ObservableProperty] private int _shellTimeoutMs;
- [ObservableProperty] private bool _showSnackbarNotificationAfterAppliedSuccessfully;
+ [ObservableProperty]
+ private bool _removeProvisioned;
+
+ [ObservableProperty]
+ private string _selectedCultureName = string.Empty;
+
+ [ObservableProperty]
+ private int _shellTimeoutMs;
+
+ [ObservableProperty]
+ private bool _showSnackbarNotificationAfterAppliedSuccessfully;
public string Version { get; } = Shared.FileVersion;
//Learn more links
@@ -48,7 +57,7 @@ public partial class SettingsViewModel(
[
new() { DisplayName = "English", Culture = new CultureInfo("en-US") },
new() { DisplayName = "Tiếng Việt", Culture = new CultureInfo("vi-VN") },
- new() { DisplayName = "正體中文", Culture = new CultureInfo("zh-TW") }
+ new() { DisplayName = "正體中文", Culture = new CultureInfo("zh-TW") },
];
public override async Task OnNavigatedToAsync()
@@ -61,8 +70,10 @@ public partial class SettingsViewModel(
{
SelectedCultureName = appOptionsMonitor.CurrentValue.App.Language;
ShellTimeoutMs = appOptionsMonitor.CurrentValue.Optimize.ShellTimeoutMs;
- ShowSnackbarNotificationAfterAppliedSuccessfully =
- appOptionsMonitor.CurrentValue.Optimize.ShowCompletionNotification;
+ ShowSnackbarNotificationAfterAppliedSuccessfully = appOptionsMonitor
+ .CurrentValue
+ .Optimize
+ .ShowCompletionNotification;
RemoveProvisioned = appOptionsMonitor.CurrentValue.Bloatware.RemoveProvisioned;
CurrentApplicationTheme = ApplicationThemeManager.GetAppTheme();
@@ -75,7 +86,8 @@ public partial class SettingsViewModel(
private void OnThemeChanged(ApplicationTheme currentApplicationTheme, Color systemAccent)
{
// Update the theme if it has been changed elsewhere than in the settings.
- if (CurrentApplicationTheme != currentApplicationTheme) CurrentApplicationTheme = currentApplicationTheme;
+ if (CurrentApplicationTheme != currentApplicationTheme)
+ CurrentApplicationTheme = currentApplicationTheme;
}
#region Helpers
@@ -92,7 +104,7 @@ public partial class SettingsViewModel(
CloseButtonText = Translations.Button_Cancel,
DefaultButton = ContentDialogButton.Close,
- MaxWidth = 500
+ MaxWidth = 500,
};
return await contentDialogService.ShowAsync(dialog, CancellationToken.None);
}
@@ -107,11 +119,9 @@ public partial class SettingsViewModel(
try
{
logger.LogInformation("Opening root directory: {Path}", Shared.RootDirectory);
- Process.Start(new ProcessStartInfo
- {
- FileName = Shared.RootDirectory,
- UseShellExecute = true
- });
+ Process.Start(
+ new ProcessStartInfo { FileName = Shared.RootDirectory, UseShellExecute = true }
+ );
}
catch (Exception ex)
{
@@ -129,7 +139,9 @@ public partial class SettingsViewModel(
[RelayCommand]
private async Task ClearResources()
{
- var result = await ConfirmationDialogAsync(Translations.Settings_ClearResources_Description);
+ var result = await ConfirmationDialogAsync(
+ Translations.Settings_ClearResources_Description
+ );
if (result == ContentDialogResult.Primary)
OptimizationService.ClearResources(logger);
}
@@ -137,13 +149,16 @@ public partial class SettingsViewModel(
[RelayCommand]
private async Task ClearAllRevertData()
{
- var result = await ConfirmationDialogAsync(Translations.Settings_ClearRevertData_Description);
+ var result = await ConfirmationDialogAsync(
+ Translations.Settings_ClearRevertData_Description
+ );
if (result == ContentDialogResult.Primary)
{
RevertManager.ClearAllRevertData(logger);
// Refresh optimizations
await OptimizationService.UpdateOptimizationStateAsync(
- optimizationRegistry.OptimizationCategories.SelectMany(c => c.Optimizations));
+ optimizationRegistry.OptimizationCategories.SelectMany(c => c.Optimizations)
+ );
}
}
@@ -152,12 +167,17 @@ public partial class SettingsViewModel(
{
try
{
- logger.LogInformation("Opening acknowledgements page: {Url}", Shared.AcknowledgementsURL);
- Process.Start(new ProcessStartInfo
- {
- FileName = Shared.AcknowledgementsURL,
- UseShellExecute = true
- });
+ logger.LogInformation(
+ "Opening acknowledgements page: {Url}",
+ Shared.AcknowledgementsURL
+ );
+ Process.Start(
+ new ProcessStartInfo
+ {
+ FileName = Shared.AcknowledgementsURL,
+ UseShellExecute = true,
+ }
+ );
}
catch (Exception ex)
{
@@ -181,20 +201,24 @@ public partial class SettingsViewModel(
{
case "Web":
logger.LogInformation("Opening page: {Url}", Shared.WebsiteURL);
- Process.Start(new ProcessStartInfo
- {
- FileName = Shared.WebsiteURL,
- UseShellExecute = true
- });
+ Process.Start(
+ new ProcessStartInfo
+ {
+ FileName = Shared.WebsiteURL,
+ UseShellExecute = true,
+ }
+ );
break;
case "Help":
logger.LogInformation("Opening page: {Url}", Shared.CommunityURL);
- Process.Start(new ProcessStartInfo
- {
- FileName = Shared.CommunityURL,
- UseShellExecute = true
- });
+ Process.Start(
+ new ProcessStartInfo
+ {
+ FileName = Shared.CommunityURL,
+ UseShellExecute = true,
+ }
+ );
break;
}
}
@@ -214,17 +238,23 @@ public partial class SettingsViewModel(
[RelayCommand]
private void ToggleRemoveProvisioned()
{
- if (!_isInitialized) return;
- _ = configManager.SetAsync("bloatware:removeProvisioned",
- (!appOptionsMonitor.CurrentValue.Bloatware.RemoveProvisioned).ToString());
+ if (!_isInitialized)
+ return;
+ _ = configManager.SetAsync(
+ "bloatware:removeProvisioned",
+ (!appOptionsMonitor.CurrentValue.Bloatware.RemoveProvisioned).ToString()
+ );
}
[RelayCommand]
private void ToggleShowCompletionNotification()
{
- if (!_isInitialized) return;
- _ = configManager.SetAsync("optimize:showCompletionNotification",
- (!appOptionsMonitor.CurrentValue.Optimize.ShowCompletionNotification).ToString());
+ if (!_isInitialized)
+ return;
+ _ = configManager.SetAsync(
+ "optimize:showCompletionNotification",
+ (!appOptionsMonitor.CurrentValue.Optimize.ShowCompletionNotification).ToString()
+ );
}
[RelayCommand]
@@ -232,12 +262,17 @@ public partial class SettingsViewModel(
{
try
{
- logger.LogInformation("Opening latest release page: {Url}", UpdaterService.LatestReleaseUrl);
- Process.Start(new ProcessStartInfo
- {
- FileName = UpdaterService.LatestReleaseUrl,
- UseShellExecute = true
- });
+ logger.LogInformation(
+ "Opening latest release page: {Url}",
+ UpdaterService.LatestReleaseUrl
+ );
+ Process.Start(
+ new ProcessStartInfo
+ {
+ FileName = UpdaterService.LatestReleaseUrl,
+ UseShellExecute = true,
+ }
+ );
}
catch (Exception ex)
{
@@ -258,29 +293,41 @@ public partial class SettingsViewModel(
partial void OnSelectedCultureNameChanged(string value)
{
- if (!_isInitialized) return;
- if (string.IsNullOrEmpty(value)) return;
+ if (!_isInitialized)
+ return;
+ if (string.IsNullOrEmpty(value))
+ return;
_ = configManager.SetAsync(x => x.App.Language, value);
- if (value == Loc.CurrentCulture.Name) return;
- contentDialogService.ShowAlertAsync(Translations.Settings_LanguageChanged_Title,
+ if (value == Loc.CurrentCulture.Name)
+ return;
+ contentDialogService.ShowAlertAsync(
+ Translations.Settings_LanguageChanged_Title,
Translations.Settings_LanguageChanged_Description,
- Translations.Button_Ok, CancellationToken.None);
+ Translations.Button_Ok,
+ CancellationToken.None
+ );
}
- partial void OnCurrentApplicationThemeChanged(ApplicationTheme oldValue, ApplicationTheme newValue)
+ partial void OnCurrentApplicationThemeChanged(
+ ApplicationTheme oldValue,
+ ApplicationTheme newValue
+ )
{
- if (!_isInitialized) return;
+ if (!_isInitialized)
+ return;
ApplicationThemeManager.Apply(newValue, updateAccent: false);
_ = configManager.SetAsync(x => x.App.Theme, newValue);
}
partial void OnShellTimeoutMsChanged(int value)
{
- if (!_isInitialized) return;
- if (value <= 0) return;
+ if (!_isInitialized)
+ return;
+ if (value <= 0)
+ return;
_ = configManager.SetAsync(x => x.Optimize.ShellTimeoutMs, value);
}
#endregion Property Changed
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/ViewModels/Pages/StartupManagerViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/StartupManagerViewModel.cs
index ebe1747..57d9e15 100644
--- a/optimizerDuck/UI/ViewModels/Pages/StartupManagerViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/StartupManagerViewModel.cs
@@ -23,22 +23,32 @@ public partial class StartupManagerViewModel : ViewModel
private readonly StartupManagerService _startupManagerService;
// Per-section: Apps
- [ObservableProperty] private string _appSearchText = string.Empty;
- [ObservableProperty] private int _appSortByIndex;
- [ObservableProperty] private bool _hideMicrosoftTasks = true;
+ [ObservableProperty]
+ private string _appSearchText = string.Empty;
+
+ [ObservableProperty]
+ private int _appSortByIndex;
+
+ [ObservableProperty]
+ private bool _hideMicrosoftTasks = true;
private bool _isInitialized;
- [ObservableProperty] [NotifyPropertyChangedFor(nameof(IsNotLoading))]
+ [ObservableProperty]
+ [NotifyPropertyChangedFor(nameof(IsNotLoading))]
private bool _isLoading;
// Per-section: Tasks
- [ObservableProperty] private string _taskSearchText = string.Empty;
- [ObservableProperty] private int _taskSortByIndex;
+ [ObservableProperty]
+ private string _taskSearchText = string.Empty;
+
+ [ObservableProperty]
+ private int _taskSortByIndex;
public StartupManagerViewModel(
StartupManagerService startupManagerService,
IContentDialogService contentDialogService,
- ILogger<StartupManagerViewModel> logger)
+ ILogger<StartupManagerViewModel> logger
+ )
{
_startupManagerService = startupManagerService;
_contentDialogService = contentDialogService;
@@ -74,7 +84,9 @@ public partial class StartupManagerViewModel : ViewModel
{
try
{
- Process.Start(new ProcessStartInfo("ms-settings:startupapps") { UseShellExecute = true });
+ Process.Start(
+ new ProcessStartInfo("ms-settings:startupapps") { UseShellExecute = true }
+ );
}
catch (Exception ex)
{
@@ -112,13 +124,14 @@ public partial class StartupManagerViewModel : ViewModel
[RelayCommand]
private async Task ViewTaskDetails(StartupTask? task)
{
- if (task == null) return;
+ if (task == null)
+ return;
var dialog = new ContentDialog
{
Title = task.TaskName,
Content = new StartupTaskDetailsPanel(task),
- CloseButtonText = Translations.Button_Ok
+ CloseButtonText = Translations.Button_Ok,
};
await _contentDialogService.ShowAsync(dialog, CancellationToken.None);
@@ -188,7 +201,8 @@ public partial class StartupManagerViewModel : ViewModel
private void ApplyAppFilter()
{
- foreach (var app in Apps) app.PropertyChanged -= App_PropertyChanged;
+ foreach (var app in Apps)
+ app.PropertyChanged -= App_PropertyChanged;
Apps.Clear();
var search = AppSearchText.Trim();
@@ -199,15 +213,17 @@ public partial class StartupManagerViewModel : ViewModel
0 => _allApps.OrderBy(a => a.Name),
1 => _allApps.OrderBy(a => !a.IsEnabled).ThenBy(a => a.Name),
2 => _allApps.OrderBy(a => a.LocationDisplay).ThenBy(a => a.Name),
- _ => _allApps.OrderBy(a => a.Name)
+ _ => _allApps.OrderBy(a => a.Name),
};
foreach (var app in sortedApps)
{
- if (hasSearch &&
- !app.Name.Contains(search, StringComparison.OrdinalIgnoreCase) &&
- !app.Command.Contains(search, StringComparison.OrdinalIgnoreCase) &&
- !app.Publisher.Contains(search, StringComparison.OrdinalIgnoreCase))
+ if (
+ hasSearch
+ && !app.Name.Contains(search, StringComparison.OrdinalIgnoreCase)
+ && !app.Command.Contains(search, StringComparison.OrdinalIgnoreCase)
+ && !app.Publisher.Contains(search, StringComparison.OrdinalIgnoreCase)
+ )
continue;
app.PropertyChanged -= App_PropertyChanged;
@@ -221,7 +237,8 @@ public partial class StartupManagerViewModel : ViewModel
private void ApplyTaskFilter()
{
- foreach (var task in Tasks) task.PropertyChanged -= Task_PropertyChanged;
+ foreach (var task in Tasks)
+ task.PropertyChanged -= Task_PropertyChanged;
Tasks.Clear();
var search = TaskSearchText.Trim();
@@ -232,7 +249,7 @@ public partial class StartupManagerViewModel : ViewModel
0 => _allTasks.OrderBy(t => t.TaskName),
1 => _allTasks.OrderBy(t => !t.IsEnabled).ThenBy(t => t.TaskName),
2 => _allTasks.OrderBy(t => t.TaskPath).ThenBy(t => t.TaskName),
- _ => _allTasks.OrderBy(t => t.TaskName)
+ _ => _allTasks.OrderBy(t => t.TaskName),
};
foreach (var task in sortedTasks)
@@ -240,10 +257,14 @@ public partial class StartupManagerViewModel : ViewModel
if (HideMicrosoftTasks && task.IsMicrosoftTask)
continue;
- if (hasSearch &&
- !task.TaskName.Contains(search, StringComparison.OrdinalIgnoreCase) &&
- !(task.Description?.Contains(search, StringComparison.OrdinalIgnoreCase) ?? false) &&
- !task.TaskPath.Contains(search, StringComparison.OrdinalIgnoreCase))
+ if (
+ hasSearch
+ && !task.TaskName.Contains(search, StringComparison.OrdinalIgnoreCase)
+ && !(
+ task.Description?.Contains(search, StringComparison.OrdinalIgnoreCase) ?? false
+ )
+ && !task.TaskPath.Contains(search, StringComparison.OrdinalIgnoreCase)
+ )
continue;
task.PropertyChanged -= Task_PropertyChanged;
@@ -266,4 +287,4 @@ public partial class StartupManagerViewModel : ViewModel
if (e.PropertyName == nameof(StartupTask.IsEnabled) && sender is StartupTask task)
await _startupManagerService.ToggleStartupTask(task, task.IsEnabled);
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/ViewModels/ViewModel.cs b/optimizerDuck/UI/ViewModels/ViewModel.cs
index f2c9763..2c02da2 100644
--- a/optimizerDuck/UI/ViewModels/ViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/ViewModel.cs
@@ -28,11 +28,7 @@ public abstract class ViewModel : ObservableValidator, INavigationAware
return Task.CompletedTask;
}
- public virtual void OnNavigatedTo()
- {
- }
+ public virtual void OnNavigatedTo() { }
- public virtual void OnNavigatedFrom()
- {
- }
-}
\ No newline at end of file
+ public virtual void OnNavigatedFrom() { }
+}
diff --git a/optimizerDuck/UI/ViewModels/Windows/MainWindowViewModel.cs b/optimizerDuck/UI/ViewModels/Windows/MainWindowViewModel.cs
index 771acdb..04aaec7 100644
--- a/optimizerDuck/UI/ViewModels/Windows/MainWindowViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Windows/MainWindowViewModel.cs
@@ -1,7 +1,7 @@
+using System.Diagnostics;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using optimizerDuck.Common.Helpers;
-using System.Diagnostics;
namespace optimizerDuck.UI.ViewModels.Windows;
@@ -20,11 +20,9 @@ public partial class MainWindowViewModel : ObservableObject
{
try
{
- Process.Start(new ProcessStartInfo
- {
- FileName = Shared.ContributeURL,
- UseShellExecute = true
- });
+ Process.Start(
+ new ProcessStartInfo { FileName = Shared.ContributeURL, UseShellExecute = true }
+ );
}
catch
{
@@ -40,15 +38,13 @@ public partial class MainWindowViewModel : ObservableObject
{
try
{
- Process.Start(new ProcessStartInfo
- {
- FileName = Shared.DiscordInviteURL,
- UseShellExecute = true
- });
+ Process.Start(
+ new ProcessStartInfo { FileName = Shared.DiscordInviteURL, UseShellExecute = true }
+ );
}
catch
{
// Silently fail - link opening is a non-critical action
}
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/UI/Windows/MainWindow.xaml b/optimizerDuck/UI/Windows/MainWindow.xaml
index ba6162e..1e1826d 100644
--- a/optimizerDuck/UI/Windows/MainWindow.xaml
+++ b/optimizerDuck/UI/Windows/MainWindow.xaml
@@ -1,151 +1,164 @@
<ui:FluentWindow
- x:Class="optimizerDuck.UI.Windows.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:extensions="clr-namespace:optimizerDuck.Common.Extensions"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:pages="clr-namespace:optimizerDuck.UI.Pages"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- xmlns:viewmodels="clr-namespace:optimizerDuck.UI.ViewModels.Windows"
- xmlns:windows="clr-namespace:optimizerDuck.UI.Windows"
- Title="optimizerDuck"
- Width="1350"
- Height="800"
- d:DataContext="{d:DesignInstance viewmodels:MainWindowViewModel}"
- ui:Design.Background="Black"
- ui:Design.Foreground="White"
- ExtendsContentIntoTitleBar="True"
- SnapsToDevicePixels="True"
- TextOptions.TextRenderingMode="ClearType"
- UseLayoutRounding="True"
- WindowBackdropType="Mica"
- WindowCornerPreference="Round"
- WindowStartupLocation="CenterScreen"
- mc:Ignorable="d">
- <Grid>
- <ui:NavigationView
- x:Name="RootNavigation"
- Margin="0"
- Padding="42,0,42,0"
- FrameMargin="0"
- IsFooterSeparatorVisible="False"
- IsPaneToggleVisible="True"
- IsTopSeparatorVisible="False"
- OpenPaneLength="180"
- PaneDisplayMode="Left"
- TitleBar="{Binding ElementName=TitleBar, Mode=OneWay}">
- <ui:NavigationView.MenuItems>
- <controls:FilledNavigationViewItem
- Content="{extensions:Loc Sidebar.Dashboard}"
- Cursor="Hand"
- Icon="{ui:SymbolIcon Home24}"
- TargetPageType="{x:Type pages:DashboardPage}" />
+ x:Class="optimizerDuck.UI.Windows.MainWindow"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:controls="clr-namespace:optimizerDuck.UI.Controls"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:extensions="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:pages="clr-namespace:optimizerDuck.UI.Pages"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:viewmodels="clr-namespace:optimizerDuck.UI.ViewModels.Windows"
+ xmlns:windows="clr-namespace:optimizerDuck.UI.Windows"
+ Title="optimizerDuck"
+ Width="1350"
+ Height="800"
+ d:DataContext="{d:DesignInstance viewmodels:MainWindowViewModel}"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ ExtendsContentIntoTitleBar="True"
+ SnapsToDevicePixels="True"
+ TextOptions.TextRenderingMode="ClearType"
+ UseLayoutRounding="True"
+ WindowBackdropType="Mica"
+ WindowCornerPreference="Round"
+ WindowStartupLocation="CenterScreen"
+ mc:Ignorable="d"
+>
+ <Grid>
+ <ui:NavigationView
+ x:Name="RootNavigation"
+ Margin="0"
+ Padding="42,0,42,0"
+ FrameMargin="0"
+ IsFooterSeparatorVisible="False"
+ IsPaneToggleVisible="True"
+ IsTopSeparatorVisible="False"
+ OpenPaneLength="180"
+ PaneDisplayMode="Left"
+ TitleBar="{Binding ElementName=TitleBar, Mode=OneWay}"
+ >
+ <ui:NavigationView.MenuItems>
+ <controls:FilledNavigationViewItem
+ Content="{extensions:Loc Sidebar.Dashboard}"
+ Cursor="Hand"
+ Icon="{ui:SymbolIcon Home24}"
+ TargetPageType="{x:Type pages:DashboardPage}"
+ />
- <ui:NavigationViewItemSeparator Margin="0,2,0,2" />
+ <ui:NavigationViewItemSeparator Margin="0,2,0,2" />
- <controls:FilledNavigationViewItem
- Content="{extensions:Loc Sidebar.Optimize}"
- Cursor="Hand"
- Icon="{ui:SymbolIcon Rocket24}"
- TargetPageType="{x:Type pages:OptimizePage}" />
+ <controls:FilledNavigationViewItem
+ Content="{extensions:Loc Sidebar.Optimize}"
+ Cursor="Hand"
+ Icon="{ui:SymbolIcon Rocket24}"
+ TargetPageType="{x:Type pages:OptimizePage}"
+ />
- <ui:NavigationViewItem
- x:Name="FeaturesMenuItem"
- Content="{extensions:Loc Sidebar.Features}"
- Icon="{ui:SymbolIcon ToggleLeft24}" />
+ <ui:NavigationViewItem
+ x:Name="FeaturesMenuItem"
+ Content="{extensions:Loc Sidebar.Features}"
+ Icon="{ui:SymbolIcon ToggleLeft24}"
+ />
- <controls:FilledNavigationViewItem
- Content="{extensions:Loc Sidebar.Bloatware}"
- Cursor="Hand"
- Icon="{ui:SymbolIcon Delete24}"
- TargetPageType="{x:Type pages:BloatwarePage}" />
+ <controls:FilledNavigationViewItem
+ Content="{extensions:Loc Sidebar.Bloatware}"
+ Cursor="Hand"
+ Icon="{ui:SymbolIcon Delete24}"
+ TargetPageType="{x:Type pages:BloatwarePage}"
+ />
- <ui:NavigationViewItemSeparator Margin="0,2,0,2" />
+ <ui:NavigationViewItemSeparator Margin="0,2,0,2" />
- <controls:FilledNavigationViewItem
- Content="{extensions:Loc Sidebar.StartupManager}"
- Cursor="Hand"
- Icon="{ui:SymbolIcon WindowArrowUp24}"
- TargetPageType="{x:Type pages:StartupManagerPage}" />
+ <controls:FilledNavigationViewItem
+ Content="{extensions:Loc Sidebar.StartupManager}"
+ Cursor="Hand"
+ Icon="{ui:SymbolIcon WindowArrowUp24}"
+ TargetPageType="{x:Type pages:StartupManagerPage}"
+ />
- <controls:FilledNavigationViewItem
- Content="{extensions:Loc Sidebar.ScheduledTasks}"
- Cursor="Hand"
- Icon="{ui:SymbolIcon CalendarLtr24}"
- TargetPageType="{x:Type pages:ScheduledTasksPage}" />
+ <controls:FilledNavigationViewItem
+ Content="{extensions:Loc Sidebar.ScheduledTasks}"
+ Cursor="Hand"
+ Icon="{ui:SymbolIcon CalendarLtr24}"
+ TargetPageType="{x:Type pages:ScheduledTasksPage}"
+ />
- <controls:FilledNavigationViewItem
- Content="{extensions:Loc Sidebar.DiskCleanup}"
- Cursor="Hand"
- Icon="{ui:SymbolIcon HardDrive20}"
- TargetPageType="{x:Type pages:DiskCleanupPage}" />
- </ui:NavigationView.MenuItems>
+ <controls:FilledNavigationViewItem
+ Content="{extensions:Loc Sidebar.DiskCleanup}"
+ Cursor="Hand"
+ Icon="{ui:SymbolIcon HardDrive20}"
+ TargetPageType="{x:Type pages:DiskCleanupPage}"
+ />
+ </ui:NavigationView.MenuItems>
- <ui:NavigationView.FooterMenuItems>
- <ui:NavigationViewItemSeparator Margin="0,2,0,2" />
- <controls:FilledNavigationViewItem
- Content="{extensions:Loc Sidebar.Settings}"
- Cursor="Hand"
- Icon="{ui:SymbolIcon Settings24}"
- TargetPageType="{x:Type pages:SettingsPage}" />
- </ui:NavigationView.FooterMenuItems>
+ <ui:NavigationView.FooterMenuItems>
+ <ui:NavigationViewItemSeparator Margin="0,2,0,2" />
+ <controls:FilledNavigationViewItem
+ Content="{extensions:Loc Sidebar.Settings}"
+ Cursor="Hand"
+ Icon="{ui:SymbolIcon Settings24}"
+ TargetPageType="{x:Type pages:SettingsPage}"
+ />
+ </ui:NavigationView.FooterMenuItems>
- <ui:NavigationView.ContentOverlay>
- <Grid>
- <ui:SnackbarPresenter x:Name="SnackbarPresenter" />
- </Grid>
- </ui:NavigationView.ContentOverlay>
- </ui:NavigationView>
+ <ui:NavigationView.ContentOverlay>
+ <Grid>
+ <ui:SnackbarPresenter x:Name="SnackbarPresenter" />
+ </Grid>
+ </ui:NavigationView.ContentOverlay>
+ </ui:NavigationView>
- <ui:TitleBar x:Name="TitleBar">
- <ui:TitleBar.Header>
- <StackPanel
- Margin="10,0,0,0"
- VerticalAlignment="Center"
- Orientation="Horizontal">
- <ui:SymbolIcon
- FontSize="16"
- Foreground="{DynamicResource TextFillColorDisabledBrush}"
- Symbol="Shield24" />
- <ui:ImageIcon
- Height="25"
- Margin="7,0,5,0"
- VerticalAlignment="Center"
- Source="pack://application:,,,/Resources/Images/Duck.png" />
- <ui:TextBlock
- Margin="0,0,5,0"
- VerticalAlignment="Center"
- FontTypography="Body"
- Text="optimizerDuck" />
- <ui:TextBlock
- VerticalAlignment="Center"
- Appearance="Disabled"
- FontTypography="Body"
- Text="{Binding Version, Mode=OneWay}" />
- </StackPanel>
- </ui:TitleBar.Header>
+ <ui:TitleBar x:Name="TitleBar">
+ <ui:TitleBar.Header>
+ <StackPanel Margin="10,0,0,0" VerticalAlignment="Center" Orientation="Horizontal">
+ <ui:SymbolIcon
+ FontSize="16"
+ Foreground="{DynamicResource TextFillColorDisabledBrush}"
+ Symbol="Shield24"
+ />
+ <ui:ImageIcon
+ Height="25"
+ Margin="7,0,5,0"
+ VerticalAlignment="Center"
+ Source="pack://application:,,,/Resources/Images/Duck.png"
+ />
+ <ui:TextBlock
+ Margin="0,0,5,0"
+ VerticalAlignment="Center"
+ FontTypography="Body"
+ Text="optimizerDuck"
+ />
+ <ui:TextBlock
+ VerticalAlignment="Center"
+ Appearance="Disabled"
+ FontTypography="Body"
+ Text="{Binding Version, Mode=OneWay}"
+ />
+ </StackPanel>
+ </ui:TitleBar.Header>
- <ui:TitleBar.TrailingContent>
- <StackPanel VerticalAlignment="Center" Orientation="Horizontal">
- <ui:Button
- Margin="0,0,5,0"
- Appearance="Transparent"
- Command="{Binding OpenSupportLinkCommand}"
- Icon="{ui:SymbolIcon Heart24}">
+ <ui:TitleBar.TrailingContent>
+ <StackPanel VerticalAlignment="Center" Orientation="Horizontal">
+ <ui:Button
+ Margin="0,0,5,0"
+ Appearance="Transparent"
+ Command="{Binding OpenSupportLinkCommand}"
+ Icon="{ui:SymbolIcon Heart24}"
+ >
Support the project
</ui:Button>
- <ui:Button
- Appearance="Transparent"
- Command="{Binding OpenDiscordLinkCommand}"
- Icon="{ui:SymbolIcon Link24}">
+ <ui:Button
+ Appearance="Transparent"
+ Command="{Binding OpenDiscordLinkCommand}"
+ Icon="{ui:SymbolIcon Link24}"
+ >
Join our Discord
</ui:Button>
- </StackPanel>
- </ui:TitleBar.TrailingContent>
- </ui:TitleBar>
+ </StackPanel>
+ </ui:TitleBar.TrailingContent>
+ </ui:TitleBar>
- <ui:ContentDialogHost x:Name="RootContentDialogPresenter" />
- </Grid>
-</ui:FluentWindow>
\ No newline at end of file
+ <ui:ContentDialogHost x:Name="RootContentDialogPresenter" />
+ </Grid>
+</ui:FluentWindow>
diff --git a/optimizerDuck/UI/Windows/MainWindow.xaml.cs b/optimizerDuck/UI/Windows/MainWindow.xaml.cs
index 1e8b2a1..3fcb939 100644
--- a/optimizerDuck/UI/Windows/MainWindow.xaml.cs
+++ b/optimizerDuck/UI/Windows/MainWindow.xaml.cs
@@ -1,4 +1,5 @@
-using Microsoft.Extensions.Options;
+using System.Windows;
+using Microsoft.Extensions.Options;
using optimizerDuck.Domain.Abstractions;
using optimizerDuck.Domain.Configuration;
using optimizerDuck.Resources.Languages;
@@ -7,7 +8,6 @@ using optimizerDuck.Services.Managers;
using optimizerDuck.UI.Dialogs;
using optimizerDuck.UI.Pages;
using optimizerDuck.UI.ViewModels.Windows;
-using System.Windows;
using Wpf.Ui;
using Wpf.Ui.Abstractions;
using Wpf.Ui.Controls;
@@ -20,8 +20,16 @@ public partial class MainWindow : IWindow
private readonly IOptionsMonitor<AppSettings> _appOptionsMonitor;
private readonly ConfigManager _configManager;
- public MainWindow(MainWindowViewModel viewModel, ConfigManager configManager, INavigationService navigationService, IContentDialogService contentDialogService,
- INavigationViewPageProvider pageProvider, IOptionsMonitor<AppSettings> appOptionsMonitor, ISnackbarService snackbarService, FeatureRegistry featureRegistry)
+ public MainWindow(
+ MainWindowViewModel viewModel,
+ ConfigManager configManager,
+ INavigationService navigationService,
+ IContentDialogService contentDialogService,
+ INavigationViewPageProvider pageProvider,
+ IOptionsMonitor<AppSettings> appOptionsMonitor,
+ ISnackbarService snackbarService,
+ FeatureRegistry featureRegistry
+ )
{
_contentDialogService = contentDialogService;
_appOptionsMonitor = appOptionsMonitor;
@@ -37,7 +45,8 @@ public partial class MainWindow : IWindow
RootNavigation.SetPageProviderService(pageProvider);
var toggleItems = featureRegistry.GetNavigationItems();
- foreach (var item in toggleItems) FeaturesMenuItem.MenuItems.Add(item);
+ foreach (var item in toggleItems)
+ FeaturesMenuItem.MenuItems.Add(item);
RootNavigation.Loaded += OnRootNavigationLoaded;
}
@@ -48,7 +57,6 @@ public partial class MainWindow : IWindow
if (!_appOptionsMonitor.CurrentValue.App.LegalAccepted)
{
-
var legalDialog = new LegalDialog();
var dialog = new ContentDialog
{
@@ -56,7 +64,7 @@ public partial class MainWindow : IWindow
Content = legalDialog,
PrimaryButtonText = Translations.Button_Accept,
CloseButtonText = Translations.Button_Close,
- DefaultButton = ContentDialogButton.Primary
+ DefaultButton = ContentDialogButton.Primary,
};
var result = await _contentDialogService.ShowAsync(dialog, CancellationToken.None);
@@ -73,4 +81,4 @@ public partial class MainWindow : IWindow
RootNavigation.Navigate(typeof(DashboardPage));
}
-}
\ No newline at end of file
+}
diff --git a/optimizerDuck/optimizerDuck.csproj b/optimizerDuck/optimizerDuck.csproj
index 3f5cd7c..f499969 100644
--- a/optimizerDuck/optimizerDuck.csproj
+++ b/optimizerDuck/optimizerDuck.csproj
@@ -1,81 +1,79 @@
<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>WinExe</OutputType>
+ <TargetFramework>net10.0-windows10.0.17763.0</TargetFramework>
+ <LangVersion>latest</LangVersion>
+ <Nullable>enable</Nullable>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <UseWPF>true</UseWPF>
+ <Authors>fatDuck</Authors>
+ <ApplicationIcon>Logo.ico</ApplicationIcon>
+ <Company>fatDuck</Company>
+ <FileVersion>2.9.1</FileVersion>
+ <Version>1.0.0</Version>
+ <Product>optimizerDuck</Product>
+ <Copyright>Copyright fatDuck 2026</Copyright>
+ <AssemblyTitle>optimizerDuck</AssemblyTitle>
+ <AssemblyDescription>Free, open-source Windows optimization tool for performance, privacy, and simplicity.</AssemblyDescription>
+ <NeutralLanguage>en-US</NeutralLanguage>
+ <ApplicationManifest>app.manifest</ApplicationManifest>
+ </PropertyGroup>
- <PropertyGroup>
- <OutputType>WinExe</OutputType>
- <TargetFramework>net10.0-windows10.0.17763.0</TargetFramework>
- <LangVersion>latest</LangVersion>
- <Nullable>enable</Nullable>
- <ImplicitUsings>enable</ImplicitUsings>
- <UseWPF>true</UseWPF>
- <Authors>fatDuck</Authors>
- <ApplicationIcon>Logo.ico</ApplicationIcon>
- <Company>fatDuck</Company>
- <FileVersion>2.9.1</FileVersion>
- <Version>1.0.0</Version>
- <Product>optimizerDuck</Product>
- <Copyright>Copyright fatDuck 2026</Copyright>
- <AssemblyTitle>optimizerDuck</AssemblyTitle>
- <AssemblyDescription>Free, open-source Windows optimization tool for performance, privacy, and simplicity.</AssemblyDescription>
- <NeutralLanguage>en-US</NeutralLanguage>
- <ApplicationManifest>app.manifest</ApplicationManifest>
- </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+ <PlatformTarget>x64</PlatformTarget>
+ </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
- <PlatformTarget>x64</PlatformTarget>
- </PropertyGroup>
+ <ItemGroup>
+ <Page Update="UI\Windows\MainWindow.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <XamlRuntime>Wpf</XamlRuntime>
+ <SubType>Designer</SubType>
+ </Page>
+ <Page Update="UI\Pages\Optimize\Categories\OptimizationPage.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <XamlRuntime>Wpf</XamlRuntime>
+ <SubType>Designer</SubType>
+ </Page>
+ <Page Update="UI\Pages\Features\FeaturesPage.xaml">
+ <XamlRuntime>Wpf</XamlRuntime>
+ <SubType>Designer</SubType>
+ </Page>
+ </ItemGroup>
- <ItemGroup>
- <Page Update="UI\Windows\MainWindow.xaml">
- <Generator>MSBuild:Compile</Generator>
- <XamlRuntime>Wpf</XamlRuntime>
- <SubType>Designer</SubType>
- </Page>
- <Page Update="UI\Pages\Optimize\Categories\OptimizationPage.xaml">
- <Generator>MSBuild:Compile</Generator>
- <XamlRuntime>Wpf</XamlRuntime>
- <SubType>Designer</SubType>
- </Page>
- <Page Update="UI\Pages\Features\FeaturesPage.xaml">
- <XamlRuntime>Wpf</XamlRuntime>
- <SubType>Designer</SubType>
- </Page>
- </ItemGroup>
+ <ItemGroup>
+ <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
+ <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.5" />
+ <PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.5" />
+ <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.5" />
+ <PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
+ <PackageReference Include="Serilog" Version="4.3.1" />
+ <PackageReference Include="Serilog.Extensions.Hosting" Version="10.0.0" />
+ <PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
+ <PackageReference Include="System.Management.Automation" Version="7.6.0" />
+ <PackageReference Include="TaskScheduler" Version="2.12.2" />
+ <PackageReference Include="WPF-UI" Version="4.2.0" />
+ <PackageReference Include="WPF-UI.DependencyInjection" Version="4.2.0" />
+ </ItemGroup>
- <ItemGroup>
- <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
- <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.5" />
- <PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.5" />
- <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.5" />
- <PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
- <PackageReference Include="Serilog" Version="4.3.1" />
- <PackageReference Include="Serilog.Extensions.Hosting" Version="10.0.0" />
- <PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
- <PackageReference Include="System.Management.Automation" Version="7.6.0" />
- <PackageReference Include="TaskScheduler" Version="2.12.2" />
- <PackageReference Include="WPF-UI" Version="4.2.0" />
- <PackageReference Include="WPF-UI.DependencyInjection" Version="4.2.0" />
- </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Update="Resources\Languages\Translations.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Translations.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Update="Resources\Languages\Translations.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Translations.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- </ItemGroup>
-
- <ItemGroup>
- <Resource Include="Resources\Images\Duck.png" />
- <Resource Include="Resources\Images\GitHubLogoBlack.png" />
- <Resource Include="Resources\Images\GitHubLogoWhite.png" />
- <Resource Include="Resources\Images\DiscordLogo.png" />
- </ItemGroup>
-
- <ItemGroup>
- <Compile Update="Resources\Languages\Translations.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>Translations.resx</DependentUpon>
- </Compile>
- </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Resources\Images\Duck.png" />
+ <Resource Include="Resources\Images\GitHubLogoBlack.png" />
+ <Resource Include="Resources\Images\GitHubLogoWhite.png" />
+ <Resource Include="Resources\Images\DiscordLogo.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Update="Resources\Languages\Translations.Designer.cs">
+ <DesignTime>True</DesignTime>
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Translations.resx</DependentUpon>
+ </Compile>
+ </ItemGroup>
</Project>