private void llblRawEdit_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (SelectedEntry != null) { SelectedEntry.Name = txtName.Text; SelectedEntry.Enabled = chkEnabled.Checked; INotifierConfig conf = (INotifierConfig)SelectedEntry.AgentConfig; RAWXmlEditor editor = new RAWXmlEditor(); string oldMarkUp = conf.ToXml(); editor.SelectedMarkup = oldMarkUp; if (editor.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { conf.FromXml(editor.SelectedMarkup); } catch (Exception ex) { MessageBox.Show("An error occured while processing the config!\r\n" + ex.Message, "Edit config", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //conf.FromXml(oldMarkUp); } LoadControls(); } } }
private void llblRawEdit_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { if (editingNotifierEntry.InitialConfiguration != null) { EditRAWMarkup editRaw = new EditRAWMarkup(); editRaw.SelectedMarkup = XmlFormattingUtils.NormalizeXML(editingNotifierEntry.InitialConfiguration); editRaw.AgentType = editingNotifierEntry.NotifierRegistrationName; editRaw.UseNotifierType = true; editRaw.CurrentMonitorPack = monitorPack; if (editRaw.ShowDialog() == System.Windows.Forms.DialogResult.OK) { editingNotifierEntry.CreateAndConfigureEntry(editingNotifierEntry.NotifierRegistrationName, editRaw.SelectedMarkup, true, false); if (editingNotifierEntry.Notifier != null && editingNotifierEntry.Notifier.AgentConfig != null) { INotifierConfig config = (INotifierConfig)editingNotifierEntry.Notifier.AgentConfig; lblConfigSummary.Text = config.ConfigSummary; } } } } catch (Exception ex) { MessageBox.Show(string.Format("Error setting configuration\r\n{0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void ApplyConfigToControls() { cmdConfigure.Enabled = editingNotifierEntry == null; cboAttendedOptionOverride.SelectedIndex = 0; if (editingNotifierEntry != null) { txtName.Text = editingNotifierEntry.Name; chkEnabled.Checked = editingNotifierEntry.Enabled; RegisteredAgent ar = RegisteredAgentCache.GetRegisteredAgentByClassName(editingNotifierEntry.NotifierRegistrationName, false); if (ar != null) { llblNotifierType.Text = ar.DisplayName; } cboAlertLevel.SelectedIndex = (int)editingNotifierEntry.AlertLevel; cboDetailLevel.SelectedIndex = (int)editingNotifierEntry.DetailLevel; if (editingNotifierEntry.Notifier != null && editingNotifierEntry.Notifier.AgentConfig != null) { INotifierConfig config = (INotifierConfig)editingNotifierEntry.Notifier.AgentConfig; lblConfigSummary.Text = config.ConfigSummary; if (editingNotifierEntry.Notifier.AttendedRunOption != AttendedOption.AttendedAndUnAttended) { editingNotifierEntry.AttendedOptionOverride = editingNotifierEntry.Notifier.AttendedRunOption; cboAttendedOptionOverride.Enabled = false; } else { cboAttendedOptionOverride.Enabled = true; } } cboAttendedOptionOverride.SelectedIndex = (int)editingNotifierEntry.AttendedOptionOverride; SetAlertForCollectors(); linkLabelServiceWindows.Text = editingNotifierEntry.ServiceWindows.ToString(); CheckOkEnable(); } }
private void cmdConfigure_Click(object sender, EventArgs e) { if (editingNotifierEntry != null && editingNotifierEntry.Notifier != null) { try { INotifier tmpnotifier = editingNotifierEntry.Notifier; if (tmpnotifier != null) { if (txtName.Text.Length == 0) { txtName.Text = "No Name"; } if (tmpnotifier.ShowEditConfiguration("Edit '" + txtName.Text + "' Config")) { editingNotifierEntry.Notifier = tmpnotifier; editingNotifierEntry.InitialConfiguration = tmpnotifier.AgentConfig.ToConfig(); if (editingNotifierEntry.Notifier != null && editingNotifierEntry.Notifier.AgentConfig != null) { INotifierConfig config = (INotifierConfig)editingNotifierEntry.Notifier.AgentConfig; lblConfigSummary.Text = config.ConfigSummary; } } CheckOkEnable(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public EmailNotifier(INotifierConfig config) { _config = config; }