void OpenProject(string fileName) { saveProjectDialog.FileName = null; using (var reader = XmlReader.Create(fileName)) { var serializer = new XmlSerializer(typeof(StereotacticProtocol)); try { protocol = (StereotacticProtocol)serializer.Deserialize(reader); } catch (InvalidOperationException) { MessageBox.Show("Unrecognized file format. Please check if project file is compatible with this version of StereoPlanner.", "Invalid file format", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } propertyGrid.SelectedObject = protocol; }
public MainForm() { InitializeComponent(); protocol = new StereotacticProtocol(); propertyGrid.SelectedObject = protocol; }