Files
PowerToys/src/modules/powerdisplay/PowerDisplay.Lib/Models/MonitorStateEntry.cs
Yu Leng 15746e8f45 Refactor and enhance monitor management system
Refactored namespaces to improve modularity, including moving `PowerDisplay.Native` to `PowerDisplay.Common.Drivers`. Introduced the `IMonitorData` interface for better abstraction of monitor hardware data. Replaced `ColorTemperature` with `ColorTemperatureVcp` for precise VCP-based color temperature control, adding utilities for Kelvin conversion.

Enhanced monitor state management with a new `MonitorStateFile` for JSON persistence and updated `MonitorStateManager` for debounced saves. Added `MonitorMatchingHelper` for consistent monitor identification and `ProfileHelper` for profile management operations.

Refactored P/Invoke declarations into helper classes, updated UI bindings for `ColorTemperatureVcp`, and improved logging for better runtime visibility. Removed redundant code, added new utility classes (`MonitorValueConverter`, `MonitorMatchingHelper`), and ensured backward compatibility.

These changes improve code organization, maintainability, and extensibility while aligning with hardware-level control standards.
2025-11-24 21:58:34 +08:00

53 lines
1.6 KiB
C#

// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Text.Json.Serialization;
namespace PowerDisplay.Common.Models
{
/// <summary>
/// Individual monitor state entry for JSON persistence.
/// Stores the current state of a monitor's adjustable parameters.
/// </summary>
public sealed class MonitorStateEntry
{
/// <summary>
/// Gets or sets the brightness level (0-100).
/// </summary>
[JsonPropertyName("brightness")]
public int Brightness { get; set; }
/// <summary>
/// Gets or sets the color temperature VCP value.
/// </summary>
[JsonPropertyName("colorTemperature")]
public int ColorTemperatureVcp { get; set; }
/// <summary>
/// Gets or sets the contrast level (0-100).
/// </summary>
[JsonPropertyName("contrast")]
public int Contrast { get; set; }
/// <summary>
/// Gets or sets the volume level (0-100).
/// </summary>
[JsonPropertyName("volume")]
public int Volume { get; set; }
/// <summary>
/// Gets or sets the raw capabilities string from DDC/CI.
/// </summary>
[JsonPropertyName("capabilitiesRaw")]
public string? CapabilitiesRaw { get; set; }
/// <summary>
/// Gets or sets when this entry was last updated.
/// </summary>
[JsonPropertyName("lastUpdated")]
public DateTime LastUpdated { get; set; }
}
}