private void ShowProjectorProperties() { if (ProjectorList.SelectedItem != null) { var pe = (ProjectorEntry)ProjectorList.SelectedItem; var projProps = new ProjectorProperties {Projector = pe, CalibrationInfo = CalibrationInfo}; if (projProps.ShowDialog() == DialogResult.OK) { ReloadListBox(); } } }
private void AddProjector_Click(object sender, EventArgs e) { var maxID = CalibrationInfo.Projectors.Select(p => p.ID).Concat(new[] {-1}).Max(); maxID++; var projProps = new ProjectorProperties(); var pe = new ProjectorEntry {ID = maxID}; projProps.Projector = pe; projProps.CalibrationInfo = CalibrationInfo; projProps.AddMode = true; var allGood = false; while (!allGood) { if (projProps.ShowDialog() == DialogResult.OK) { if (!CalibrationInfo.ProjLookup.ContainsKey(pe.ID)) { CalibrationInfo.Projectors.Add(pe); CalibrationInfo.ProjLookup.Add(pe.ID, pe); allGood = true; } else { UiTools.ShowMessageBox(Language.GetLocalizedText(696, "That ID currently exists. Please choose a unique ID")); } } else { allGood = true; } } ReloadListBox(); }
private void AddProjector_Click(object sender, EventArgs e) { int maxID = -1; foreach (ProjectorEntry p in CalibrationInfo.Projectors) { if (p.ID > maxID) { maxID = p.ID; } } maxID++; ProjectorProperties projProps = new ProjectorProperties(); ProjectorEntry pe = new ProjectorEntry(); pe.ID = maxID; projProps.Projector = pe; projProps.CalibrationInfo = CalibrationInfo; projProps.AddMode = true; bool allGood = false; while (!allGood) { if (projProps.ShowDialog() == DialogResult.OK) { if (!CalibrationInfo.ProjLookup.ContainsKey(pe.ID)) { CalibrationInfo.Projectors.Add(pe); CalibrationInfo.ProjLookup.Add(pe.ID, pe); allGood = true; } else { UiTools.ShowMessageBox(Language.GetLocalizedText(696, "That ID currently exists. Please choose a unique ID")); allGood = false; } } else { allGood = true; } } ReloadListBox(); }