mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-09-30 09:06:32 +13:00
36 lines
No EOL
1.2 KiB
C#
36 lines
No EOL
1.2 KiB
C#
using Microsoft.Win32;
|
|
using System;
|
|
using System.Windows.Forms;
|
|
using SystemTrayMenu.Business;
|
|
using SystemTrayMenu.Helpers.Hotkey;
|
|
using SystemTrayMenu.UserInterface;
|
|
using SystemTrayMenu.Utilities;
|
|
|
|
namespace SystemTrayMenu
|
|
{
|
|
internal class SystemTrayMenu : IDisposable
|
|
{
|
|
private readonly MenuNotifyIcon menuNotifyIcon = new MenuNotifyIcon();
|
|
private Menus menus = new Menus();
|
|
|
|
public SystemTrayMenu()
|
|
{
|
|
AppRestart.BeforeRestarting += Dispose;
|
|
SystemEvents.DisplaySettingsChanged += AppRestart.ByDisplaySettings;
|
|
menus.LoadStarted += menuNotifyIcon.LoadingStart;
|
|
menus.LoadStopped += menuNotifyIcon.LoadingStop;
|
|
menuNotifyIcon.Exit += Application.Exit;
|
|
menuNotifyIcon.Restart += AppRestart.ByMenuNotifyIcon;
|
|
menuNotifyIcon.Click += MenuNotifyIcon_Click;
|
|
void MenuNotifyIcon_Click() => menus.SwitchOpenClose(true);
|
|
menuNotifyIcon.OpenLog += Log.OpenLogFile;
|
|
menus.MainPreload();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
menus.Dispose();
|
|
menuNotifyIcon.Dispose();
|
|
}
|
|
}
|
|
} |