/// <summary> /// Initializes a new instance of the <see cref="Tray"/> class. /// </summary> /// <param name="window">TrayMessageWindow to use as a message handler.</param> public Tray(TrayMessageWindow window) { SetupMenu(false); messageWindow = window; notifyIcon = new NotifyIconCustom(messageWindow.GetHandle(), ProductConstants.DefaultSystemTrayTitle); // Setup hook delegate for outside clicks mouseHookDelegate = new MouseHookDelegate(MouseHookHandler); }
/// <summary> /// Initialize the system tray icon of not already initialized. /// </summary> public static void InitializeTray() { TrayMessageWindow = new NotificationArea.TrayMessageWindow(ProductConstants.TrayWindowClassName); if (TrayMessageWindow.GetHandle() == IntPtr.Zero) { return; } if (TrayIcon == null) { TrayIcon = new NotificationArea.Tray(TrayMessageWindow); } }