private void openFolderToolStripMenuItem_Click(object sender, EventArgs e) { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { var folder = folderBrowserDialog1.SelectedPath; var enumerator = new DicomFileEnumerator(new DirectoryInfo(folder)); while (enumerator.MoveNext()) { Debug.WriteLine(enumerator.Current.File.Name); report = DicomReader.GetStructuredReport(enumerator.Current.Dataset); ShowAllResults(true); return; } MessageBox.Show("The selected folder does not contain any supported DICOM files.", "Error - Dicom File Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void openFileToolStripMenuItem_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { var path = openFileDialog1.FileName; var file = DicomFileEnumerator.TryOpen(path); if (file != null) { report = DicomReader.GetStructuredReport(file.Dataset); ShowAllResults(true); } else { MessageBox.Show("The selected file is invalid or in an unsupported format.", "Error - Invalid DICOM File", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }