コード例 #1
0
 private void ComboBoxServerFolder_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.ComboBoxServerFolder.SelectedItem != null)
     {
         ServerFolder serverFolder = (ServerFolder)this.ComboBoxServerFolder.SelectedItem;
         this.m_ServerFileCollection = new ScannedFileCollection();
         this.m_ServerFileCollection.LoadFiles(serverFolder.Path);
         this.NotifyPropertyChanged("ServerFileCollection");
     }
 }
コード例 #2
0
        private void ButtonDelete_Click(object sender, RoutedEventArgs e)
        {
            if (this.ComboBoxServerFolder.SelectedItem != null)
            {
                ServerFolder serverFolder = (ServerFolder)this.ComboBoxServerFolder.SelectedItem;
                if (this.ListViewScannedFiles.SelectedItems.Count != 0)
                {
                    MessageBoxResult result = System.Windows.MessageBox.Show("Delete this document?", "Delete", MessageBoxButton.OKCancel);
                    if (result == MessageBoxResult.OK)
                    {
                        ScannedFile scannedFile = (ScannedFile)this.ListViewScannedFiles.SelectedItem;
                        System.IO.File.Delete(scannedFile.Name);

                        this.StackPanelImage.Children.RemoveRange(0, this.StackPanelImage.Children.Count);
                        this.m_ServerFileCollection = new ScannedFileCollection();
                        this.m_ServerFileCollection.LoadFiles(serverFolder.Path);
                        this.NotifyPropertyChanged("ServerFileCollection");
                        this.ListViewScannedFiles.SelectedIndex = 0;
                        this.ReportNo = "13-";
                    }
                }
            }
        }
コード例 #3
0
        private void ButtonMove_Click(object sender, RoutedEventArgs e)
        {
            if (this.ComboBoxServerFolder.SelectedItem != null)
            {
                ServerFolder serverFolder = (ServerFolder)this.ComboBoxServerFolder.SelectedItem;
                if (this.ListViewScannedFiles.SelectedItems.Count != 0)
                {
                    ScannedFile scannedFile = (ScannedFile)this.ListViewScannedFiles.SelectedItem;

                    YellowstonePathology.Business.Document.CaseDocumentCollection caseDocumentCollection = new Business.Document.CaseDocumentCollection(this.m_ReportNo);
                    YellowstonePathology.Business.Document.CaseDocumentCollection requisitions           = caseDocumentCollection.GetRequisitions();

                    int nextReqNo = requisitions.Count + 1;
                    YellowstonePathology.Business.OrderIdParser orderIdParser = new Business.OrderIdParser(this.m_ReportNo);
                    if (orderIdParser.ReportNo != null || orderIdParser.MasterAccessionNo != null)
                    {
                        string newFileName = System.IO.Path.Combine(YellowstonePathology.Document.CaseDocumentPath.GetPath(orderIdParser), this.m_ReportNo + ".REQ." + nextReqNo.ToString() + ".TIF");
                        if (orderIdParser.IsLegacyReportNo == false)
                        {
                            string masterAccessionNo = orderIdParser.MasterAccessionNo;
                            newFileName = System.IO.Path.Combine(YellowstonePathology.Document.CaseDocumentPath.GetPath(orderIdParser), masterAccessionNo + ".REQ." + nextReqNo.ToString() + ".TIF");
                        }

                        if (scannedFile.Extension.ToUpper() == ".TIF")
                        {
                            System.IO.File.Copy(scannedFile.Name, newFileName);
                        }
                        else if (scannedFile.Extension.ToUpper() == ".JPG")
                        {
                            System.Drawing.Imaging.ImageCodecInfo    myImageCodecInfo;
                            System.Drawing.Imaging.Encoder           myEncoder;
                            System.Drawing.Imaging.EncoderParameter  myEncoderParameter;
                            System.Drawing.Imaging.EncoderParameters myEncoderParameters;

                            myImageCodecInfo    = GetEncoderInfo("image/tiff");
                            myEncoder           = System.Drawing.Imaging.Encoder.Compression;
                            myEncoderParameters = new System.Drawing.Imaging.EncoderParameters(1);

                            myEncoderParameter           = new System.Drawing.Imaging.EncoderParameter(myEncoder, (long)System.Drawing.Imaging.EncoderValue.CompressionCCITT4);
                            myEncoderParameters.Param[0] = myEncoderParameter;

                            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(scannedFile.Name);
                            bitmap.Save(newFileName, myImageCodecInfo, myEncoderParameters);
                            bitmap.Dispose();
                        }

                        System.IO.File.Delete(scannedFile.Name);

                        this.StackPanelImage.Children.RemoveRange(0, this.StackPanelImage.Children.Count);
                        this.m_ServerFileCollection = new ScannedFileCollection();
                        this.m_ServerFileCollection.LoadFiles(serverFolder.Path);
                        this.NotifyPropertyChanged("ServerFileCollection");
                        this.ListViewScannedFiles.SelectedIndex = 0;

                        if (orderIdParser.IsLegacyReportNo)
                        {
                            this.ReportNo = this.ReportNo.Substring(0, 4);
                        }
                        else
                        {
                            this.ReportNo = this.ReportNo.Substring(0, 3);
                        }
                    }
                    else
                    {
                        MessageBox.Show("The Master Accession No should be used for the new style report - 13-123.S \nThe Report No needs to be used for old style reports - S13-123", "Use correct identifier");
                    }
                }
            }
        }