private void btnEditResponseProcessor_Click(object sender, EventArgs e) { if (lViewResponseProcessor.SelectedItems.Count < 1) { return; } int i = lViewResponseProcessor.Items.IndexOf(lViewResponseProcessor.SelectedItems[0]); FormProcessor formP = new FormProcessor(_param, _config.ResponseMessageProcessors[i]); if (formP.ShowDialog() == DialogResult.OK) { _config.ResponseMessageProcessors[i].Name = formP.Processor.Name; _config.ResponseMessageProcessors[i].DeviceName = formP.Processor.DeviceName; _config.ResponseMessageProcessors[i].Description = formP.Processor.Description; _config.ResponseMessageProcessors[i].Setting = formP.Processor.Setting; lViewResponseProcessor.SelectedItems[0].SubItems[1].Text = _config.ResponseMessageProcessors[i].Name; lViewResponseProcessor.SelectedItems[0].SubItems[2].Text = _config.ResponseMessageProcessors[i].DeviceName; lViewResponseProcessor.SelectedItems[0].SubItems[3].Text = _config.ResponseMessageProcessors[i].Description; } }
private void btnAddResponseProcessor_Click(object sender, EventArgs e) { ProcessorInstance pi = new ProcessorInstance(); pi.Name = ""; pi.DeviceName = ProcessorFactory.ProcessorRegistry[0].ToString(); pi.Description = ""; pi.Setting = ""; FormProcessor formP = new FormProcessor(_param, pi); if (formP.ShowDialog() == DialogResult.OK) { _config.ResponseMessageProcessors.Add(formP.Processor); ListViewItem lvi = new ListViewItem((lViewResponseProcessor.Items.Count + 1).ToString()); lvi.SubItems.Add(formP.Processor.Name); lvi.SubItems.Add(formP.Processor.DeviceName); lvi.SubItems.Add(formP.Processor.Description); lViewResponseProcessor.Items.Add(lvi); } }