コード例 #1
0
 private void cmdConfig_Click(object sender, EventArgs e)
 {
     if (cboCollector.SelectedItem != null)
     {
         try
         {
             AgentRegistration ar  = (AgentRegistration)cboCollector.SelectedItem;
             ICollector        col = CollectorEntry.CreateCollectorEntry(ar.AssemblyPath, ar.ClassName);
             if (col != null)
             {
                 SelectedEntry.Collector = col;
                 if (SelectedEntry.Configuration == null)
                 {
                     SelectedEntry.Configuration = "";
                 }
                 string newConfig = col.ConfigureAgent(SelectedEntry.Configuration);
                 if (newConfig.Length > 0)
                 {
                     SelectedEntry.Configuration = newConfig;
                     CheckOkEnable();
                 }
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }