diff --git a/app/Gpu/NvidiaSmi.cs b/app/Gpu/NvidiaSmi.cs
new file mode 100644
index 00000000..b71719fd
--- /dev/null
+++ b/app/Gpu/NvidiaSmi.cs
@@ -0,0 +1,61 @@
+using System.Diagnostics;
+using System.Text.RegularExpressions;
+
+public static class NvidiaSmi
+{
+ public static bool GetDisplayActiveStatus()
+ {
+ string commandOutput = RunNvidiaSmiCommand();
+
+ Logger.WriteLine(commandOutput);
+
+ if (commandOutput.Length == 0) return false;
+ if (!commandOutput.Contains("RTX 40")) return false;
+
+ // Extract the "Display Active" status using regular expressions
+ string displayActivePattern = @"Display Active\s+:\s+(\w+)";
+
+ Match match = Regex.Match(commandOutput, displayActivePattern, RegexOptions.IgnoreCase);
+
+ if (match.Success)
+ {
+ string status = match.Groups[1].Value.ToLower().Trim(' ');
+ return status == "enabled";
+ }
+
+ return false; // Return false if the "Display Active" status is not found
+ }
+
+ private static string RunNvidiaSmiCommand(string arguments = "-i 0 -q")
+ {
+ ProcessStartInfo startInfo = new ProcessStartInfo
+ {
+ FileName = "nvidia-smi",
+ Arguments = arguments,
+ RedirectStandardOutput = true,
+ UseShellExecute = false,
+ CreateNoWindow = true
+ };
+
+ Process process = new Process
+ {
+ StartInfo = startInfo
+ };
+
+ try
+ {
+ process.Start();
+ string output = process.StandardOutput.ReadToEnd();
+ process.WaitForExit();
+ return output;
+ }
+ catch (Exception ex)
+ {
+ //return File.ReadAllText(@"smi.txt");
+ Debug.WriteLine(ex.Message);
+ }
+
+ return "";
+
+ }
+}
diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs
index 1ff1f7f4..ad98aea2 100644
--- a/app/Properties/Resources.Designer.cs
+++ b/app/Properties/Resources.Designer.cs
@@ -390,6 +390,16 @@ namespace GHelper.Properties {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap icons8_refresh_32 {
+ get {
+ object obj = ResourceManager.GetObject("icons8-refresh-32", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx
index 92c3e9fb..4687e7d4 100644
--- a/app/Properties/Resources.resx
+++ b/app/Properties/Resources.resx
@@ -118,9 +118,6 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- ..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\brightness-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -169,6 +166,9 @@
..\Resources\icons8-spa-flower-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\icons8-edit-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -181,6 +181,9 @@
..\Resources\icons8-voltage-60.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\backlight-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\icons8-keyboard-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -202,15 +205,12 @@
..\Resources\icons8-laptop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\icons8-rocket-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\icons8-charging-battery-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\icons8-edit-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\backlight-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -253,8 +253,8 @@
..\Resources\ultimate.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\backlight-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\icons8-rocket-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\icons8-boost-30.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -268,4 +268,7 @@
..\Resources\icons8-temperature-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\icons8-refresh-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/app/Properties/Strings.Designer.cs b/app/Properties/Strings.Designer.cs
index 710329b7..4d5c6aba 100644
--- a/app/Properties/Strings.Designer.cs
+++ b/app/Properties/Strings.Designer.cs
@@ -456,6 +456,26 @@ namespace GHelper.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to Disabling the dGPU by going to Eco mode while Display Mode in NVIDIA Control Panel is not set to Optimus might cause problems with brightness controls until after the next reboot.
+ ///
+ ///Do you still want to continue?.
+ ///
+ internal static string EnableOptimusText {
+ get {
+ return ResourceManager.GetString("EnableOptimusText", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to NVIDIA Display Mode is not set to Optimus.
+ ///
+ internal static string EnableOptimusTitle {
+ get {
+ return ResourceManager.GetString("EnableOptimusTitle", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Extra.
///
@@ -861,6 +881,24 @@ namespace GHelper.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to New updates.
+ ///
+ internal static string NewUpdates {
+ get {
+ return ResourceManager.GetString("NewUpdates", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to No new updates.
+ ///
+ internal static string NoNewUpdates {
+ get {
+ return ResourceManager.GetString("NoNewUpdates", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Open G-Helper window.
///
diff --git a/app/Properties/Strings.resx b/app/Properties/Strings.resx
index d22c296a..080f99e0 100644
--- a/app/Properties/Strings.resx
+++ b/app/Properties/Strings.resx
@@ -249,6 +249,14 @@
Eco
+
+ Disabling the dGPU by going to Eco mode while Display Mode in NVIDIA Control Panel is not set to Optimus might cause problems with brightness controls until after the next reboot.
+
+Do you still want to continue?
+
+
+ NVIDIA Display Mode is not set to Optimus
+
Extra
@@ -384,6 +392,12 @@
Mute Mic
+
+ New updates
+
+
+ No new updates
+
Open G-Helper window
diff --git a/app/Resources/icons8-refresh-32.png b/app/Resources/icons8-refresh-32.png
new file mode 100644
index 00000000..241ba5c4
Binary files /dev/null and b/app/Resources/icons8-refresh-32.png differ
diff --git a/app/Settings.cs b/app/Settings.cs
index 97c02974..13175a31 100644
--- a/app/Settings.cs
+++ b/app/Settings.cs
@@ -1688,7 +1688,20 @@ namespace GHelper
int status = 1;
- if (eco == 1) HardwareControl.KillGPUApps();
+ if (eco == 1)
+ {
+ if (NvidiaSmi.GetDisplayActiveStatus())
+ {
+ DialogResult dialogResult = MessageBox.Show(Properties.Strings.EnableOptimusText, Properties.Strings.EnableOptimusTitle, MessageBoxButtons.YesNo);
+ if (dialogResult == DialogResult.No)
+ {
+ InitGPUMode();
+ return;
+ }
+ }
+
+ HardwareControl.KillGPUApps();
+ }
Logger.WriteLine($"Running eco command {eco}");
diff --git a/app/Updates.Designer.cs b/app/Updates.Designer.cs
index 11f44b39..b065f8d0 100644
--- a/app/Updates.Designer.cs
+++ b/app/Updates.Designer.cs
@@ -33,6 +33,8 @@
labelBIOS = new Label();
pictureBios = new PictureBox();
panelBiosTitle = new Panel();
+ labelUpdates = new Label();
+ buttonRefresh = new CustomControls.RButton();
panelBios = new Panel();
panelDrivers = new Panel();
tableDrivers = new TableLayoutPanel();
@@ -56,21 +58,21 @@
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableBios.Dock = DockStyle.Top;
- tableBios.Location = new Point(10, 10);
- tableBios.Margin = new Padding(2);
- tableBios.MinimumSize = new Size(550, 0);
+ tableBios.Location = new Point(20, 20);
+ tableBios.Margin = new Padding(4);
+ tableBios.MinimumSize = new Size(1100, 0);
tableBios.Name = "tableBios";
- tableBios.Size = new Size(608, 0);
+ tableBios.Size = new Size(1216, 0);
tableBios.TabIndex = 0;
//
// labelBIOS
//
labelBIOS.AutoSize = true;
labelBIOS.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
- labelBIOS.Location = new Point(34, 14);
- labelBIOS.Margin = new Padding(2, 0, 2, 0);
+ labelBIOS.Location = new Point(68, 23);
+ labelBIOS.Margin = new Padding(4, 0, 4, 0);
labelBIOS.Name = "labelBIOS";
- labelBIOS.Size = new Size(35, 15);
+ labelBIOS.Size = new Size(68, 32);
labelBIOS.TabIndex = 1;
labelBIOS.Text = "BIOS";
//
@@ -78,34 +80,63 @@
//
pictureBios.BackgroundImage = (Image)resources.GetObject("pictureBios.BackgroundImage");
pictureBios.BackgroundImageLayout = ImageLayout.Zoom;
- pictureBios.Location = new Point(14, 14);
- pictureBios.Margin = new Padding(2);
+ pictureBios.Location = new Point(28, 23);
+ pictureBios.Margin = new Padding(4);
pictureBios.Name = "pictureBios";
- pictureBios.Size = new Size(16, 16);
+ pictureBios.Size = new Size(32, 32);
pictureBios.TabIndex = 2;
pictureBios.TabStop = false;
//
// panelBiosTitle
//
+ panelBiosTitle.Controls.Add(labelUpdates);
+ panelBiosTitle.Controls.Add(buttonRefresh);
panelBiosTitle.Controls.Add(labelBIOS);
panelBiosTitle.Controls.Add(pictureBios);
panelBiosTitle.Dock = DockStyle.Top;
panelBiosTitle.Location = new Point(0, 0);
- panelBiosTitle.Margin = new Padding(2);
+ panelBiosTitle.Margin = new Padding(4);
panelBiosTitle.Name = "panelBiosTitle";
- panelBiosTitle.Size = new Size(628, 31);
+ panelBiosTitle.Size = new Size(1256, 62);
panelBiosTitle.TabIndex = 3;
//
+ // labelUpdates
+ //
+ labelUpdates.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ labelUpdates.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
+ labelUpdates.Location = new Point(941, 23);
+ labelUpdates.Name = "labelUpdates";
+ labelUpdates.Size = new Size(245, 32);
+ labelUpdates.TabIndex = 4;
+ labelUpdates.Text = "Updates Available";
+ //
+ // buttonRefresh
+ //
+ buttonRefresh.Activated = false;
+ buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ buttonRefresh.BackColor = SystemColors.ControlLight;
+ buttonRefresh.BorderColor = Color.Transparent;
+ buttonRefresh.BorderRadius = 5;
+ buttonRefresh.FlatAppearance.BorderSize = 0;
+ buttonRefresh.FlatStyle = FlatStyle.Flat;
+ buttonRefresh.Image = Properties.Resources.icons8_refresh_32;
+ buttonRefresh.Location = new Point(1183, 14);
+ buttonRefresh.Name = "buttonRefresh";
+ buttonRefresh.Secondary = true;
+ buttonRefresh.Size = new Size(52, 46);
+ buttonRefresh.TabIndex = 3;
+ buttonRefresh.UseVisualStyleBackColor = false;
+ //
// panelBios
//
panelBios.AutoSize = true;
panelBios.Controls.Add(tableBios);
panelBios.Dock = DockStyle.Top;
- panelBios.Location = new Point(0, 31);
- panelBios.Margin = new Padding(2);
+ panelBios.Location = new Point(0, 62);
+ panelBios.Margin = new Padding(4);
panelBios.Name = "panelBios";
- panelBios.Padding = new Padding(10);
- panelBios.Size = new Size(628, 20);
+ panelBios.Padding = new Padding(20);
+ panelBios.Size = new Size(1256, 40);
panelBios.TabIndex = 4;
//
// panelDrivers
@@ -113,11 +144,11 @@
panelDrivers.AutoSize = true;
panelDrivers.Controls.Add(tableDrivers);
panelDrivers.Dock = DockStyle.Top;
- panelDrivers.Location = new Point(0, 73);
- panelDrivers.Margin = new Padding(2);
+ panelDrivers.Location = new Point(0, 146);
+ panelDrivers.Margin = new Padding(4);
panelDrivers.Name = "panelDrivers";
- panelDrivers.Padding = new Padding(10);
- panelDrivers.Size = new Size(628, 20);
+ panelDrivers.Padding = new Padding(20);
+ panelDrivers.Size = new Size(1256, 40);
panelDrivers.TabIndex = 6;
//
// tableDrivers
@@ -129,11 +160,11 @@
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableDrivers.Dock = DockStyle.Top;
- tableDrivers.Location = new Point(10, 10);
- tableDrivers.Margin = new Padding(2);
- tableDrivers.MinimumSize = new Size(550, 0);
+ tableDrivers.Location = new Point(20, 20);
+ tableDrivers.Margin = new Padding(4);
+ tableDrivers.MinimumSize = new Size(1100, 0);
tableDrivers.Name = "tableDrivers";
- tableDrivers.Size = new Size(608, 0);
+ tableDrivers.Size = new Size(1216, 0);
tableDrivers.TabIndex = 0;
//
// panelDriversTitle
@@ -141,20 +172,20 @@
panelDriversTitle.Controls.Add(labelDrivers);
panelDriversTitle.Controls.Add(pictureDrivers);
panelDriversTitle.Dock = DockStyle.Top;
- panelDriversTitle.Location = new Point(0, 51);
- panelDriversTitle.Margin = new Padding(2);
+ panelDriversTitle.Location = new Point(0, 102);
+ panelDriversTitle.Margin = new Padding(4);
panelDriversTitle.Name = "panelDriversTitle";
- panelDriversTitle.Size = new Size(628, 22);
+ panelDriversTitle.Size = new Size(1256, 44);
panelDriversTitle.TabIndex = 5;
//
// labelDrivers
//
labelDrivers.AutoSize = true;
labelDrivers.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
- labelDrivers.Location = new Point(34, 4);
- labelDrivers.Margin = new Padding(2, 0, 2, 0);
+ labelDrivers.Location = new Point(68, 6);
+ labelDrivers.Margin = new Padding(4, 0, 4, 0);
labelDrivers.Name = "labelDrivers";
- labelDrivers.Size = new Size(126, 15);
+ labelDrivers.Size = new Size(254, 32);
labelDrivers.TabIndex = 1;
labelDrivers.Text = "Drivers and Software";
//
@@ -162,24 +193,24 @@
//
pictureDrivers.BackgroundImage = (Image)resources.GetObject("pictureDrivers.BackgroundImage");
pictureDrivers.BackgroundImageLayout = ImageLayout.Zoom;
- pictureDrivers.Location = new Point(14, 4);
- pictureDrivers.Margin = new Padding(2);
+ pictureDrivers.Location = new Point(28, 6);
+ pictureDrivers.Margin = new Padding(4);
pictureDrivers.Name = "pictureDrivers";
- pictureDrivers.Size = new Size(16, 16);
+ pictureDrivers.Size = new Size(32, 32);
pictureDrivers.TabIndex = 2;
pictureDrivers.TabStop = false;
//
// Updates
//
- AutoScaleDimensions = new SizeF(96F, 96F);
+ AutoScaleDimensions = new SizeF(192F, 192F);
AutoScaleMode = AutoScaleMode.Dpi;
AutoScroll = true;
- ClientSize = new Size(628, 345);
+ ClientSize = new Size(1256, 690);
Controls.Add(panelDrivers);
Controls.Add(panelDriversTitle);
Controls.Add(panelBios);
Controls.Add(panelBiosTitle);
- Margin = new Padding(2);
+ Margin = new Padding(4);
MinimizeBox = false;
Name = "Updates";
ShowIcon = false;
@@ -211,5 +242,7 @@
private Panel panelDriversTitle;
private Label labelDrivers;
private PictureBox pictureDrivers;
+ private CustomControls.RButton buttonRefresh;
+ private Label labelUpdates;
}
}
\ No newline at end of file
diff --git a/app/Updates.cs b/app/Updates.cs
index d6a8cb17..7fa1c7ad 100644
--- a/app/Updates.cs
+++ b/app/Updates.cs
@@ -3,6 +3,7 @@ using System.Diagnostics;
using System.Management;
using System.Net;
using System.Text.Json;
+using System.Windows.Forms;
namespace GHelper
{
@@ -22,21 +23,29 @@ namespace GHelper
static string model;
static string bios;
- public Updates()
- {
- InitializeComponent();
- InitTheme();
+ static int updatesCount = 0;
+ private void LoadUpdates()
+ {
InitBiosAndModel();
+ updatesCount = 0;
+ labelUpdates.ForeColor = colorEco;
+ labelUpdates.Text = Properties.Strings.NoNewUpdates;
+
+
Text = Properties.Strings.BiosAndDriverUpdates + ": " + model + " " + bios;
labelBIOS.Text = "BIOS";
labelDrivers.Text = Properties.Strings.DriverAndSoftware;
SuspendLayout();
+
tableBios.Visible = false;
tableDrivers.Visible = false;
+ ClearTable(tableBios);
+ ClearTable(tableDrivers);
+
Task.Run(async () =>
{
DriversAsync($"https://rog.asus.com/support/webapi/product/GetPDBIOS?website=global&model={model}&cpu=", 1, tableBios);
@@ -46,10 +55,34 @@ namespace GHelper
{
DriversAsync($"https://rog.asus.com/support/webapi/product/GetPDDrivers?website=global&model={model}&cpu={model}&osid=52", 0, tableDrivers);
});
+ }
+ private void ClearTable(TableLayoutPanel tableLayoutPanel)
+ {
+ while (tableLayoutPanel.Controls.Count > 0)
+ {
+ tableLayoutPanel.Controls[0].Dispose();
+ }
+
+ tableLayoutPanel.RowCount = 0;
+ }
+
+ public Updates()
+ {
+ InitializeComponent();
+ InitTheme();
+
+ LoadUpdates();
+
+ buttonRefresh.Click += ButtonRefresh_Click;
Shown += Updates_Shown;
}
+ private void ButtonRefresh_Click(object? sender, EventArgs e)
+ {
+ LoadUpdates();
+ }
+
private void Updates_Shown(object? sender, EventArgs e)
{
Height = Program.settingsForm.Height;
@@ -208,8 +241,13 @@ namespace GHelper
{
Invoke(delegate
{
+ updatesCount++;
label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold);
label.ForeColor = colorTurbo;
+
+ labelUpdates.Text = $"{Properties.Strings.NewUpdates}: {updatesCount}";
+ labelUpdates.ForeColor = colorTurbo;
+ labelUpdates.Font = new Font(label.Font, FontStyle.Bold);
});
}
}