/// <summary> /// Create the NotifyIcon UI, the ContextMenu for the NotifyIcon and an Exit menu item. /// </summary> private void InitializeContext() { this.components = new System.ComponentModel.Container(); this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components); this.notifyIconContextMenu = new System.Windows.Forms.ContextMenu(); this.showContextMenuItem = new System.Windows.Forms.MenuItem(); this.preferencesMenuItem = new System.Windows.Forms.MenuItem(); this.exitContextMenuItem = new System.Windows.Forms.MenuItem(); // // calendarNotifyIcon // this.notifyIcon.ContextMenu = this.notifyIconContextMenu; this.notifyIcon.DoubleClick += new System.EventHandler(this.notifyIcon_DoubleClick); this.notifyIcon.Icon = CoolScreenShot.Properties.Resources.SystemIcon; this.ShowBalloonTip(); this.notifyIcon.Visible = true; this.notifyIcon.ShowBalloonTip(3000); // // calendarNotifyIconContextMenu // this.notifyIconContextMenu.MenuItems.AddRange(new MenuItem[] { showContextMenuItem, preferencesMenuItem, exitContextMenuItem }); // // showContextMenuItem // this.showContextMenuItem.Index = 0; this.showContextMenuItem.Text = String.Format("&Start Shot ({0})", Config.GetCurrentHotkeys()); this.showContextMenuItem.DefaultItem = true; this.showContextMenuItem.Click += new System.EventHandler(this.showContextMenuItem_Click); // // showContextMenuItem // this.preferencesMenuItem.Index = 1; this.preferencesMenuItem.Text = "&Preferences"; this.preferencesMenuItem.Click += new EventHandler(preferencesMenuItem_Click); // // exitContextMenuItem // this.exitContextMenuItem.Index = 2; this.exitContextMenuItem.Text = "&Exit"; this.exitContextMenuItem.Click += new System.EventHandler(this.exitContextMenuItem_Click); this.registerHotkeyForm = ProxyForm.Instance; this.registerHotkeyForm.AppContext = this; this.registerHotkeyForm.RegisterAppHotKey(); }
/// <summary> /// Create the NotifyIcon UI, the ContextMenu for the NotifyIcon and an Exit menu item. /// </summary> private void InitializeContext() { this.components = new System.ComponentModel.Container(); this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components); this.notifyIconContextMenu = new System.Windows.Forms.ContextMenu(); this.showContextMenuItem = new System.Windows.Forms.MenuItem(); this.preferencesMenuItem = new System.Windows.Forms.MenuItem(); this.exitContextMenuItem = new System.Windows.Forms.MenuItem(); // // calendarNotifyIcon // this.notifyIcon.ContextMenu = this.notifyIconContextMenu; this.notifyIcon.DoubleClick += new System.EventHandler(this.notifyIcon_DoubleClick); this.notifyIcon.Icon = CoolScreenShot.Properties.Resources.SystemIcon; this.ShowBalloonTip(); this.notifyIcon.Visible = true; this.notifyIcon.ShowBalloonTip(3000); // // calendarNotifyIconContextMenu // this.notifyIconContextMenu.MenuItems.AddRange(new MenuItem[] { showContextMenuItem,preferencesMenuItem,exitContextMenuItem }); // // showContextMenuItem // this.showContextMenuItem.Index = 0; this.showContextMenuItem.Text = String.Format("&Start Shot ({0})", Config.GetCurrentHotkeys()); this.showContextMenuItem.DefaultItem = true; this.showContextMenuItem.Click += new System.EventHandler(this.showContextMenuItem_Click); // // showContextMenuItem // this.preferencesMenuItem.Index = 1; this.preferencesMenuItem.Text = "&Preferences"; this.preferencesMenuItem.Click += new EventHandler(preferencesMenuItem_Click); // // exitContextMenuItem // this.exitContextMenuItem.Index = 2; this.exitContextMenuItem.Text = "&Exit"; this.exitContextMenuItem.Click += new System.EventHandler(this.exitContextMenuItem_Click); this.registerHotkeyForm = ProxyForm.Instance; this.registerHotkeyForm.AppContext = this; this.registerHotkeyForm.RegisterAppHotKey(); }
private void mainForm_Closed(object sender, EventArgs e) { // null out the main form so we know to create a new one. this.registerHotkeyForm = null; }