private void cmdOK_Click(object sender, EventArgs e)
        {
            if (SelectedConfig == null)
            {
                SelectedConfig = new ServiceStateCollectorConfig();
            }
            ((ServiceStateCollectorConfig)SelectedConfig).Entries.Clear();
            foreach (TreeNode machineTreeNode in treeConfig.Nodes)
            {
                ServiceStateDefinition ssd = new ServiceStateDefinition();
                ssd.MachineName = machineTreeNode.Text;
                ssd.SubItems    = new List <ICollectorConfigSubEntry>();

                foreach (TreeNode serviceTreeNode in machineTreeNode.Nodes)
                {
                    ssd.SubItems.Add(new ServiceStateServiceEntry()
                    {
                        Description = serviceTreeNode.Text
                    });
                }
                ((ServiceStateCollectorConfig)SelectedConfig).Entries.Add(ssd);
            }
            DialogResult = DialogResult.OK;
            Close();
        }
Example #2
0
 private void ServiceStateCollectorEditEntry_Load(object sender, EventArgs e)
 {
     if (SelectedEntry != null)
     {
         ServiceStateDefinition selectedEntry = (ServiceStateDefinition)SelectedEntry;
         txtComputer.Text = selectedEntry.MachineName;
         foreach (ICollectorConfigSubEntry service in selectedEntry.SubItems)
         {
             lstServices.Items.Add(service.Description);
         }
     }
 }
Example #3
0
 private void cmdOK_Click(object sender, EventArgs e)
 {
     if (lstServices.Items.Count > 0)
     {
         if (SelectedEntry == null)
         {
             SelectedEntry = new ServiceStateDefinition();
         }
         ServiceStateDefinition selectedEntry = (ServiceStateDefinition)SelectedEntry;
         selectedEntry.MachineName = txtComputer.Text;
         selectedEntry.SubItems.Clear();
         for (int i = 0; i < lstServices.Items.Count; i++)
         {
             selectedEntry.SubItems.Add(new ServiceStateServiceEntry()
             {
                 Description = lstServices.Items[i].ToString()
             });
         }
         DialogResult = DialogResult.OK;
         Close();
     }
 }
Example #4
0
        //public List<ServiceStateDefinition> Services { get; set; }

        #region IAgentConfig Members
        public void ReadConfiguration(string configurationString)
        {
            XmlDocument config = new XmlDocument();

            config.LoadXml(configurationString);
            Entries.Clear();
            XmlElement root = config.DocumentElement;

            foreach (XmlElement machine in root.SelectNodes("machine"))
            {
                ServiceStateDefinition serviceStateDefinition = new ServiceStateDefinition();
                serviceStateDefinition.MachineName = machine.Attributes.GetNamedItem("name").Value;
                serviceStateDefinition.SubItems    = new List <ICollectorConfigSubEntry>();
                foreach (XmlElement service in machine.SelectNodes("service"))
                {
                    serviceStateDefinition.SubItems.Add(new ServiceStateServiceEntry()
                    {
                        Description = service.Attributes.GetNamedItem("name").Value
                    });
                }
                Entries.Add(serviceStateDefinition);
            }
        }