Skip to content

Commit 8def701

Browse files
authored
Merge pull request #512 from emoacht/develop
Develop
2 parents 1c39a9e + 6526a77 commit 8def701

File tree

7 files changed

+31
-17
lines changed

7 files changed

+31
-17
lines changed

Source/Installer/Product.wxs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3-
<Product Id="*" Name="Monitorian" Manufacturer="emoacht" Version="4.4.12"
3+
<Product Id="*" Name="Monitorian" Manufacturer="emoacht" Version="4.4.13"
44
Language="1033" Codepage="1252" UpgradeCode="{81A4D148-75D3-462E-938D-8C208FB48E3C}">
55
<Package Id="*" InstallerVersion="500" Compressed="yes"
66
InstallScope="perMachine" InstallPrivileges="elevated"

Source/Monitorian.Core/AppKeeper.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
using Monitorian.Core.Models;
1010
using Monitorian.Core.Models.Monitor;
11-
using Monitorian.Core.Models.Watcher;
1211
using Monitorian.Core.Views;
1312
using StartupAgency;
1413

@@ -74,9 +73,7 @@ public static IEnumerable<string> EnumerateStandardOptions() =>
7473
StartupAgent.Options,
7574
MonitorManager.Options,
7675
LanguageService.Options,
77-
WindowPainter.Options,
78-
BrightnessConnector.Options,
79-
DisplayInformationWatcher.Options
76+
WindowPainter.Options
8077
}
8178
.SelectMany(x => x);
8279

Source/Monitorian.Core/Models/Monitor/MonitorManager.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ public BasicItem(
4343

4444
#endregion
4545

46-
#region Preclusion/Preclearance
46+
#region Options
4747

48-
public static IReadOnlyCollection<string> Options => new[] { PrecludeOption, PreclearOption };
48+
public static IReadOnlyCollection<string> Options => (new[] { PrecludeOption, PreclearOption })
49+
.Concat(PowerManagement.Options)
50+
.Concat(BrightnessConnector.Options)
51+
.Concat(DisplayInformationWatcher.Options)
52+
.ToArray();
4953

5054
private const string PrecludeOption = "/preclude";
5155
private const string PreclearOption = "/preclear";

Source/Monitorian.Core/Models/Monitor/PowerManagement.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,19 @@ private struct SYSTEM_POWER_STATUS
9090
// AC/DC power source derived from winnt.h
9191
private static readonly Guid ACDC_POWER_SOURCE = new("5d3e9a59-e9d5-4b00-a6bd-ff34ff516548");
9292

93+
/// <summary>
94+
/// Options
95+
/// </summary>
96+
public static IReadOnlyCollection<string> Options => new[] { PowerBindOption };
97+
98+
private const string PowerBindOption = "/powerbind";
99+
100+
public static bool IsBound => _isBound.Value;
101+
private static readonly Lazy<bool> _isBound = new(() =>
102+
{
103+
return AppKeeper.StandardArguments.Select(x => x.ToLower()).Contains(PowerBindOption);
104+
});
105+
93106
public static Guid GetActiveScheme()
94107
{
95108
if (PowerGetActiveScheme(
@@ -330,7 +343,7 @@ public static bool SetActiveSchemeBrightness(int brightness)
330343

331344
var schemeGuid = GetActiveScheme();
332345

333-
if (isOnline.Value)
346+
if (isOnline.Value || IsBound)
334347
{
335348
if (PowerWriteACValueIndex(
336349
IntPtr.Zero,
@@ -343,7 +356,7 @@ public static bool SetActiveSchemeBrightness(int brightness)
343356
return false;
344357
}
345358
}
346-
else
359+
if (!isOnline.Value || IsBound)
347360
{
348361
if (PowerWriteDCValueIndex(
349362
IntPtr.Zero,

Source/Monitorian.Core/Models/Watcher/BrightnessConnector.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,17 @@ private static string FindFamilyName(string identityName)
104104
return package?.Id.FamilyName;
105105
}
106106

107-
public virtual bool IsEnabled => _isSpecified && _isAvailable && !string.IsNullOrEmpty(_familyName.Value);
108-
private readonly bool _isSpecified;
109-
private bool _isAvailable = true; // default
110-
111107
/// <summary>
112108
/// Options
113109
/// </summary>
114110
public static IReadOnlyCollection<string> Options => new[] { ConnectOption };
115111

116112
private const string ConnectOption = "/connect";
117113

114+
public virtual bool IsEnabled => _isSpecified && _isAvailable && !string.IsNullOrEmpty(_familyName.Value);
115+
private readonly bool _isSpecified;
116+
private bool _isAvailable = true; // default
117+
118118
public BrightnessConnector()
119119
{
120120
_isSpecified = OsVersion.Is10OrGreater &&

Source/Monitorian.Core/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
// You can specify all the values or you can default the Build and Revision Numbers
3434
// by using the '*' as shown below:
3535
// [assembly: AssemblyVersion("1.0.*")]
36-
[assembly: AssemblyVersion("4.4.12.0")]
37-
[assembly: AssemblyFileVersion("4.4.12.0")]
36+
[assembly: AssemblyVersion("4.4.13.0")]
37+
[assembly: AssemblyFileVersion("4.4.13.0")]
3838
[assembly: NeutralResourcesLanguage("en-US")]
3939

4040
// For unit test

Source/Monitorian/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("4.4.12.0")]
55-
[assembly: AssemblyFileVersion("4.4.12.0")]
54+
[assembly: AssemblyVersion("4.4.13.0")]
55+
[assembly: AssemblyFileVersion("4.4.13.0")]
5656
[assembly: Guid("a4cc5362-9b08-465b-ad64-5cfabc72a4c7")]
5757
[assembly: NeutralResourcesLanguage("en-US")]

0 commit comments

Comments
 (0)