/* * Create a notification context with an icon and menu. */ internal NotificationContext() { // Create a VistaMenu control to stylize context menus VistaMenu vistaMenu = new VistaMenu(); // Create menu items for the notification icon context menu MenuItem menuItemShow = new MenuItem("Show " + Application.ProductName, menuItemShow_Click); MenuItem menuItemSettings = new MenuItem("Settings...", menuItemSettings_Click); MenuItem menuItemAbout = new MenuItem("About...", menuItemAbout_Click); MenuItem menuItemExit = new MenuItem("Exit", menuItemExit_Click); // Add icons to the notification icon context menu items vistaMenu.SetImage(menuItemSettings, Properties.Resources.MenuSettingsIcon); vistaMenu.SetImage(menuItemAbout, Properties.Resources.MenuAboutIcon); // Set the show menu entry as default (bold) menuItemShow.DefaultItem = true; // Add the menu items to the notify icon context menu ContextMenu contextMenuNotifyIcon = new ContextMenu(new MenuItem[] { menuItemShow, menuItemSettings, new MenuItem("-"), menuItemAbout, new MenuItem("-"), menuItemExit }); // This needs to be called or the context menu will not have icons ((System.ComponentModel.ISupportInitialize)(vistaMenu)).EndInit(); // Create a new instance of the notify icon notifyIcon = new NotifyIcon() { ContextMenu = contextMenuNotifyIcon, Icon = Program.Settings.Data.WhiteNotificationIcon ? Properties.Resources.SlackUI16White : Properties.Resources.SlackUI16, Text = Application.ProductName, Visible = true, }; // Assign a click and double click event handler for the notification icon notifyIcon.Click += notifyIcon_Click; notifyIcon.DoubleClick += notifyIcon_DoubleClick; // Show the wrapper form on startup? if (Program.Settings.Data.ShowOnStartup) { DisplayWrapperForm(); } }
/* * Create a notification context with an icon and menu. */ internal NotificationContext() { // Create a VistaMenu control to stylize context menus VistaMenu vistaMenu = new VistaMenu(); // Create menu items for the notification icon context menu MenuItem menuItemShow = new MenuItem("Show " + Application.ProductName, menuItemShow_Click); MenuItem menuItemSettings = new MenuItem("Settings…", menuItemSettings_Click); MenuItem menuItemAbout = new MenuItem("About…", menuItemAbout_Click); MenuItem menuItemExit = new MenuItem("Exit", menuItemExit_Click); // Add icons to the notification icon context menu items vistaMenu.SetImage(menuItemSettings, Properties.Resources.MenuItemSettings.ToBitmap()); vistaMenu.SetImage(menuItemAbout, Properties.Resources.MenuItemAbout.ToBitmap()); // Set the show menu entry as default (bold) menuItemShow.DefaultItem = true; // Add the menu items to the notify icon context menu ContextMenu contextMenuNotifyIcon = new ContextMenu(new MenuItem[] { menuItemShow, menuItemSettings, new MenuItem("-"), menuItemAbout, new MenuItem("-"), menuItemExit }); // This needs to be called or the context menu will not have icons ((System.ComponentModel.ISupportInitialize)(vistaMenu)).EndInit(); // Create a new instance of the notify icon notifyIcon = new NotifyIcon() { ContextMenu = contextMenuNotifyIcon, Icon = new Icon(Program.Settings.Data.WhiteNotificationIcon ? Properties.Resources.NotificationWhite : Properties.Resources.NotificationColor, SystemInformation.SmallIconSize), Text = Application.ProductName, Visible = true, }; // Assign a click and double click event handler for the notification icon notifyIcon.Click += notifyIcon_Click; notifyIcon.DoubleClick += notifyIcon_DoubleClick; // Show the wrapper form on startup? if (Program.Settings.Data.ShowOnStartup) { DisplayWrapperForm(); } // Remind the user that the application is running on the background? if (Program.Settings.Data.BackgroundRunningBalloon && !Program.Settings.Data.ShowOnStartup) { notifyIcon.BalloonTipClicked += delegate { Program.Settings.Data.BackgroundRunningBalloon = false; }; notifyIcon.ShowBalloonTip(3000, "SlackUI is running on the background", "SlackUI started hidden and will continue to run so that you can receive real time updates while " + "signed in.\n\nTo stop showing this reminder, click here.", ToolTipIcon.Info); } }