private void treeListView_DicomDir_MouseDoubleClick(object sender, MouseEventArgs e) { if (treeListView_DicomDir.SelectedNodes.Count != 1) { return; } var fileId = treeListView_DicomDir.SelectedNodes[0].AdditionalData as Element; if (fileId == null) { return; } var filePath = fileId.Value as string[]; if (filePath == null) { return; } var inDicomDirPath = filePath.Aggregate(string.Empty, (current, s) => current + ("\\" + s)); var fullPath = receivedDicomElements.FileName + inDicomDirPath; try { var elements = OtherImageFormats.Read(fullPath); var receivedDicom = new ReceivedDicomElements { CallingAeTitle = "Localhost", FileName = fullPath, Elements = elements, ImageSource = ImageSource.LocalDicomFile, SavedToDisk = true }; ShowElements(receivedDicom, inDicomDirPath); dicomServiceWorkerUser.ShowMessage(fullPath + " opened successfully!", false, false); } catch (Exception ex) { dicomServiceWorkerUser.ShowMessage(fullPath + " opened failed! " + ex.Message, true, true); } }
public void SaveToDicomDir(ReceivedDicomElements receivedDicomElements, string dicomDirName) { var message = " -- DicomDir : " + dicomDirName + ", "; var hasError = true; try { if (receivedDicomElements.ImageSource == ImageSource.LocalDicomFile) { message += "File : " + receivedDicomElements.FileName; } else { message += string.Format("AeTitle : {0}, IpAddress : {1}", receivedDicomElements.CallingAeTitle, receivedDicomElements.IpAddress); } var dicomDirPath = Path.Combine(StorageRootPath, dicomDirName); var dicomDir = new DicomDir(dicomDirPath); dicomDir.Add(receivedDicomElements.Elements); dicomDir.Save(); receivedDicomElements.OnDicomDirSaved(dicomDirName); dicomServiceWorkerUser.OnDicomDirSaved(receivedDicomElements, dicomDirName); message = "Save to dicom dir successfull!" + message; hasError = false; } catch (Exception ex) { message = "Save to dicom dir failed!" + message + " " + ex.Message; } finally { dicomServiceWorkerUser.ShowMessage(message, hasError, false); } }