/// <summary>
        /// 設定Detail顯示資訊
        /// </summary>
        /// <param name="importOuter">要匯入的ImplantOuterInformation</param>
        /// <param name="Import">要匯入的ImplantSmallInformation</param>
        public void SetDetailInfo(ImplantOuterInformation importOuter, ImplantSmallCaseInformation Import)
        {
            implantOuterInfo = importOuter;
            implantInfo      = Import;

            textbox_Order.Text   = implantOuterInfo.OrderNumber;
            textbox_Patient.Text = implantOuterInfo.PatientName;
            textbox_Gender.Text  = implantOuterInfo.Gender ? TranslationSource.Instance["Male"] : TranslationSource.Instance["Female"];
            if (implantOuterInfo.PatientBirth != new DateTime())
            {
                int patientAge = DateTime.Today.Year - implantOuterInfo.PatientBirth.Year;
                textbox_Age.Text = patientAge.ToString();
            }
            textbox_Clinic.Text      = implantOuterInfo.Clinic;
            textbox_SurgicalGT.Text  = implantOuterInfo.SurgicalGuide;
            textbox_SurgicalKit.Text = implantOuterInfo.Surgicalkit;

            string JpgPath = importOuter.XmlfilePath.Remove(importOuter.XmlfilePath.Length - 4) + ".jpg";

            if (File.Exists(implantInfo.GuideModelPath) != true)
            {
                button_openDir.IsEnabled = false;
            }
            else
            {
                button_openDir.IsEnabled = true;
            }

            if (File.Exists(implantInfo.PDFpath) != true)
            {
                button_openPDF.IsEnabled = false;
            }
            else
            {
                button_openPDF.IsEnabled = true;
            }

            if (Properties.Settings.Default.guide_exePath == "")
            {
                button_loadGuide.IsEnabled = false;
            }

            textbox_toothProductInfo.Text = "";
            if (implantInfo.List_ImplantToothInfo != null && implantInfo.List_ImplantToothInfo.Count > 0)
            {
                //有植體資料
                foreach (var item in implantInfo.List_ImplantToothInfo)
                {
                    string ToothNumber  = item.ToothID.ToString();
                    string ToothProduct = item.Implant_Company + "(" + item.Implant_System + ")";
                    textbox_toothProductInfo.Text += "Tooth_" + ToothNumber + ":" + ToothProduct + '\n';
                }
            }
        }
        private void LoadCaseXml(ref ImplantSmallCaseInformation smallcaseInfo, string XMLpath)
        {
            XDocument xDoc;

            try
            {
                smallcaseInfo.List_ImplantToothInfo = new List <Order_ImplantSmallcase.Implant_tooth_Info>();
                xDoc = XDocument.Load(XMLpath);

                var toothInfo = from q in xDoc.Descendants("ImplantPlanningExport").Descendants("Implant")
                                select new
                {
                    m_ID      = q.Descendants("ID").First().Value,
                    m_Company = q.Descendants("Company").First().Value,
                    m_System  = q.Descendants("System").First().Value,
                };

                foreach (var item in toothInfo)
                {
                    try
                    {
                        Order_ImplantSmallcase.Implant_tooth_Info TmpToothInfo = new Order_ImplantSmallcase.Implant_tooth_Info
                        {
                            ToothID         = int.Parse(item.m_ID),
                            Implant_Company = item.m_Company,
                            Implant_System  = item.m_System
                        };
                        smallcaseInfo.List_ImplantToothInfo.Add(TmpToothInfo);
                    }
                    catch
                    {
                        continue;
                    }
                }
            }
            catch
            {
                smallcaseInfo.List_ImplantToothInfo = null;
            }
        }
 public Detail_implantV2()
 {
     InitializeComponent();
     implantInfo = new ImplantSmallCaseInformation();
 }
        /// <summary>
        /// 讀取SmallCase資訊
        /// </summary>
        private void LoadSmallCase()
        {
            implantInfo.List_smallcase = new List <Local_UserControls.Order_ImplantSmallcase>();
            int itemIndex = 0;

            try
            {
                foreach (string filename in Directory.GetFiles(implantInfo.CaseDirectoryPath))
                {
                    // 這層是C:\IntewareData\Implant\2020130102946\
                    //找有幾個tii檔就等於有幾個Implant要給Guide的檔
                    if (Path.GetExtension(filename).ToLower() == ".tii")
                    {
                        try
                        {
                            Order_ImplantSmallcase ImplantSmallCase = new Order_ImplantSmallcase();
                            ImplantSmallCase.SetsmallCaseShow += SmallCaseHandler;
                            //記錄內部專案資料夾名稱(就是OrderName)、Guide專案資料夾路徑和檢查是否有從Guide輸出的模型
                            ImplantSmallCaseInformation impInfo = new ImplantSmallCaseInformation
                            {
                                OrderName      = Path.GetFileNameWithoutExtension(filename),
                                ImplantTiiPath = filename
                            };
                            impInfo.GuideCaseDir = implantInfo.CaseDirectoryPath + impInfo.OrderName + @"\LinkStation\";
                            string tmpGuideModelDir = implantInfo.CaseDirectoryPath + impInfo.OrderName + @"\LinkStation\ManufacturingDir\";
                            if (Directory.Exists(tmpGuideModelDir) == true)
                            {
                                string[] guideModel = Directory.GetFiles(tmpGuideModelDir);
                                if (guideModel.Length > 0)
                                {
                                    impInfo.GuideModelPath = guideModel[0];
                                }
                                else
                                {
                                    impInfo.GuideModelPath = "";
                                }
                            }
                            else
                            {
                                impInfo.GuideModelPath = "";
                            }

                            if (File.Exists(implantInfo.CaseDirectoryPath + impInfo.OrderName + @"\" + impInfo.OrderName + ".xml") == true)
                            {
                                LoadCaseXml(ref impInfo, implantInfo.CaseDirectoryPath + impInfo.OrderName + @"\" + impInfo.OrderName + ".xml");
                            }
                            foreach (string searchPDF in Directory.GetFiles(implantInfo.CaseDirectoryPath + impInfo.OrderName + @"\"))
                            {
                                if (Path.GetExtension(searchPDF).ToLower() == ".pdf")
                                {
                                    if (searchPDF.ToLower().IndexOf("examination") != -1)
                                    {
                                        impInfo.PDFpath = searchPDF;
                                        break;
                                    }
                                }
                            }

                            ImplantSmallCase.SetImplantSmallCaseInfo(impInfo, itemIndex);
                            implantInfo.List_smallcase.Add(ImplantSmallCase);
                            itemIndex++;
                        }
                        catch
                        {
                            continue;
                        }
                    }
                }
            }
            catch
            {
            }
        }