Skip to content

Commit

Permalink
Show current installed driver version in Updates tooltips #2572
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed May 10, 2024
1 parent e642c55 commit df56e2a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
3 changes: 3 additions & 0 deletions app/Updates.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 14 additions & 5 deletions app/Updates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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++;

});
}

Expand All @@ -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;
Expand All @@ -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);
}

}
Expand Down Expand Up @@ -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++)
{
Expand All @@ -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)
{
Expand Down
3 changes: 3 additions & 0 deletions app/Updates.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

0 comments on commit df56e2a

Please sign in to comment.