Esempio n. 1
0
        /// <summary>
        /// Updates tooltip text and icon of tray icon
        /// </summary>
        public void UpdateNofiyIconText(BundleStatus pBundleStatus)
        {
            mCurrentBundleStatus = pBundleStatus;

            string trayIcon   = "trayicon_default";
            string statusText = "";

            switch (pBundleStatus)
            {
            case BundleStatus.NO_ACTIVE_INSTANCE:
                trayIcon = "trayicon_default";
                break;

            case BundleStatus.DISABLED:
                trayIcon   = "trayicon_disabled";
                statusText = "not running";
                break;

            case BundleStatus.UNKNOWN:
                trayIcon   = "trayicon_unknown";
                statusText = "server starting/stopping";
                break;

            case BundleStatus.STARTING_STOPPING:
                trayIcon   = "trayicon_starting";
                statusText = "bundles starting/stopping";
                break;

            case BundleStatus.RUNNING:
                trayIcon   = "trayicon_running";
                statusText = "running";
                break;
            }

            this.NotifyIcon.Text = this.Name + " (" + statusText + ")";
            this.NotifyIcon.Icon = IconCache.GetIcon(this.IconSet, this.CustomIconPath, trayIcon);

            // show baloon message if instance was started up
            if (mLastBundleStatus != pBundleStatus)
            {
                mLastBundleStatus       = pBundleStatus;
                mLastBundleStatusChange = DateTime.Now;
                if (pBundleStatus == BundleStatus.RUNNING)
                {
                    mBundleStatusRunningReported = false;
                }
            }
            if (pBundleStatus == BundleStatus.RUNNING &&
                !mBundleStatusRunningReported &&
                (DateTime.Now.Subtract(mLastBundleStatusChange).TotalMilliseconds > AEMManager.Properties.Settings.Default.ReportStatusChangeTimeout))
            {
                mBundleStatusRunningReported = true;
                ShowNotfiyIconMessage("AEM instance is ready.", ToolTipIcon.Info);
            }
        }
Esempio n. 2
0
        private void InitializeNotifyIcon()
        {
            if (mNotifyIcon == null)
            {
                mNotifyIcon = new NotifyIcon();

                mNotifyIcon.DoubleClick += new EventHandler(mNotifyIcon_DoubleClick);
            }

            ContextMenu contextMenu = new ContextMenu();

            MenuItem nameMenuItem = new MenuItem(this.Name + " (" + AemInstanceTypeUtil.GetLabel(this.AemInstanceType) + ")");

            nameMenuItem.Enabled = false;
            contextMenu.MenuItems.Add(nameMenuItem);

            contextMenu.MenuItems.Add(new MenuItem("-"));
            AemActions.AddControlMenuItems(contextMenu.MenuItems, this);

            contextMenu.MenuItems.Add(new MenuItem("-"));
            AemActions.AddLogMenuItems(contextMenu.MenuItems, this);

            contextMenu.MenuItems.Add(new MenuItem("-"));
            AemActions.AddOpenMenuItems(contextMenu.MenuItems, this, true);

            contextMenu.MenuItems.Add(new MenuItem("-"));
            contextMenu.MenuItems.Add(new MenuItem("Properties", propertiesMenuItem_Click));

            this.NotifyIcon.ContextMenu = contextMenu;

            mNotifyIcon.Text    = this.Name;
            mNotifyIcon.Visible = this.ShowInTaskbar;

            string trayIcon = "trayicon_disabled";

            mNotifyIcon.Icon = IconCache.GetIcon(this.IconSet, this.CustomIconPath, trayIcon);
        }