Beispiel #1
0
        private void linkLabelDicom_Click(object sender, RoutedEventArgs e)
        {
            // 判断是否上传
            ThemedControlsLibrary.LinkLabel LinkLabel = (ThemedControlsLibrary.LinkLabel)sender;
            string DataID = LinkLabel.Tag.ToString();

            Console.WriteLine(LinkLabel.Tag.ToString());

            IEnumerable <Models.DataListItem> list = listView.Items.SourceCollection.Cast <Models.DataListItem>();
            var items = list.FirstOrDefault(item => ((Models.DataListItem)item).DataID == DataID);

            if (items == null)
            {
                MessageBox.Show("订单数据为空");
                return;
            }
            _userID = "15261595318";
            _dataID = items.DataID;
            string dicomFolder = AirwayPatients.BaseDicomFolder + "\\" + items.PatientName + "_" + items.StudyInstanceUID;

            if (Directory.Exists(dicomFolder))
            {
                string[] files = Directory.GetFiles(dicomFolder);
                if (files.Length > 0)
                {
                    ImportDicomWindow3 dicomViewer = new ImportDicomWindow3(dicomFolder);
                    dicomViewer.ShowDialog();

                    return;
                }
            }
            //AirwayPatient patient = AirwayPatients.FindByOrderId(_dataID);
            //if (patient != null)
            //{
            //    if (!string.IsNullOrEmpty(patient.DicomFolder))
            //    {
            //        if (Directory.Exists(patient.DicomFolder))
            //        {
            //            string[] files = Directory.GetFiles(patient.DicomFolder);
            //            if (files.Length > 0)
            //            {
            //                ///DicomViewer打开目录
            //                ///
            //                ImportDicomWindow1 dicomViewer = new ImportDicomWindow1(patient.DicomFolder);
            //                dicomViewer.ShowDialog();

            //                return;
            //            }
            //        }
            //    }
            //}
            MESPDownloadUpload.UserId  = _userID;
            MESPDownloadUpload.OrderId = MESPDownloadUpload.OrderNo = _dataID;
            try
            {
                ThreadPool.QueueUserWorkItem(delegate
                {
                    new MESPDownloadUpload().FetchFileListAsync(
                        云数据类型Enum.Dicom数据压缩包,
                        new EventHandler <ExceptionArgs>(
                            delegate(Object senderInner, ExceptionArgs eInner)
                    {
                        MessageBox.Show("未找到文件!");
                    }),
                        new EventHandler <FileListFinishedArgs>(delegate(Object senderInner, FileListFinishedArgs eInner)
                    {
                        Dispatcher.BeginInvoke(new Action(delegate()
                        {
                            _adminFileList            = eInner.Result;
                            FileListItem selectedFile = _adminFileList[0];

                            lbWaiting.Content    = "正在下载,请稍候。";
                            lbWaiting.Visibility = Visibility.Visible;

                            MESPDownloadUpload.OrderId = MESPDownloadUpload.OrderNo = items.DataID;
                            string filename            = Path.Combine(AirwayPatients.BaseDicomFolder, selectedFile.FileName);


                            string selectedDicomPackageLocalPath = "";
                            try
                            {
                                selectedDicomPackageLocalPath =
                                    new FileInfo(filename).FullName;
                            }
                            catch (Exception)
                            {
                                //filename = @"C:\AirwayVE\CT\" + items.PatientName + ".zip";
                                filename = Path.Combine(AirwayPatients.BaseDicomFolder, items.PatientName + ".zip");
                                selectedDicomPackageLocalPath =
                                    new FileInfo(filename).FullName;
                            }

                            PauseGUI();
                            ThreadPool.QueueUserWorkItem(delegate
                            {
                                DownloadDicom(selectedFile, items, selectedDicomPackageLocalPath, 云数据类型Enum.Dicom数据压缩包);
                            });
                        }
                                                          ));
                    }));
                }
                                             );
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #2
0
        private void DownloadDicom(FileListItem selectedFile, DataListItem dataListItem, string selectedDicomPackageLocalPath, 云数据类型Enum 云数据类型Enum)
        {
            DownloadFileWorker.Download(
                selectedFile,
                selectedDicomPackageLocalPath,
                delegate(string filename)
            {
                UIUtil.Invoke(this, delegate
                {
                    try
                    {
                        //string tempPath = selectedDicomPackageLocalPath.Substring(0, selectedDicomPackageLocalPath.LastIndexOf(Path.DirectorySeparatorChar));
                        //System.Diagnostics.Process.Start(tempPath);
                        //ResumeGUI();
                        lbWaiting.Visibility = Visibility.Hidden;
                        ResumeGUI();
                        while (!File.Exists(selectedDicomPackageLocalPath))
                        {
                        }


                        //System.Diagnostics.Process.Start(System.IO.Path.GetDirectoryName(selectedDicomPackageLocalPath));
                        string destFolder = AirwayPatients.BaseDicomFolder + "\\" + dataListItem.PatientName + "_" + dataListItem.StudyInstanceUID;
                        //解压缩并用dicomviewer打开
                        FileDAO.upZip(selectedDicomPackageLocalPath, destFolder);
                        ImportDicomWindow3 dicomViewer = new ImportDicomWindow3(destFolder);
                        dicomViewer.ShowDialog();

                        //Thread.Sleep(1000);
                        //openPatientsMsgWindow(selectedDicomPackageLocalPath);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                });
            },
                delegate(string errMsg)
            {
                UIUtil.Invoke(this, delegate
                {
                    MessageBox.Show(errMsg);
                    ResumeGUI();
                });
            },
                delegate(Exception ex)
            {
                UIUtil.Invoke(this, delegate
                {
                    Util.ShowExceptionMessage(ex);
                    //Download(selectedFile, selectedDicomPackageLocalPath, 云数据类型Enum.处理结果);
                    ResumeGUI();
                });
            },
                delegate(ProgressArgs progressArgs)
            {
                UIUtil.Invoke(this, delegate
                {
                    lbWaiting.Content          = "正在下载,请稍候。" + progressArgs.ToString();
                    lbDownloadProgress.Content = progressArgs.ToString();

                    Console.WriteLine(progressArgs);
                });
            }, 云数据类型Enum);
        }