예제 #1
0
        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
 public void Save(Preferences preferences)
 {
     key.SetValue("Url", preferences.Url, RegistryValueKind.String);
     key.SetValue("SelectedLabels", preferences.SelectedLabels, RegistryValueKind.String);
     key.SetValue("Interval", preferences.Interval, RegistryValueKind.DWord);
     key.SetValue("BubbleFailures", preferences.BubbleFailures, RegistryValueKind.DWord);
     key.SetValue("BubbleSuccess", preferences.BubbleSuccess, RegistryValueKind.DWord);
 }
예제 #3
0
        public Preferences Load()
        {
            Preferences preferences = new Preferences();

            preferences.Url = (string) key.GetValue("Url", "http://vulcan.example.com");
            preferences.SelectedLabels = (string)key.GetValue("SelectedLabels", "");
            preferences.Interval = (int) key.GetValue("Interval", 60000);
            preferences.BubbleFailures = ((int) key.GetValue("BubbleFailures", 1)) > 0;
            preferences.BubbleSuccess = ((int) key.GetValue("BubbleSuccess", 1)) > 0;

            return preferences;
        }
예제 #4
0
        public ConfigForm(Preferences preferences)
        {
            this.preferences = preferences.Clone();

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

            InitializeComponent();

            populate();
        }
예제 #5
0
        private void onSettingsClicked(object sender, EventArgs e)
        {
            ConfigForm configForm = new ConfigForm(Preferences);

            configForm.ShowDialog(this);

            if (configForm.DialogResult == DialogResult.OK)
            {
                this.preferences = configForm.Preferences;
                configure();
                this.preferenceStore.Save(this.Preferences);
            }
        }