Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Awake v1 & v2 #20

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion System/Computer/Awake/Awake.v1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/// <param name="keepDisplayOn"></param>
public static void SetIndefiniteKeepAwake(bool keepDisplayOn = false)
{
SetIndefiniteKeepAwake(null, null, keepDisplayOn);

Check warning on line 33 in System/Computer/Awake/Awake.v1.cs

View workflow job for this annotation

GitHub Actions / build

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in System/Computer/Awake/Awake.v1.cs

View workflow job for this annotation

GitHub Actions / build

Cannot convert null literal to non-nullable reference type.
}

/// <summary>
Expand All @@ -39,10 +39,13 @@
/// <param name="callback"></param>
/// <param name="failureCallback"></param>
/// <param name="keepDisplayOn"></param>
public static void SetIndefiniteKeepAwake(Action<bool>? callback, Action? failureCallback, bool keepDisplayOn = false)
public static void SetIndefiniteKeepAwake(Action<bool> callback, Action? failureCallback, bool keepDisplayOn = false)
{
_cts.Cancel();

callback ??= (bool success) => { };
failureCallback ??= () => { };

try
{
if (_runnerThread != null && !_runnerThread.IsCanceled)
Expand Down
1 change: 1 addition & 0 deletions System/Computer/Awake/Awake.v2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ static Awake()
{
_log = LogManager.GetCurrentClassLogger();
_cts = new CancellationTokenSource();
_stateQueue = [];
StartMonitor();
}

Expand Down
6 changes: 3 additions & 3 deletions System/System.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<Company>FrenchyApps42</Company>
<PackageIcon>logo.png</PackageIcon>
<Version>1.0.2</Version>
<AssemblyVersion>1.0.2</AssemblyVersion>
<Version>1.1.0</Version>
<AssemblyVersion>1.1.0</AssemblyVersion>
<PackageReleaseNotes>Implement Awake from Microsoft Powertoys</PackageReleaseNotes>
<FileVersion>1.0.2.1</FileVersion>
<FileVersion>1.1.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading