private void Application_Startup(object sender, StartupEventArgs e) { server = new ServerBootstrap(); server.Start(); notifyIcon = new NotifyIcon(); notifyIcon.Icon = new Icon("Resources/icons8-check-all-64.ico"); notifyIcon.Visible = true; notifyIcon.Text = "Server running!"; var menuStrip = new ContextMenuStrip(); var help = new ToolStripMenuItem("Help"); help.Name = "Help"; var exit = new ToolStripMenuItem("Exit"); exit.Name = "Exit"; help.Click += Help_Click; exit.Click += (o, args) => System.Windows.Application.Current.Shutdown(0); menuStrip.Items.Add(help); menuStrip.Items.Add(exit); notifyIcon.ContextMenuStrip = menuStrip; }
private void Application_Startup(object sender, StartupEventArgs e) { System.Windows.Forms.Application.EnableVisualStyles(); server = new ServerBootstrap(); server.Start(); notifyIcon = new NotifyIcon(); notifyIcon.Icon = new Icon("Resources/icons8-remote-control-32.ico"); notifyIcon.Visible = true; notifyIcon.Text = "Server running!"; var menuStrip = new ContextMenuStrip(); var help = new ToolStripMenuItem("Help"); help.Name = "Connect"; var exit = new ToolStripMenuItem("Exit"); exit.Name = "Exit"; help.Click += Connect_Click; exit.Click += (o, args) => Current.Shutdown(0); menuStrip.Items.Add(help); menuStrip.Items.Add(exit); notifyIcon.ContextMenuStrip = menuStrip; if (Settings.Default.AskToPair) { Connect_Click(null, null); } }