コード例 #1
0
ファイル: StatusForm.cs プロジェクト: majianxiong/vulcan
        internal StatusForm(StatusMonitor statusMonitor, BrowserIntegration browserIntegration, PreferenceStore preferenceStore)
        {
            this.browserIntegration = browserIntegration;
            this.preferenceStore = preferenceStore;

            this.statusMonitor = statusMonitor;

            statusMonitor.DataLoaded += onXmlDataLoaded;

            preferences = preferenceStore.Load();

            MenuItem settingsMenuItem = new MenuItem("Settings...", new EventHandler(onSettingsClicked));
            MenuItem separatorMenuItem = new MenuItem("-");
            MenuItem exitMenuItem = new MenuItem("Exit", new EventHandler(onMenuExitClick));
            MenuItem fileMenu = new MenuItem("File", new MenuItem[] { settingsMenuItem, separatorMenuItem, exitMenuItem });
            MainMenu mainMenu = new MainMenu(new MenuItem[] {fileMenu});
            this.Menu = mainMenu;

            // .NET 1.1 compat
                        EventInfo formClosingEvent = GetType().GetEvent("FormClosing");
                        if (formClosingEvent != null)
                        {
                                formClosingEvent.AddEventHandler(this, new FormClosingEventHandler(this.onClosing));
            }

            InitializeComponent();

            configure();

            timer.Enabled = true;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: majianxiong/vulcan
        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();
        }
コード例 #3
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;
            }
        }