示例#1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            StatusMonitor statusMonitor = new StatusMonitor();
            BrowserIntegration browserIntegration = new BrowserIntegration();

            StatusForm mainForm = new StatusForm(statusMonitor, browserIntegration, new RegistryPreferenceStore());

            VulcanNotifyIcon trayIcon = new VulcanNotifyIcon(mainForm, statusMonitor, browserIntegration);

            Application.Run(mainForm);

            trayIcon.Dispose();
        }
示例#2
0
        internal VulcanNotifyIcon(StatusForm statusForm, StatusMonitor statusMonitor, BrowserIntegration browserIntegration)
        {
            this.statusForm = statusForm;
            this.browserIntegration = browserIntegration;

            this.activeIcons = Blank;
            this.currentIconIndex = 0;

            this.timer = new Timer(AnimationInterval);
            this.timer.Elapsed += new ElapsedEventHandler(this.onTimerElapsed);
            this.timer.Start();

            MenuItem[] items = new MenuItem[] {
            new MenuItem("Restore", new EventHandler(onMenuRestore)),
            new MenuItem("Go to Dashboard", new EventHandler(onMenuOpenDashboard)),
            new MenuItem("-"),
            new MenuItem("Exit", new EventHandler(onMenuExit))
              };

            items[0].DefaultItem = true;

            notifyIcon = new NotifyIcon();

            notifyIcon.ContextMenu = new ContextMenu(items);
            notifyIcon.Icon = Icons.Blank;
            notifyIcon.Text = "Vulcan Tray Notifier";
            notifyIcon.Visible = true;
            notifyIcon.DoubleClick += new EventHandler(this.onDoubleClick);

            statusMonitor.DataLoadError += new StatusMonitor.DataLoadErrorHandler(this.onLoadError);
            statusMonitor.NewBuildAvailable += new StatusMonitor.NewBuildHandler(this.onNewBuild);
            statusMonitor.DashboardStatusChanged += new StatusMonitor.DashboardStatusChangedHandler(this.onDashboardStatusChanged);

            // .NET 1.1 compat
            EventInfo balloonTipClickedEvent = notifyIcon.GetType().GetEvent("BalloonTipClicked");
            if (balloonTipClickedEvent != null)
            {
                balloonTipClickedEvent.AddEventHandler(notifyIcon, new EventHandler(this.onBalloonTipClicked));
                ballonsSupported = true;
            }
            else
            {
                ballonsSupported = false;
            }
        }