private void saveToolStripMenuItem_Click(object sender, EventArgs e) { try { ensemble.Save(path); } catch (Exception ex) { Console.WriteLine("Could not save file to disk.\n" + ex); } }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { var newDialog = new NewDialog(); if (newDialog.ShowDialog(this) == DialogResult.OK) { var newEnsemble = new ProjectorCameraEnsemble(newDialog.NumProjectors, newDialog.NumCameras); var saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"; saveFileDialog.FilterIndex = 0; saveFileDialog.RestoreDirectory = true; if (saveFileDialog.ShowDialog() == DialogResult.OK) { try { path = saveFileDialog.FileName; directory = Path.GetDirectoryName(path); newEnsemble.Save(path); } catch (Exception ex) { Console.WriteLine("Could not save file to disk.\n" + ex); } lock (renderLock) { ensemble = newEnsemble; EnsembleChanged(); } } } }