mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
Refactor PowerDisplay and cleanup resources
Added detailed XML documentation to the `Monitor` class in the `PowerDisplay.Common.Models` namespace, improving clarity and providing usage guidelines for properties like `Id`, `HardwareId`, and `DeviceKey`. Enhanced the `Ddc` class in `PowerDisplay.Configuration` with `<remarks>` referencing centralized VCP code definitions, and removed hardcoded VCP constants to eliminate redundancy. Cleaned up `Resources.resw.bak` by removing unused or deprecated localized strings. This includes strings for shortcut conflict resolution, search results, the "Power Display" utility, and the "Light Switch" feature, suggesting deprecation or restructuring of these features.
This commit is contained in:
@@ -14,6 +14,15 @@ namespace PowerDisplay.Common.Models
|
||||
/// Monitor model that implements property change notification.
|
||||
/// Implements IMonitorData to provide a common interface for monitor hardware values.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para><b>Monitor Identifier Hierarchy:</b></para>
|
||||
/// <list type="bullet">
|
||||
/// <item><see cref="Id"/>: Runtime identifier for UI and IPC (e.g., "DDC_GSM5C6D", "WMI_DISPLAY\BOE...")</item>
|
||||
/// <item><see cref="HardwareId"/>: EDID-based identifier for persistent storage (e.g., "GSM5C6D")</item>
|
||||
/// <item><see cref="DeviceKey"/>: Windows device path for handle management (e.g., "\\?\DISPLAY#...")</item>
|
||||
/// </list>
|
||||
/// <para>Use <see cref="Id"/> for lookups, <see cref="HardwareId"/> for saving state, <see cref="DeviceKey"/> for handle reuse.</para>
|
||||
/// </remarks>
|
||||
public partial class Monitor : INotifyPropertyChanged, IMonitorData
|
||||
{
|
||||
private int _currentBrightness;
|
||||
@@ -22,13 +31,23 @@ namespace PowerDisplay.Common.Models
|
||||
private bool _isAvailable = true;
|
||||
|
||||
/// <summary>
|
||||
/// Unique identifier (based on hardware ID)
|
||||
/// Runtime unique identifier for UI lookups and IPC communication.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Format: "{Source}_{HardwareId}" where Source is "DDC" or "WMI".
|
||||
/// Examples: "DDC_GSM5C6D", "WMI_DISPLAY\BOE0900...".
|
||||
/// Use this for ViewModel lookups and MonitorManager method parameters.
|
||||
/// </remarks>
|
||||
public string Id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Hardware ID (EDID format like GSM5C6D)
|
||||
/// EDID-based hardware identifier for persistent state storage.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Format: Manufacturer code + product code from EDID (e.g., "GSM5C6D" for LG monitors).
|
||||
/// Use this for saving/loading monitor settings in MonitorStateManager.
|
||||
/// Stable across reboots but not guaranteed unique if multiple identical monitors are connected.
|
||||
/// </remarks>
|
||||
public string HardwareId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
@@ -224,8 +243,13 @@ namespace PowerDisplay.Common.Models
|
||||
public IntPtr Handle { get; set; } = IntPtr.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// Device key - unique identifier part of device path
|
||||
/// Windows device path fragment for physical monitor handle management.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Format: Registry-style path from DisplayDeviceInfo (e.g., "\\?\DISPLAY#GSM5C6D#...").
|
||||
/// Used by PhysicalMonitorHandleManager to reuse handles across monitor discovery cycles.
|
||||
/// Changes when monitor is reconnected to a different port.
|
||||
/// </remarks>
|
||||
public string DeviceKey { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -38,6 +38,9 @@ namespace PowerDisplay.Configuration
|
||||
/// <summary>
|
||||
/// DDC/CI protocol constants
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// VCP codes are defined in <see cref="Common.Drivers.NativeConstants"/> to avoid duplication.
|
||||
/// </remarks>
|
||||
public static class Ddc
|
||||
{
|
||||
/// <summary>
|
||||
@@ -54,19 +57,6 @@ namespace PowerDisplay.Configuration
|
||||
/// Timeout for getting monitor capabilities in milliseconds
|
||||
/// </summary>
|
||||
public const int CapabilitiesTimeoutMs = 5000;
|
||||
|
||||
// VCP Codes
|
||||
/// <summary>VCP code for Brightness (0x10)</summary>
|
||||
public const byte VcpBrightness = 0x10;
|
||||
|
||||
/// <summary>VCP code for Contrast (0x12)</summary>
|
||||
public const byte VcpContrast = 0x12;
|
||||
|
||||
/// <summary>VCP code for Select Color Preset / Color Temperature (0x14)</summary>
|
||||
public const byte VcpColorTemperature = 0x14;
|
||||
|
||||
/// <summary>VCP code for Input Source (0x60)</summary>
|
||||
public const byte VcpInputSource = 0x60;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user