From df56e2af2358a2bb42d117322d5407e3015df832 Mon Sep 17 00:00:00 2001
From: Serge <5920850+seerge@users.noreply.github.com>
Date: Fri, 10 May 2024 21:21:38 +0200
Subject: [PATCH] Show current installed driver version in Updates tooltips
https://github.com/seerge/g-helper/issues/2572
---
app/Updates.Designer.cs | 3 +++
app/Updates.cs | 19 ++++++++++++++-----
app/Updates.resx | 3 +++
3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/app/Updates.Designer.cs b/app/Updates.Designer.cs
index 9728a777d..9adacff50 100644
--- a/app/Updates.Designer.cs
+++ b/app/Updates.Designer.cs
@@ -30,6 +30,7 @@ protected override void Dispose(bool disposing)
///
private void InitializeComponent()
{
+ components = new System.ComponentModel.Container();
tableBios = new TableLayoutPanel();
labelBIOS = new Label();
pictureBios = new PictureBox();
@@ -47,6 +48,7 @@ private void InitializeComponent()
labelLegendGray = new Label();
labelLegendRed = new Label();
labelLegend = new Label();
+ toolTip = new ToolTip(components);
((System.ComponentModel.ISupportInitialize)pictureBios).BeginInit();
panelBiosTitle.SuspendLayout();
panelBios.SuspendLayout();
@@ -339,5 +341,6 @@ private void InitializeComponent()
private Label labelLegendRed;
private Label labelLegendGray;
private Label labelLegendGreen;
+ private ToolTip toolTip;
}
}
\ No newline at end of file
diff --git a/app/Updates.cs b/app/Updates.cs
index 6732ee967..e21d95c3a 100644
--- a/app/Updates.cs
+++ b/app/Updates.cs
@@ -153,6 +153,7 @@ public void VisualiseDriver(DriverDownload driver, TableLayoutPanel table)
table.Controls.Add(new Label { Text = driver.date, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 2, table.RowCount);
table.Controls.Add(versionLabel, 3, table.RowCount);
table.RowCount++;
+
});
}
@@ -166,11 +167,13 @@ public void ShowTable(TableLayoutPanel table)
});
}
- private void _VisualiseNewDriver(int position, int newer, TableLayoutPanel table)
+ private void _VisualiseNewDriver(int position, int newer, string tip, TableLayoutPanel table)
{
var label = table.GetControlFromPosition(3, position) as LinkLabel;
if (label != null)
{
+ toolTip.SetToolTip(label, tip);
+
if (newer == DRIVER_NEWER)
{
label.AccessibleName = label.AccessibleName + Properties.Strings.NewUpdates;
@@ -183,18 +186,18 @@ private void _VisualiseNewDriver(int position, int newer, TableLayoutPanel table
}
}
- public void VisualiseNewDriver(int position, int newer, TableLayoutPanel table)
+ public void VisualiseNewDriver(int position, int newer, string tip, TableLayoutPanel table)
{
if (InvokeRequired)
{
Invoke(delegate
{
- _VisualiseNewDriver(position, newer, table);
+ _VisualiseNewDriver(position, newer, tip, table);
});
}
else
{
- _VisualiseNewDriver(position, newer, table);
+ _VisualiseNewDriver(position, newer, tip, table);
}
}
@@ -300,6 +303,8 @@ public async void DriversAsync(string url, int type, TableLayoutPanel table)
foreach (var driver in drivers)
{
int newer = DRIVER_NOT_FOUND;
+ string tip = driver.version;
+
if (type == 0 && driver.hardwares.ToString().Length > 0)
for (int k = 0; k < driver.hardwares.GetArrayLength(); k++)
{
@@ -310,14 +315,18 @@ public async void DriversAsync(string url, int type, TableLayoutPanel table)
{
newer = Math.Min(newer, new Version(driver.version).CompareTo(new Version(localVersion)));
Logger.WriteLine(driver.title + " " + deviceID + " " + driver.version + " vs " + localVersion + " = " + newer);
+ tip = "Download: " + driver.version + "\n" + "Installed: " + localVersion;
}
}
if (type == 1)
+ {
newer = Int32.Parse(driver.version) > Int32.Parse(bios) ? 1 : -1;
+ tip = "Download: " + driver.version + "\n" + "Installed: " + bios;
+ }
- VisualiseNewDriver(count, newer, table);
+ VisualiseNewDriver(count, newer, tip, table);
if (newer == DRIVER_NEWER)
{
diff --git a/app/Updates.resx b/app/Updates.resx
index af32865ec..1f052d5eb 100644
--- a/app/Updates.resx
+++ b/app/Updates.resx
@@ -117,4 +117,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
\ No newline at end of file