mirror of
https://github.com/Maassoft/ColorControl.git
synced 2026-10-21 16:12:18 -05:00
fix crash on startup when no displays are active, set thread execution state when powering off tv on standby
This commit is contained in:
1 parent
04d52d6062
commit
d2aacbb8e0
4 files changed
+28
-8
No files matched your search
@@ -27,7 +27,7 @@
|
||||
<ProductName>ColorControl</ProductName>
|
||||
<PublisherName>Maassoft</PublisherName>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.5.0.0</ApplicationVersion>
|
||||
<ApplicationVersion>1.5.1.0</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
|
||||
@@ -225,7 +225,18 @@ namespace ColorControl
|
||||
|
||||
if (_lgService.Config.PowerOffOnStandby)
|
||||
{
|
||||
_lgService.PowerOff();
|
||||
NativeMethods.SetThreadExecutionState(NativeConstants.ES_CONTINUOUS | NativeConstants.ES_SYSTEM_REQUIRED | NativeConstants.ES_AWAYMODE_REQUIRED);
|
||||
try
|
||||
{
|
||||
Logger.Debug("Powering off tv...");
|
||||
var task = _lgService.PowerOff();
|
||||
Utils.WaitForTask(task);
|
||||
Logger.Debug("Done powering off tv");
|
||||
}
|
||||
finally
|
||||
{
|
||||
NativeMethods.SetThreadExecutionState(NativeConstants.ES_CONTINUOUS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,9 +380,18 @@ namespace ColorControl
|
||||
return;
|
||||
}
|
||||
|
||||
var text = "ColorControl";
|
||||
Display[] displays;
|
||||
try
|
||||
{
|
||||
displays = _nvService.GetDisplays();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error("Error while getting displays: " + e.ToLogString());
|
||||
return;
|
||||
}
|
||||
|
||||
var displays = _nvService.GetDisplays();
|
||||
var text = TS_TASKNAME;
|
||||
foreach (var display in displays)
|
||||
{
|
||||
var id = Math.Abs((int)display.Handle.MemoryAddress.ToInt64());
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace ColorControl
|
||||
var newHdrEnabled = preset.applyHDR && (preset.HDREnabled || (preset.toggleHDR && !hdrEnabled));
|
||||
var applyHdr = preset.applyHDR && (preset.toggleHDR || preset.HDREnabled != hdrEnabled);
|
||||
|
||||
if (preset.applyColorData && ColorDataDiffers(preset.colorData))
|
||||
if (preset.applyColorData && (ColorDataDiffers(preset.colorData) || (!newHdrEnabled && preset.applyColorData && preset.colorData.Colorimetry != ColorDataColorimetry.Auto)))
|
||||
{
|
||||
var display = GetCurrentDisplay();
|
||||
if (hdrEnabled)
|
||||
@@ -192,7 +192,7 @@ namespace ColorControl
|
||||
else if (enabled)
|
||||
{
|
||||
// Currectly there seems to be a bug that after enabling HDR via NVAPI, some settings are only applied upon opening the Display Settings...
|
||||
OpenDisplaySettings();
|
||||
////OpenDisplaySettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.5.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.5.0.0")]
|
||||
[assembly: AssemblyVersion("1.5.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.5.1.0")]
|
||||
Reference in new issue
Block a user