mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Dynamic lighting detection
This commit is contained in:
@@ -636,5 +636,9 @@ public static class AppConfig
|
||||
return ContainsModel("GU605") || (IsTUF() && !(ContainsModel("FX507Z") || ContainsModel("FA617")));
|
||||
|
||||
}
|
||||
public static bool IsDynamicLighting()
|
||||
{
|
||||
return true || IsSlash() || ContainsModel("JIR") || ContainsModel("JZR") || ContainsModel("FA607") || ContainsModel("FX607");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
24
app/Helpers/DynamicLightingHelper.cs
Normal file
24
app/Helpers/DynamicLightingHelper.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace GHelper.Helpers
|
||||
{
|
||||
public static class DynamicLightingHelper
|
||||
{
|
||||
|
||||
public static bool IsEnabled()
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Lighting");
|
||||
var registryValueObject = key?.GetValue("AmbientLightingEnabled");
|
||||
|
||||
if (registryValueObject == null) return true;
|
||||
return (int)registryValueObject > 0;
|
||||
}
|
||||
|
||||
public static void OpenSettings()
|
||||
{
|
||||
ProcessHelper.RunCMD("explorer","ms-settings:personalization-lighting");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
75
app/Settings.Designer.cs
generated
75
app/Settings.Designer.cs
generated
@@ -68,6 +68,7 @@ namespace GHelper
|
||||
panelGPU = new Panel();
|
||||
labelTipGPU = new Label();
|
||||
tableAMD = new TableLayoutPanel();
|
||||
buttonAutoTDP = new RButton();
|
||||
buttonOverlay = new RButton();
|
||||
buttonFPS = new RButton();
|
||||
tableGPU = new TableLayoutPanel();
|
||||
@@ -94,6 +95,7 @@ namespace GHelper
|
||||
pictureScreen = new PictureBox();
|
||||
labelSreen = new Label();
|
||||
panelKeyboard = new Panel();
|
||||
labelDynamicLighting = new Label();
|
||||
tableLayoutKeyboard = new TableLayoutPanel();
|
||||
buttonKeyboard = new RButton();
|
||||
panelColor = new Panel();
|
||||
@@ -135,7 +137,6 @@ namespace GHelper
|
||||
labelGamma = new Label();
|
||||
pictureGamma = new PictureBox();
|
||||
labelGammaTitle = new Label();
|
||||
buttonAutoTDP = new RButton();
|
||||
panelMatrix.SuspendLayout();
|
||||
panelMatrixAuto.SuspendLayout();
|
||||
tableLayoutMatrix.SuspendLayout();
|
||||
@@ -370,7 +371,7 @@ namespace GHelper
|
||||
panelBattery.Controls.Add(sliderBattery);
|
||||
panelBattery.Controls.Add(panelBatteryTitle);
|
||||
panelBattery.Dock = DockStyle.Top;
|
||||
panelBattery.Location = new Point(11, 1725);
|
||||
panelBattery.Location = new Point(11, 1765);
|
||||
panelBattery.Margin = new Padding(0);
|
||||
panelBattery.Name = "panelBattery";
|
||||
panelBattery.Padding = new Padding(20, 20, 20, 11);
|
||||
@@ -462,7 +463,7 @@ namespace GHelper
|
||||
panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelFooter.Controls.Add(tableButtons);
|
||||
panelFooter.Dock = DockStyle.Top;
|
||||
panelFooter.Location = new Point(11, 1901);
|
||||
panelFooter.Location = new Point(11, 1941);
|
||||
panelFooter.Margin = new Padding(0);
|
||||
panelFooter.Name = "panelFooter";
|
||||
panelFooter.Padding = new Padding(20);
|
||||
@@ -780,6 +781,28 @@ namespace GHelper
|
||||
tableAMD.TabIndex = 24;
|
||||
tableAMD.Visible = false;
|
||||
//
|
||||
// buttonAutoTDP
|
||||
//
|
||||
buttonAutoTDP.Activated = false;
|
||||
buttonAutoTDP.BackColor = SystemColors.ControlLightLight;
|
||||
buttonAutoTDP.BorderColor = Color.Transparent;
|
||||
buttonAutoTDP.BorderRadius = 5;
|
||||
buttonAutoTDP.Dock = DockStyle.Fill;
|
||||
buttonAutoTDP.FlatAppearance.BorderSize = 0;
|
||||
buttonAutoTDP.FlatStyle = FlatStyle.Flat;
|
||||
buttonAutoTDP.ForeColor = SystemColors.ControlText;
|
||||
buttonAutoTDP.Image = Properties.Resources.icons8_gauge_32;
|
||||
buttonAutoTDP.ImageAlign = ContentAlignment.MiddleRight;
|
||||
buttonAutoTDP.Location = new Point(528, 4);
|
||||
buttonAutoTDP.Margin = new Padding(4);
|
||||
buttonAutoTDP.Name = "buttonAutoTDP";
|
||||
buttonAutoTDP.Secondary = false;
|
||||
buttonAutoTDP.Size = new Size(255, 72);
|
||||
buttonAutoTDP.TabIndex = 13;
|
||||
buttonAutoTDP.Text = "AutoTDP";
|
||||
buttonAutoTDP.TextImageRelation = TextImageRelation.ImageBeforeText;
|
||||
buttonAutoTDP.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// buttonOverlay
|
||||
//
|
||||
buttonOverlay.Activated = false;
|
||||
@@ -1077,6 +1100,7 @@ namespace GHelper
|
||||
tableScreen.Name = "tableScreen";
|
||||
tableScreen.RowCount = 1;
|
||||
tableScreen.RowStyles.Add(new RowStyle(SizeType.Absolute, 80F));
|
||||
tableScreen.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
|
||||
tableScreen.Size = new Size(787, 100);
|
||||
tableScreen.TabIndex = 23;
|
||||
//
|
||||
@@ -1229,6 +1253,7 @@ namespace GHelper
|
||||
panelKeyboard.AccessibleRole = AccessibleRole.Grouping;
|
||||
panelKeyboard.AutoSize = true;
|
||||
panelKeyboard.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelKeyboard.Controls.Add(labelDynamicLighting);
|
||||
panelKeyboard.Controls.Add(tableLayoutKeyboard);
|
||||
panelKeyboard.Controls.Add(panelKeyboardTitle);
|
||||
panelKeyboard.Dock = DockStyle.Top;
|
||||
@@ -1236,10 +1261,25 @@ namespace GHelper
|
||||
panelKeyboard.Margin = new Padding(0);
|
||||
panelKeyboard.Name = "panelKeyboard";
|
||||
panelKeyboard.Padding = new Padding(20);
|
||||
panelKeyboard.Size = new Size(827, 132);
|
||||
panelKeyboard.Size = new Size(827, 172);
|
||||
panelKeyboard.TabIndex = 4;
|
||||
panelKeyboard.TabStop = true;
|
||||
//
|
||||
// labelDynamicLighting
|
||||
//
|
||||
labelDynamicLighting.Cursor = Cursors.Hand;
|
||||
labelDynamicLighting.Dock = DockStyle.Top;
|
||||
labelDynamicLighting.Font = new Font("Segoe UI", 9F, FontStyle.Underline, GraphicsUnit.Point);
|
||||
labelDynamicLighting.ForeColor = SystemColors.GrayText;
|
||||
labelDynamicLighting.Location = new Point(20, 112);
|
||||
labelDynamicLighting.Margin = new Padding(4, 0, 4, 0);
|
||||
labelDynamicLighting.Name = "labelDynamicLighting";
|
||||
labelDynamicLighting.Padding = new Padding(4);
|
||||
labelDynamicLighting.Size = new Size(787, 40);
|
||||
labelDynamicLighting.TabIndex = 43;
|
||||
labelDynamicLighting.Text = "Please disable Windows > Dynamic Lighting";
|
||||
labelDynamicLighting.Visible = false;
|
||||
//
|
||||
// tableLayoutKeyboard
|
||||
//
|
||||
tableLayoutKeyboard.AutoSize = true;
|
||||
@@ -1416,7 +1456,7 @@ namespace GHelper
|
||||
panelVersion.Controls.Add(labelCharge);
|
||||
panelVersion.Controls.Add(checkStartup);
|
||||
panelVersion.Dock = DockStyle.Top;
|
||||
panelVersion.Location = new Point(11, 1845);
|
||||
panelVersion.Location = new Point(11, 1885);
|
||||
panelVersion.Margin = new Padding(4);
|
||||
panelVersion.Name = "panelVersion";
|
||||
panelVersion.Size = new Size(827, 56);
|
||||
@@ -1442,7 +1482,7 @@ namespace GHelper
|
||||
panelPeripherals.Controls.Add(tableLayoutPeripherals);
|
||||
panelPeripherals.Controls.Add(panelPeripheralsTile);
|
||||
panelPeripherals.Dock = DockStyle.Top;
|
||||
panelPeripherals.Location = new Point(11, 1526);
|
||||
panelPeripherals.Location = new Point(11, 1566);
|
||||
panelPeripherals.Margin = new Padding(0);
|
||||
panelPeripherals.Name = "panelPeripherals";
|
||||
panelPeripherals.Padding = new Padding(20, 20, 20, 11);
|
||||
@@ -1895,28 +1935,6 @@ namespace GHelper
|
||||
labelGammaTitle.TabIndex = 37;
|
||||
labelGammaTitle.Text = "Flicker-free Dimming";
|
||||
//
|
||||
// buttonAutoTDP
|
||||
//
|
||||
buttonAutoTDP.Activated = false;
|
||||
buttonAutoTDP.BackColor = SystemColors.ControlLightLight;
|
||||
buttonAutoTDP.BorderColor = Color.Transparent;
|
||||
buttonAutoTDP.BorderRadius = 5;
|
||||
buttonAutoTDP.Dock = DockStyle.Fill;
|
||||
buttonAutoTDP.FlatAppearance.BorderSize = 0;
|
||||
buttonAutoTDP.FlatStyle = FlatStyle.Flat;
|
||||
buttonAutoTDP.ForeColor = SystemColors.ControlText;
|
||||
buttonAutoTDP.Image = Properties.Resources.icons8_gauge_32;
|
||||
buttonAutoTDP.ImageAlign = ContentAlignment.MiddleRight;
|
||||
buttonAutoTDP.Location = new Point(528, 4);
|
||||
buttonAutoTDP.Margin = new Padding(4);
|
||||
buttonAutoTDP.Name = "buttonAutoTDP";
|
||||
buttonAutoTDP.Secondary = false;
|
||||
buttonAutoTDP.Size = new Size(255, 72);
|
||||
buttonAutoTDP.TabIndex = 13;
|
||||
buttonAutoTDP.Text = "AutoTDP";
|
||||
buttonAutoTDP.TextImageRelation = TextImageRelation.ImageBeforeText;
|
||||
buttonAutoTDP.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(192F, 192F);
|
||||
@@ -2120,5 +2138,6 @@ namespace GHelper
|
||||
private Label labelVisual;
|
||||
private RButton buttonFHD;
|
||||
private RButton buttonAutoTDP;
|
||||
private Label labelDynamicLighting;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ using GHelper.Peripherals;
|
||||
using GHelper.Peripherals.Mouse;
|
||||
using GHelper.UI;
|
||||
using GHelper.USB;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Timers;
|
||||
|
||||
@@ -25,7 +24,7 @@ namespace GHelper
|
||||
|
||||
public GPUModeControl gpuControl;
|
||||
public AllyControl allyControl;
|
||||
ScreenControl screenControl = new ScreenControl();
|
||||
ScreenControl screenControl = new ScreenControl();
|
||||
AutoUpdateControl updateControl;
|
||||
|
||||
AsusMouseSettings? mouseSettings;
|
||||
@@ -253,7 +252,7 @@ namespace GHelper
|
||||
|
||||
buttonFPS.Click += ButtonFPS_Click;
|
||||
buttonOverlay.Click += ButtonOverlay_Click;
|
||||
|
||||
|
||||
buttonAutoTDP.Click += ButtonAutoTDP_Click;
|
||||
buttonAutoTDP.BorderColor = colorTurbo;
|
||||
|
||||
@@ -270,10 +269,16 @@ namespace GHelper
|
||||
labelVisual.Click += LabelVisual_Click;
|
||||
labelCharge.Click += LabelCharge_Click;
|
||||
|
||||
labelDynamicLighting.Click += LabelDynamicLighting_Click;
|
||||
|
||||
panelPerformance.Focus();
|
||||
InitVisual();
|
||||
}
|
||||
|
||||
private void LabelDynamicLighting_Click(object? sender, EventArgs e)
|
||||
{
|
||||
DynamicLightingHelper.OpenSettings();
|
||||
}
|
||||
|
||||
private void ButtonFHD_Click(object? sender, EventArgs e)
|
||||
{
|
||||
@@ -327,7 +332,8 @@ namespace GHelper
|
||||
sliderGamma.ValueChanged += SliderGamma_ValueChanged;
|
||||
sliderGamma.MouseUp += SliderGamma_ValueChanged;
|
||||
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
labelGammaTitle.Text = Properties.Strings.VisualMode;
|
||||
}
|
||||
@@ -339,7 +345,8 @@ namespace GHelper
|
||||
{
|
||||
tableVisual.ColumnCount = 3;
|
||||
buttonInstallColor.Visible = false;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
// If it's possible to retrieve color profiles
|
||||
if (ColorProfileHelper.ProfileExists())
|
||||
@@ -399,7 +406,7 @@ namespace GHelper
|
||||
public void CycleVisualMode()
|
||||
{
|
||||
|
||||
if (comboVisual.Items.Count < 1) return ;
|
||||
if (comboVisual.Items.Count < 1) return;
|
||||
|
||||
if (comboVisual.SelectedIndex < comboVisual.Items.Count - 1)
|
||||
comboVisual.SelectedIndex += 1;
|
||||
@@ -802,7 +809,7 @@ namespace GHelper
|
||||
|
||||
private void ButtonFHD_MouseHover(object? sender, EventArgs e)
|
||||
{
|
||||
labelTipScreen.Text = "Switch to "+ ((buttonFHD.Text == "FHD") ? "UHD" : "FHD") + " Mode";
|
||||
labelTipScreen.Text = "Switch to " + ((buttonFHD.Text == "FHD") ? "UHD" : "FHD") + " Mode";
|
||||
}
|
||||
|
||||
private void Button120Hz_MouseHover(object? sender, EventArgs e)
|
||||
@@ -1079,21 +1086,26 @@ namespace GHelper
|
||||
});
|
||||
}
|
||||
|
||||
private void _VisualiseAura()
|
||||
{
|
||||
pictureColor.BackColor = Aura.Color1;
|
||||
pictureColor2.BackColor = Aura.Color2;
|
||||
pictureColor2.Visible = Aura.HasSecondColor();
|
||||
|
||||
if (AppConfig.IsDynamicLighting())
|
||||
{
|
||||
labelDynamicLighting.Visible = DynamicLightingHelper.IsEnabled();
|
||||
labelDynamicLighting.ForeColor = colorStandard;
|
||||
this.OnResize(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void VisualiseAura()
|
||||
{
|
||||
if (InvokeRequired)
|
||||
Invoke(delegate
|
||||
{
|
||||
pictureColor.BackColor = Aura.Color1;
|
||||
pictureColor2.BackColor = Aura.Color2;
|
||||
pictureColor2.Visible = Aura.HasSecondColor();
|
||||
});
|
||||
Invoke(_VisualiseAura);
|
||||
else
|
||||
{
|
||||
pictureColor.BackColor = Aura.Color1;
|
||||
pictureColor2.BackColor = Aura.Color2;
|
||||
pictureColor2.Visible = Aura.HasSecondColor();
|
||||
}
|
||||
_VisualiseAura();
|
||||
}
|
||||
|
||||
public void InitMatrix()
|
||||
@@ -1274,7 +1286,8 @@ namespace GHelper
|
||||
labelVisual.Width = tableVisual.Width;
|
||||
labelVisual.Height = tableVisual.Height;
|
||||
labelVisual.Visible = true;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
labelVisual.Visible = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user