v0.4: mic tray icon from mmres.dll, version in form title

This commit is contained in:
2026-08-10 12:39:33 +00:00
parent fbbb52df90
commit 08d6eeb46e
3 changed files with 80 additions and 5 deletions
+23 -5
View File
@@ -29,6 +29,7 @@ internal sealed partial class MainForm : Form
_config = AppConfig.Load();
Directory.CreateDirectory(AppConfig.AppDataDir);
Directory.CreateDirectory(_voicesDir);
Text = $"Robovoice {AppVersion}";
Load += OnLoad;
FormClosing += OnFormClosing;
}
@@ -426,12 +427,26 @@ internal sealed partial class MainForm : Form
if (_trayInit) return;
_trayInit = true;
_trayIcon = new NotifyIcon
var micIcon = IconExtractor.TryExtractMicrophone();
if (micIcon is not null)
{
Icon = SystemIcons.Application,
Text = "Robovoice",
Visible = true,
};
_trayIcon = new NotifyIcon
{
Icon = micIcon,
Text = $"Robovoice {AppVersion}",
Visible = true,
};
Icon = micIcon;
}
else
{
_trayIcon = new NotifyIcon
{
Icon = SystemIcons.Application,
Text = $"Robovoice {AppVersion}",
Visible = true,
};
}
var menu = new ContextMenuStrip();
menu.Items.Add("Show", null, (_, _) => ShowWindow());
@@ -444,6 +459,9 @@ internal sealed partial class MainForm : Form
_trayIcon.DoubleClick += (_, _) => ShowWindow();
}
private static string AppVersion =>
typeof(MainForm).Assembly.GetName().Version?.ToString() ?? "0.0";
private void OnResize(object? sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized && chkMinimizeToTray.Checked)