Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
            }
        }