diff --git a/app/Program.cs b/app/Program.cs
index 69673564..697674c3 100644
--- a/app/Program.cs
+++ b/app/Program.cs
@@ -1,6 +1,5 @@
using Microsoft.Win32;
using NAudio.CoreAudioApi;
-using OSD;
using System.Diagnostics;
using System.Globalization;
using System.Management;
@@ -106,7 +105,7 @@ namespace GHelper
SettingsToggle(action);
}
- if (!isOptimizationRunning) AsusUSB.RunListener(HandleEvent);
+ if (!isOptimizationRunning) AsusUSB.RunListener(HandleEvent);
Application.Run();
@@ -265,7 +264,7 @@ namespace GHelper
var commDevice = enumerator.GetDefaultAudioEndpoint(DataFlow.Capture, Role.Communications);
bool muteStatus = !commDevice.AudioEndpointVolume.Mute;
commDevice.AudioEndpointVolume.Mute = muteStatus;
- settingsForm.BeginInvoke(settingsForm.RunToast, muteStatus ? "Mic Muted" : "Mic Unmuted");
+ settingsForm.BeginInvoke(settingsForm.RunToast, muteStatus ? "Muted" : "Unmuted", ToastIcon.Microphone);
}
break;
@@ -324,25 +323,25 @@ namespace GHelper
brightness = Math.Max(0, brightness - 1);
config.setConfig("keyboard_brightness", brightness);
AsusUSB.ApplyBrightness(brightness);
- settingsForm.BeginInvoke(settingsForm.RunToast, "Backlight -");
+ settingsForm.BeginInvoke(settingsForm.RunToast, "Down", ToastIcon.Backlight);
break;
case 196: // FN+F3
brightness = Math.Min(3, brightness + 1);
config.setConfig("keyboard_brightness", brightness);
AsusUSB.ApplyBrightness(brightness);
- settingsForm.BeginInvoke(settingsForm.RunToast, "Backlight +");
+ settingsForm.BeginInvoke(settingsForm.RunToast, "Up", ToastIcon.Backlight);
break;
case 16: // FN+F7
ScreenBrightness.Adjust(-10);
- settingsForm.BeginInvoke(settingsForm.RunToast, "Brightness -");
+ settingsForm.BeginInvoke(settingsForm.RunToast, "Down", ToastIcon.Brightness);
break;
case 32: // FN+F8
ScreenBrightness.Adjust(+10);
- settingsForm.BeginInvoke(settingsForm.RunToast, "Brightness +");
+ settingsForm.BeginInvoke(settingsForm.RunToast, "Up", ToastIcon.Brightness);
break;
case 107: // FN+F10
AsusUSB.TouchpadToggle();
- settingsForm.BeginInvoke(settingsForm.RunToast, "Touchpad");
+ settingsForm.BeginInvoke(settingsForm.RunToast, "Toggle", ToastIcon.Touchpad);
break;
case 108: // FN+F11
Application.SetSuspendState(PowerState.Suspend, true, true);
diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs
index c7831a70..81274350 100644
--- a/app/Properties/Resources.Designer.cs
+++ b/app/Properties/Resources.Designer.cs
@@ -70,16 +70,6 @@ namespace GHelper.Properties {
}
}
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap everything_is_fine_itsfine {
- get {
- object obj = ResourceManager.GetObject("everything-is-fine-itsfine", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
@@ -100,6 +90,16 @@ namespace GHelper.Properties {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap icons8_brightness_96 {
+ get {
+ object obj = ResourceManager.GetObject("icons8_brightness_96", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
@@ -230,6 +230,16 @@ namespace GHelper.Properties {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap icons8_microphone_96 {
+ get {
+ object obj = ResourceManager.GetObject("icons8_microphone_96", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
@@ -330,6 +340,26 @@ namespace GHelper.Properties {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap icons8_sunset_96 {
+ get {
+ object obj = ResourceManager.GetObject("icons8_sunset_96", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap icons8_touchpad_96 {
+ get {
+ object obj = ResourceManager.GetObject("icons8_touchpad_96", 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 7d70d000..8e92f0e6 100644
--- a/app/Properties/Resources.resx
+++ b/app/Properties/Resources.resx
@@ -133,9 +133,6 @@
..\Resources\icons8-fiat-500-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\icons8-project-management-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\icons8-bicycle-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -205,13 +202,25 @@
..\Resources\icons8-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\itsfine.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\icons8-help-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\icons8-video-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\icons8-project-management-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\icons8-brightness-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\icons8-sunset-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\icons8-microphone-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\icons8-touchpad-96.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/Resources/Brightness.bmp b/app/Resources/Brightness.bmp
new file mode 100644
index 00000000..55516c7a
Binary files /dev/null and b/app/Resources/Brightness.bmp differ
diff --git a/app/Resources/icons8-brightness-96.png b/app/Resources/icons8-brightness-96.png
new file mode 100644
index 00000000..ed8e942e
Binary files /dev/null and b/app/Resources/icons8-brightness-96.png differ
diff --git a/app/Resources/icons8-microphone-96.png b/app/Resources/icons8-microphone-96.png
new file mode 100644
index 00000000..f76031d0
Binary files /dev/null and b/app/Resources/icons8-microphone-96.png differ
diff --git a/app/Resources/icons8-sunset-96.png b/app/Resources/icons8-sunset-96.png
new file mode 100644
index 00000000..23531509
Binary files /dev/null and b/app/Resources/icons8-sunset-96.png differ
diff --git a/app/Resources/icons8-touchpad-96.png b/app/Resources/icons8-touchpad-96.png
new file mode 100644
index 00000000..66e48f14
Binary files /dev/null and b/app/Resources/icons8-touchpad-96.png differ
diff --git a/app/Settings.cs b/app/Settings.cs
index 595f24bf..66c04072 100644
--- a/app/Settings.cs
+++ b/app/Settings.cs
@@ -152,9 +152,9 @@ namespace GHelper
}
- public void RunToast(string text)
+ public void RunToast(string text, ToastIcon? icon = null)
{
- toast.RunToast(text);
+ toast.RunToast(text, icon);
}
public void SetContextMenu()
diff --git a/app/ToastForm.cs b/app/ToastForm.cs
index 170a013a..f532ee83 100644
--- a/app/ToastForm.cs
+++ b/app/ToastForm.cs
@@ -1,4 +1,5 @@
using System.Diagnostics;
+using System.Drawing;
using System.Drawing.Drawing2D;
using OSD;
@@ -42,10 +43,20 @@ namespace GHelper
}
}
+ public enum ToastIcon
+ {
+ Brightness,
+ Backlight,
+ Touchpad,
+ Microphone
+ }
+
public class ToastForm : OSDNativeForm
{
protected static string toastText = "Balanced";
+ protected static ToastIcon? toastIcon = null;
+
protected static System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
public ToastForm()
@@ -64,18 +75,49 @@ namespace GHelper
format.LineAlignment = StringAlignment.Center;
format.Alignment = StringAlignment.Center;
- e.Graphics.DrawString(toastText,
- new Font("Segoe UI", 16f, FontStyle.Bold),
- new SolidBrush(Color.White),
- new PointF(this.Bound.Width/2, this.Bound.Height / 2),
- format);
+ Bitmap? icon = null;
+
+ switch (toastIcon)
+ {
+ case ToastIcon.Brightness:
+ icon = Properties.Resources.icons8_brightness_96;
+ break;
+ case ToastIcon.Backlight:
+ icon = Properties.Resources.icons8_sunset_96;
+ break;
+ case ToastIcon.Microphone:
+ icon = Properties.Resources.icons8_microphone_96;
+ break;
+ case ToastIcon.Touchpad:
+ icon = Properties.Resources.icons8_touchpad_96;
+ break;
+
+ }
+
+ int shiftX = 0;
+
+ if (icon is not null)
+ {
+ e.Graphics.DrawImage(icon, 18, 18, 64, 64);
+ shiftX = 40;
+ }
+
+ e.Graphics.DrawString(toastText,
+ new Font("Segoe UI", 36f, FontStyle.Bold, GraphicsUnit.Pixel),
+ new SolidBrush(Color.White),
+ new PointF(this.Bound.Width / 2 + shiftX, this.Bound.Height / 2),
+ format);
+
}
- public void RunToast(string text)
+ public void RunToast(string text, ToastIcon? icon = null)
{
Hide();
+ timer.Stop();
toastText = text;
+ toastIcon = icon;
+
Screen screen1 = Screen.FromHandle(base.Handle);
Width = 300;
@@ -84,15 +126,15 @@ namespace GHelper
Y = screen1.Bounds.Height - 300 - this.Height;
Show();
-
- timer.Enabled = true;
+ timer.Start();
}
private void timer_Tick(object? sender, EventArgs e)
{
Debug.WriteLine("Toast end");
- timer.Enabled = false;
+
Hide();
+ timer.Stop();
}
}
}