From 27a1052f5502dc22065c241e33f953ef219f0f54 Mon Sep 17 00:00:00 2001 From: Janus Date: Tue, 27 Aug 2024 20:02:33 +0200 Subject: [PATCH] Fix Awake v1 & v2 --- System/Computer/Awake/Awake.v1.cs | 5 ++++- System/Computer/Awake/Awake.v2.cs | 1 + System/System.csproj | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/System/Computer/Awake/Awake.v1.cs b/System/Computer/Awake/Awake.v1.cs index b16565a..804dda2 100644 --- a/System/Computer/Awake/Awake.v1.cs +++ b/System/Computer/Awake/Awake.v1.cs @@ -39,10 +39,13 @@ public static void SetIndefiniteKeepAwake(bool keepDisplayOn = false) /// /// /// - public static void SetIndefiniteKeepAwake(Action? callback, Action? failureCallback, bool keepDisplayOn = false) + public static void SetIndefiniteKeepAwake(Action callback, Action? failureCallback, bool keepDisplayOn = false) { _cts.Cancel(); + callback ??= (bool success) => { }; + failureCallback ??= () => { }; + try { if (_runnerThread != null && !_runnerThread.IsCanceled) diff --git a/System/Computer/Awake/Awake.v2.cs b/System/Computer/Awake/Awake.v2.cs index 76c4744..05cba2d 100644 --- a/System/Computer/Awake/Awake.v2.cs +++ b/System/Computer/Awake/Awake.v2.cs @@ -24,6 +24,7 @@ static Awake() { _log = LogManager.GetCurrentClassLogger(); _cts = new CancellationTokenSource(); + _stateQueue = []; StartMonitor(); } diff --git a/System/System.csproj b/System/System.csproj index 89d2bce..b898a2e 100644 --- a/System/System.csproj +++ b/System/System.csproj @@ -20,10 +20,10 @@ README.md FrenchyApps42 logo.png - 1.0.2 - 1.0.2 + 1.1.0 + 1.1.0 Implement Awake from Microsoft Powertoys - 1.0.2.1 + 1.1.0