public DialogResult ShowDialog(MonitorPack monitorPack) { this.monitorPack = monitorPack; editingCollectorEntry = CollectorEntry.FromConfig(SelectedEntry.ToConfig()); if (SelectedEntry.Collector != null) { monitorPack.ApplyCollectorConfig(editingCollectorEntry); } return(ShowDialog()); }
public DialogResult ShowDialog(MonitorPack monitorPack) { if (KnownRemoteHosts == null) { KnownRemoteHosts = new List <string>(); } if (SelectedEntry == null) { return(System.Windows.Forms.DialogResult.Cancel); } else { this.monitorPack = monitorPack; currentEditingEntry = CollectorEntry.FromConfig(SelectedEntry.ToConfig()); try { //Create Collector instance but do not apply Config Variables! currentEditingEntry.CreateAndConfigureEntry(currentEditingEntry.CollectorRegistrationName, "", false, false); ApplyConfigToControls(); txtName.Text = currentEditingEntry.Name; chkEnabled.Checked = currentEditingEntry.Enabled; chkExpandOnStart.Checked = currentEditingEntry.ExpandOnStart; lblId.Text = currentEditingEntry.UniqueId; llblCollectorType.Text = currentEditingEntry.CollectorRegistrationDisplayName; chkRemoteAgentEnabled.Checked = currentEditingEntry.EnableRemoteExecute; chkForceRemoteExcuteOnChildCollectors.Checked = currentEditingEntry.ForceRemoteExcuteOnChildCollectors; txtRemoteAgentServer.Text = currentEditingEntry.RemoteAgentHostAddress; remoteportNumericUpDown.SaveValueSet(currentEditingEntry.RemoteAgentHostPort); chkBlockParentRHOverride.Checked = currentEditingEntry.BlockParentOverrideRemoteAgentHostSettings; chkRunLocalOnRemoteHostConnectionFailure.Checked = currentEditingEntry.RunLocalOnRemoteHostConnectionFailure; try { chkEnablePollingOverride.Checked = currentEditingEntry.EnabledPollingOverride; onlyAllowUpdateOncePerXSecNumericUpDown.SaveValueSet(currentEditingEntry.OnlyAllowUpdateOncePerXSec); chkEnablePollingFrequencySliding.Checked = currentEditingEntry.EnablePollFrequencySliding; pollSlideFrequencyAfterThirdRepeatSecNumericUpDown.SaveValueSet(currentEditingEntry.PollSlideFrequencyAfterThirdRepeatSec); pollSlideFrequencyAfterSecondRepeatSecNumericUpDown.SaveValueSet(currentEditingEntry.PollSlideFrequencyAfterSecondRepeatSec); pollSlideFrequencyAfterFirstRepeatSecNumericUpDown.SaveValueSet(currentEditingEntry.PollSlideFrequencyAfterFirstRepeatSec); } catch { } PollingOverrideControlsEnable(); numericUpDownRepeatAlertInXMin.SaveValueSet(currentEditingEntry.RepeatAlertInXMin); numericUpDownRepeatAlertInXPolls.SaveValueSet(currentEditingEntry.RepeatAlertInXPolls); AlertOnceInXMinNumericUpDown.SaveValueSet(currentEditingEntry.AlertOnceInXMin); AlertOnceInXPollsNumericUpDown.SaveValueSet(currentEditingEntry.AlertOnceInXPolls); delayAlertSecNumericUpDown.SaveValueSet(currentEditingEntry.DelayErrWarnAlertForXSec); delayAlertPollsNumericUpDown.SaveValueSet(currentEditingEntry.DelayErrWarnAlertForXPolls); chkCollectOnParentWarning.Checked = currentEditingEntry.CollectOnParentWarning; chkAlertsPaused.Checked = currentEditingEntry.AlertsPaused; chkCorrectiveScriptDisabled.Checked = currentEditingEntry.CorrectiveScriptDisabled; txtCorrectiveScriptOnWarning.Text = currentEditingEntry.CorrectiveScriptOnWarningPath; txtCorrectiveScriptOnError.Text = currentEditingEntry.CorrectiveScriptOnErrorPath; txtRestorationScript.Text = currentEditingEntry.RestorationScriptPath; chkOnlyRunCorrectiveScriptsOnStateChange.Checked = currentEditingEntry.CorrectiveScriptsOnlyOnStateChange; linkLabelServiceWindows.Text = currentEditingEntry.ServiceWindows.ToString(); LoadParentCollectorList(); CheckOkEnabled(); return(ShowDialog()); } catch (Exception ex) { MessageBox.Show(ex.Message, "Loading", MessageBoxButtons.OK, MessageBoxIcon.Error); return(System.Windows.Forms.DialogResult.Cancel); } } }