Make DisplayChangeWatcher a partial class; add fields

The `DisplayChangeWatcher` class is now a partial class, enabling its definition to be split across multiple files. Added two private fields: `_dispatcherQueue` for managing thread-safe operations and `_debounceDelay` for debouncing with a 1-second delay. Updated the `DeviceWatcher` field to use nullable reference types (`DeviceWatcher?`).
This commit is contained in:
Yu Leng
2025-12-08 14:17:05 +08:00
parent ce9bd1e67e
commit b624dd2b03

View File

@@ -16,7 +16,7 @@ namespace PowerDisplay.Helpers;
/// Watches for display/monitor connection changes using WinRT DeviceWatcher.
/// Triggers DisplayChanged event when monitors are added, removed, or updated.
/// </summary>
public sealed class DisplayChangeWatcher : IDisposable
public sealed partial class DisplayChangeWatcher : IDisposable
{
private readonly DispatcherQueue _dispatcherQueue;
private readonly TimeSpan _debounceDelay = TimeSpan.FromSeconds(1);