Use red icon for PowerControl if RTSS is not available

This commit is contained in:
Kamil Trzciński 2022-11-15 21:09:53 +01:00
parent b442c6fadc
commit 4de31ed48c
4 changed files with 31 additions and 5 deletions

View file

@ -1,4 +1,4 @@
using CommonHelpers;
using CommonHelpers;
using CommonHelpers.FromLibreHardwareMonitor;
using Microsoft.VisualBasic.Logging;
using PowerControl.External;
@ -89,10 +89,7 @@ namespace PowerControl
};
var osdTimer = new System.Windows.Forms.Timer(components);
osdTimer.Tick += delegate (object? sender, EventArgs e)
{
updateOSD();
};
osdTimer.Tick += OsdTimer_Tick;
osdTimer.Interval = 250;
osdTimer.Enabled = true;
@ -129,6 +126,22 @@ namespace PowerControl
}
}
private void OsdTimer_Tick(object? sender, EventArgs e)
{
try
{
notifyIcon.Text = TitleWithVersion + ". RTSS Version: " + OSD.Version;
notifyIcon.Icon = Resources.poll;
}
catch
{
notifyIcon.Text = TitleWithVersion + ". RTSS Not Available.";
notifyIcon.Icon = Resources.poll_red;
}
updateOSD();
}
private void NeptuneDevice_OnInputReceived(object? sender, hidapi.HidDeviceInputReceivedEventArgs e)
{
var input = SDCInput.FromBuffer(e.Buffer);

View file

@ -69,5 +69,15 @@ namespace PowerControl {
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon poll_red {
get {
object obj = ResourceManager.GetObject("poll_red", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
}
}

View file

@ -121,4 +121,7 @@
<data name="poll" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\poll.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="poll_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\poll_red.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB