Update loops
This commit is contained in:
parent
b22e409d91
commit
3196de2e29
|
@ -95,14 +95,10 @@ namespace Espresso.Shell.Core
|
|||
/// <returns>Status of the attempt. True if successful, false if not.</returns>
|
||||
public static bool SetIndefiniteKeepAwake(bool keepDisplayOn = true)
|
||||
{
|
||||
if (keepDisplayOn)
|
||||
{
|
||||
return SetAwakeState(EXECUTION_STATE.ES_SYSTEM_REQUIRED | EXECUTION_STATE.ES_DISPLAY_REQUIRED | EXECUTION_STATE.ES_CONTINUOUS);
|
||||
}
|
||||
else
|
||||
{
|
||||
return SetAwakeState(EXECUTION_STATE.ES_SYSTEM_REQUIRED | EXECUTION_STATE.ES_CONTINUOUS);
|
||||
}
|
||||
TokenSource = new CancellationTokenSource();
|
||||
ThreadToken = TokenSource.Token;
|
||||
|
||||
//Put thread for indefinite loop.
|
||||
}
|
||||
|
||||
public static void SetTimedKeepAwake(long seconds, Action<bool> callback, Action failureCallback, bool keepDisplayOn = true)
|
||||
|
@ -116,12 +112,30 @@ namespace Espresso.Shell.Core
|
|||
|
||||
}
|
||||
|
||||
private static void RunIndefiniteLoop(bool keepDisplayOn = true)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
// In case cancellation was already requested.
|
||||
ThreadToken.ThrowIfCancellationRequested();
|
||||
|
||||
if (keepDisplayOn)
|
||||
{
|
||||
SetAwakeState(EXECUTION_STATE.ES_SYSTEM_REQUIRED | EXECUTION_STATE.ES_DISPLAY_REQUIRED | EXECUTION_STATE.ES_CONTINUOUS);
|
||||
}
|
||||
else
|
||||
{
|
||||
return SetAwakeState(EXECUTION_STATE.ES_SYSTEM_REQUIRED | EXECUTION_STATE.ES_CONTINUOUS);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool RunTimedLoop(long seconds, bool keepDisplayOn = true)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
// In case cancellation was already requested.
|
||||
ThreadToken.ThrowIfCancellationRequested();
|
||||
|
||||
try
|
||||
{
|
||||
if (keepDisplayOn)
|
||||
|
|
|
@ -12,6 +12,12 @@
|
|||
<!--Per documentation: https://docs.microsoft.com/dotnet/core/compatibility/windows-forms/5.0/automatically-infer-winexe-output-type#outputtype-set-to-winexe-for-wpf-and-winforms-apps -->
|
||||
<DisableWinExeOutputInference>true</DisableWinExeOutputInference>
|
||||
<AssemblyName>PowerToys.Espresso</AssemblyName>
|
||||
<ApplicationIcon>Espresso.ico</ApplicationIcon>
|
||||
<Company>Den Delimarsky</Company>
|
||||
<Authors>Den Delimarsky</Authors>
|
||||
<Product>Espresso</Product>
|
||||
<PackageProjectUrl>https://espresso.den.dev</PackageProjectUrl>
|
||||
<PackageIcon>Espresso.png</PackageIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
|
|
@ -202,6 +202,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\FluentIcons\FluentIconsColorPicker.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsEspresso.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsFancyZones.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsFileExplorerPreview.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsImageResizer.png" />
|
||||
|
|
Loading…
Reference in a new issue