diff --git a/PerformanceOverlay/Controller.cs b/PerformanceOverlay/Controller.cs
index 8f5312b..64a68f8 100644
--- a/PerformanceOverlay/Controller.cs
+++ b/PerformanceOverlay/Controller.cs
@@ -15,10 +15,13 @@ namespace PerformanceOverlay
internal class Controller : IDisposable
{
public const String Title = "Performance Overlay";
+ public readonly String TitleWithVersion = Title + " v" + Application.ProductVersion.ToString();
+
Container components = new Container();
RTSSSharedMemoryNET.OSD? osd;
ToolStripMenuItem showItem;
System.Windows.Forms.NotifyIcon notifyIcon;
+ System.Windows.Forms.Timer osdTimer;
Sensors sensors = new Sensors();
StartupManager startupManager = new StartupManager(
Title,
@@ -81,13 +84,13 @@ namespace PerformanceOverlay
exitItem.Click += ExitItem_Click;
notifyIcon = new System.Windows.Forms.NotifyIcon(components);
- notifyIcon.Icon = Resources.traffic_light_outline1;
- notifyIcon.Text = Title;
+ notifyIcon.Icon = Resources.traffic_light_outline;
+ notifyIcon.Text = TitleWithVersion;
notifyIcon.Visible = true;
notifyIcon.ContextMenuStrip = contextMenu;
notifyIcon.Click += NotifyIcon_Click;
- var osdTimer = new System.Windows.Forms.Timer(components);
+ osdTimer = new System.Windows.Forms.Timer(components);
osdTimer.Tick += OsdTimer_Tick;
osdTimer.Interval = 250;
osdTimer.Enabled = true;
@@ -143,20 +146,26 @@ namespace PerformanceOverlay
{
try
{
- notifyIcon.Text = Title + ". RTSS Version: " + OSD.Version;
+ notifyIcon.Text = TitleWithVersion + ". RTSS Version: " + OSD.Version;
+ notifyIcon.Icon = Resources.traffic_light_outline;
}
catch
{
- notifyIcon.Text = Title + ". RTSS Not Available.";
+ notifyIcon.Text = TitleWithVersion + ". RTSS Not Available.";
+ notifyIcon.Icon = Resources.traffic_light_outline_red;
+ osdReset();
+ return;
}
if (!showItem.Checked)
{
- using (osd) { }
- osd = null;
+ osdTimer.Interval = 1000;
+ osdReset();
return;
}
+ osdTimer.Interval = 250;
+
sensors.Update();
var osdOverlay = Overlays.GetOSD(Settings.Default.OSDModeParsed, sensors);
@@ -174,10 +183,34 @@ namespace PerformanceOverlay
}
catch(SystemException)
{
- osd = null;
}
}
+ private void osdReset()
+ {
+ try
+ {
+ if (osd != null)
+ osd.Update("");
+ }
+ catch (SystemException)
+ {
+ }
+ }
+
+ private void osdClose()
+ {
+ try
+ {
+ if (osd != null)
+ osd.Dispose();
+ }
+ catch (SystemException)
+ {
+ }
+ osd = null;
+ }
+
private uint osdEmbedGraph(ref uint offset, ref String osdOverlay, String name, int dwWidth, int dwHeight, int dwMargin, float fltMin, float fltMax, EMBEDDED_OBJECT_GRAPH dwFlags)
{
uint size = osd.EmbedGraph(offset, new float[0], 0, dwWidth, dwHeight, dwMargin, fltMin, fltMax, dwFlags);
@@ -195,7 +228,7 @@ namespace PerformanceOverlay
public void Dispose()
{
components.Dispose();
- using (osd) { }
+ osdClose();
using (sensors) { }
}
}
diff --git a/PerformanceOverlay/Program.cs b/PerformanceOverlay/Program.cs
index d91ff99..95695f2 100644
--- a/PerformanceOverlay/Program.cs
+++ b/PerformanceOverlay/Program.cs
@@ -10,22 +10,6 @@ namespace PerformanceOverlay
{
ApplicationConfiguration.Initialize();
- try
- {
- foreach (var entry in RTSSSharedMemoryNET.OSD.GetOSDEntries())
- {
- Trace.WriteLine("Entry: {0}", entry.Owner);
- Trace.WriteLine("\t", entry.Text);
-
- using (var newOSD = new OSD("New OSD"))
- {
- newOSD.Update(entry.Text);
- }
- }
- }
- catch(SystemException)
- { }
-
using (var controller = new Controller())
{
Application.Run();
diff --git a/PerformanceOverlay/Resources.Designer.cs b/PerformanceOverlay/Resources.Designer.cs
index 2e0b0af..c3b5054 100644
--- a/PerformanceOverlay/Resources.Designer.cs
+++ b/PerformanceOverlay/Resources.Designer.cs
@@ -61,21 +61,21 @@ namespace PerformanceOverlay {
}
///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
///
- internal static System.Drawing.Bitmap traffic_light_outline {
+ internal static System.Drawing.Icon traffic_light_outline {
get {
object obj = ResourceManager.GetObject("traffic_light_outline", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
+ return ((System.Drawing.Icon)(obj));
}
}
///
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
///
- internal static System.Drawing.Icon traffic_light_outline1 {
+ internal static System.Drawing.Icon traffic_light_outline_red {
get {
- object obj = ResourceManager.GetObject("traffic_light_outline1", resourceCulture);
+ object obj = ResourceManager.GetObject("traffic_light_outline_red", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
diff --git a/PerformanceOverlay/Resources.resx b/PerformanceOverlay/Resources.resx
index 70b93f1..1411386 100644
--- a/PerformanceOverlay/Resources.resx
+++ b/PerformanceOverlay/Resources.resx
@@ -119,9 +119,9 @@
- Resources\traffic-light-outline.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
Resources\traffic-light-outline.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ Resources\traffic-light-outline-red.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/PerformanceOverlay/Resources/traffic-light-outline-red.ico b/PerformanceOverlay/Resources/traffic-light-outline-red.ico
new file mode 100644
index 0000000..da2a5bc
Binary files /dev/null and b/PerformanceOverlay/Resources/traffic-light-outline-red.ico differ