HeadMeld 0.0.0.1
- Initial submit, functionality is incomplete
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HeadMeld
|
||||
{
|
||||
internal class TrayManager
|
||||
{
|
||||
NotifyIcon notifyIcon = new();
|
||||
|
||||
public bool UseHeadphoneMode { get; set; } = true;
|
||||
public bool UseDarkMode { get; set; }
|
||||
|
||||
public TrayManager() => notifyIcon.Click += NotifyIcon_Click;
|
||||
|
||||
public void Create()
|
||||
{
|
||||
notifyIcon.Visible = true;
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
notifyIcon.Visible = false;
|
||||
notifyIcon.Dispose();
|
||||
}
|
||||
|
||||
public void UpdateTrayIcon()
|
||||
{
|
||||
if (UseHeadphoneMode == true)
|
||||
{
|
||||
if (UseDarkMode == true)
|
||||
notifyIcon.Icon = new System.Drawing.Icon("Resources/headphones_light.ico");
|
||||
else
|
||||
notifyIcon.Icon = new System.Drawing.Icon("Resources/headphones_dark.ico");
|
||||
}
|
||||
else if (UseHeadphoneMode == false)
|
||||
{
|
||||
if (UseDarkMode == true)
|
||||
notifyIcon.Icon = new System.Drawing.Icon("Resources/loudspeakers_light.ico");
|
||||
else
|
||||
notifyIcon.Icon = new System.Drawing.Icon("Resources/loudspeakers_dark.ico");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler ToggleWindowState;
|
||||
private void NotifyIcon_Click(object? sender, EventArgs e)
|
||||
{
|
||||
ToggleWindowState?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user