static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); TimerForm timerForm = new TimerForm(); ApplicationContext applicationContext = new TimerAppContext(); Application.Run(applicationContext); }
public TimerAppContext() { Application.ApplicationExit += new EventHandler(this.OnApplicationExit); _notifyIcon = new NotifyIcon() { ContextMenuStrip = new ContextMenuStrip(), Icon = new Icon("clock.ico"), Text = "Test Tooltip Text", Visible = true }; _timerForm = new TimerForm(); _notifyIcon.ContextMenuStrip.Items.Add("Set Timer", null, (object s, EventArgs e) => _timerForm.Show()); _notifyIcon.ContextMenuStrip.Items.Add("E&xit", null, (object sender, EventArgs e) => ExitThread()); _notifyIcon.DoubleClick += _notifyIcon_DoubleClick; }