private void btnAddDetector_Click(object sender, EventArgs e) { FormAddDetector form = new FormAddDetector(null, settings.DetectorTypes); if (form.ShowDialog() == DialogResult.Cancel) return; Detector det = new Detector(); det.TypeName = form.DetectorType; det.Serialnumber = form.Serialnumber; det.CurrentNumChannels = form.NumChannels; det.CurrentHV = form.HV; det.CurrentCoarseGain = form.CoarseGain; det.CurrentFineGain = form.FineGain; det.CurrentLivetime = form.Livetime; det.CurrentLLD = form.LLD; det.CurrentULD = form.ULD; settings.Detectors.Add(det); PopulateDetectorList(); PopulateDetectors(); }
private void btnEditDetector_Click(object sender, EventArgs e) { if (lvDetectors.SelectedItems.Count == 0) return; // Show edit detector form FormAddDetector form = new FormAddDetector((Detector)lvDetectors.SelectedItems[0].Tag, settings.DetectorTypes); if (form.ShowDialog() == DialogResult.Cancel) return; // Update selected detector Detector det = (Detector)lvDetectors.SelectedItems[0].Tag; det.TypeName = form.DetectorType; det.Serialnumber = form.Serialnumber; det.CurrentNumChannels = form.NumChannels; det.CurrentHV = form.HV; det.CurrentCoarseGain = form.CoarseGain; det.CurrentFineGain = form.FineGain; det.CurrentLivetime = form.Livetime; det.CurrentLLD = form.LLD; det.CurrentULD = form.ULD; PopulateDetectorList(); PopulateDetectors(); }