Example #1
0
        private void llblCollectorType_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to change the Collector type?\r\n\r\nIf you continue this will reset any existing configuration.", "Collector type", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.Yes)
            {
                List <ConfigVariable> configVars = new List <ConfigVariable>();
                foreach (ConfigVariable cv in currentEditingEntry.ConfigVariables)
                {
                    configVars.Add(cv.Clone());
                }
                CollectorEntry newCollector = AgentHelper.CreateNewCollector((from c in monitorPack.Collectors
                                                                              where c.UniqueId == currentEditingEntry.ParentCollectorId
                                                                              select c).FirstOrDefault());
                if (newCollector != null)
                {
                    currentEditingEntry = null;
                    currentEditingEntry = newCollector;
                    currentEditingEntry.ConfigVariables = configVars;
                    llblCollectorType.Text = currentEditingEntry.CollectorRegistrationDisplayName;
                    ApplyConfigToControls();

                    if (AgentHelper.LastShowRawEditOnStartOption)
                    {
                        llblRawEdit_LinkClicked(sender, e);
                    }
                }
            }
        }