public MainForm() { MainForm.alertCallback = this.attention; InitializeComponent(); this.Icon = Resources.evealert; string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/eve-alert/"; #if DEBUG configdir = appdata + "config_testing.xml"; #else configdir = appdata + "config.xml"; #endif if (Directory.Exists(appdata) == false) { Directory.CreateDirectory(appdata); } if (File.Exists(configdir) == false) { settings = new Settings(); new SettingsForm(settings).ShowDialog(); Settings.toXML(settings, configdir); } else { settings = Settings.fromXML(configdir); } if (settings.StartStarted) { this.toggleState(); } notificationForm = new NotificationForm(settings); /*Account acc = new Account(); acc.Charname = "TestAccount"; acc.alertModules.Add(new ChatLogAlert(new List<string> {"Test1", "Test2" }, "Testchannel")); settings.Accounts.Add(acc); saveSettings();*/ refreshAccounts(); refreshContextMenu(); refreshGui(); }
private void toggleState(bool value) { this.enabled = value; refreshGui(); saveSettings(); if (this.enabled) { notificationForm = new NotificationForm(settings); foreach (Account acc in settings.Accounts) { if (acc.Enabled == false) continue; foreach (AlertInterface alert in acc.alertModules) { if (alert.Enabled) { alert.start(); } } } } else { foreach (Account acc in settings.Accounts) { if (acc.Enabled == false) continue; foreach (AlertInterface alert in acc.alertModules) { if (alert.Enabled) { alert.stop(); } } } } }
private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { new SettingsForm(settings).ShowDialog(); saveSettings(); notificationForm = new NotificationForm(settings); }