Commit Graph

6 Commits

Author SHA1 Message Date
Yu Leng
5f15229691 Refactor: use Polly, ConcurrentDictionary, unify VCP parsing
- Replace custom retry logic with Polly.Core resilience pipelines for DDC/CI operations
- Remove LockedDictionary and RetryHelper; use ConcurrentDictionary for thread safety
- Add MonitorFeatureHelper to centralize VCP feature parsing
- Simplify monitor state management and update code for clarity
- Add Polly.Core dependency and update documentation
- Remove obsolete helper files
2025-12-11 10:52:51 +08:00
Yu Leng
a05859efc8 Remove unused monitor helpers and simplify utilities
Removed obsolete helper methods and the MonitorFeatureHelper class, streamlining monitor feature parsing and value conversion logic. Cleaned up thread-safe dictionary utilities by dropping rarely used methods. Updated application icon path in project file. Documentation comments were clarified for consistency.
2025-12-10 19:30:17 +08:00
Yu Leng
1f425f9540 Add input source control support to monitor settings
Introduced support for input source control across the app.

- Added `SupportsInputSource` and `EnableInputSource` properties to data models (`FeatureSupportResult`, `MonitorInfo`, etc.).
- Updated `MainViewModel` and `MonitorViewModel` to handle input source visibility (`ShowInputSource`) and initialization.
- Modified XAML bindings to reflect the new `ShowInputSource` property.
- Enhanced `PowerDisplayPage.xaml` with a checkbox for enabling/disabling input source control.
- Added localization for the input source control checkbox.
- Implemented signaling (`SignalSettingsUpdated`) to notify `PowerDisplay` of feature visibility changes.
- Improved logging to include input source feature status.
- Performed general code cleanup and added clarifying comments.

These changes ensure the input source control feature is configurable, persists user preferences, and integrates seamlessly with the existing application.
2025-11-28 00:05:48 +08:00
Yu Leng
12916deca0 Refactor: Simplify codebase and remove unused methods
Removed unused methods across multiple files, including `GetContrastAsync`, `GetVolumeAsync`, and `SaveCurrentSettingsAsync` in `DdcCiController.cs` and `WmiController.cs`. Simplified the `IMonitorController` interface by removing redundant methods.

Replaced `ProcessThemeChangeAsync` with a synchronous `ProcessThemeChange` in `LightSwitchListener.cs`. Changed `ParseVcpCodesToIntegers` visibility to private in `MonitorFeatureHelper.cs` and removed related helper methods.

Eliminated retry logic by removing `ExecuteWithRetryAsync` in `RetryHelper.cs`. Simplified `SetBrightnessAsync` in `MonitorManager.cs` using a generic helper. Streamlined `DisplayName` in `MonitorViewModel.cs` and removed unnecessary property change notifications.

These changes reduce complexity, improve maintainability, and streamline the codebase by removing unused or redundant functionality.
2025-11-27 22:43:28 +08:00
Yu Leng
de44da04de Refactor and enhance monitor control logic
- Consolidated brightness and capabilities retrieval logic with `GetBrightnessInfoCore` and `RetryHelper` for improved modularity and resiliency.
- Introduced `LockedDictionary` for thread-safe dictionary operations, replacing manual locking in `PhysicalMonitorHandleManager` and `MonitorStateManager`.
- Refactored monitor discovery in `MonitorManager` to separate discovery, initialization, and validation steps for better maintainability.
- Simplified event registration in `App.xaml.cs` with helper methods to reduce repetitive code.
- Enhanced VCP code handling with new methods for formatted and sorted VCP code retrieval.
- Added `SuspendNotifications` in `MonitorInfo` to optimize batch property updates and improve UI performance.
- Simplified parameter update methods in `MonitorViewModel` by removing redundant `fromProfile` logic.
- Improved state management with synchronous save support and reusable JSON building logic in `MonitorStateManager`.
- Updated UI bindings in `ProfileEditorDialog.xaml` and improved VCP code display in `MainViewModel`.
- Cleaned up redundant code, improved logging, and standardized method naming for better readability and maintainability.
2025-11-26 05:02:49 +08:00
Yu Leng
580651b47a Refactor PowerDisplay module and add shared library
Introduced `PowerDisplay.Lib` to centralize shared logic and models, improving modularity and reusability. Refactored namespaces, moving classes to `PowerDisplay.Common`. Added utilities like `ColorTemperatureHelper` and `MonitorFeatureHelper` for consistent logic.

Replaced `ProfileManager` with `ProfileService` for centralized profile management. Enhanced event handling, monitor state management, and settings synchronization. Improved color temperature handling and feature detection.

Removed redundant code and converters. Updated `Settings.UI.Library` and XAML bindings to use shared models. Enhanced logging, serialization, and disposal logic. Updated project files and added documentation for better maintainability.
2025-11-24 18:08:11 +08:00