private void cmdConfig_Click(object sender, EventArgs e) { if (cboNotifier.SelectedItem != null) { try { AgentRegistration ar = (AgentRegistration)cboNotifier.SelectedItem; INotifier notifier = NotifierEntry.CreateNotifierEntry(ar.AssemblyPath, ar.ClassName); if (notifier != null) { SelectedEntry.Notifier = notifier; if (SelectedEntry.Configuration == null) { SelectedEntry.Configuration = ""; } string newConfig = notifier.ConfigureAgent(SelectedEntry.Configuration); if (newConfig.Length > 0) { SelectedEntry.Configuration = newConfig; CheckOkEnable(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void cmdOK_Click(object sender, EventArgs e) { try { SelectedEntry.Name = txtName.Text; SelectedEntry.Enabled = chkEnabled.Checked; SelectedEntry.AlertLevel = (AlertLevel)cboAlertLevel.SelectedIndex; SelectedEntry.DetailLevel = (DetailLevel)cboDetailLevel.SelectedIndex; SelectedEntry.NotifierRegistrationName = ((AgentRegistration)cboNotifier.SelectedItem).Name; AgentRegistration ar = (AgentRegistration)cboNotifier.SelectedItem; SelectedEntry.Notifier = NotifierEntry.CreateNotifierEntry(ar.AssemblyPath, ar.ClassName); DialogResult = System.Windows.Forms.DialogResult.OK; Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmdManualConfig_Click(object sender, EventArgs e) { try { if ((SelectedEntry.Configuration == null || SelectedEntry.Configuration.Length == 0) && cboNotifier.SelectedItem != null) { AgentRegistration ar = (AgentRegistration)cboNotifier.SelectedItem; INotifier col = NotifierEntry.CreateNotifierEntry(ar.AssemblyPath, ar.ClassName); txtConfig.Text = XmlFormattingUtils.NormalizeXML(col.GetDefaultOrEmptyConfigString()); } else { txtConfig.Text = XmlFormattingUtils.NormalizeXML(SelectedEntry.Configuration); } } catch (Exception ex) { MessageBox.Show(string.Format("Error getting new/existing configuration\r\n{0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } ShowManualConfig(); }