AMRPC/AppleMusicRPC/ServiceApplicationContext.cs

32 lines
758 B
C#
Raw Normal View History

2024-04-02 03:11:40 +02:00
using System;
using System.Resources;
using System.Windows.Forms;
using AppleMusicRPC.Properties;
namespace AppleMusicRPC
{
internal class ServiceApplicationContext : ApplicationContext
{
private NotifyIcon trayIcon;
public ServiceApplicationContext()
{
trayIcon = new NotifyIcon()
{
Icon = Resources.TrayIcon,
ContextMenuStrip = new ContextMenuStrip()
{
Items = { new ToolStripMenuItem("Exit", null, Exit) }
},
Visible = true
};
}
void Exit(object sender, EventArgs e)
{
trayIcon.Visible = false;
Application.Exit();
}
}
}