private void PopupViewerPdf(Int32 pIndex) { string fileName = docList[pIndex]; bool isDocExists = false; foreach (frmViewerPdf viewPdf in viewerPdfList) { if (viewPdf.FileName == fileName) { if (!viewPdf.Visible) { viewPdf.Show(); } else { viewPdf.Focus(); } isDocExists = true; break; } } if (!isDocExists) { frmViewerPdf pdfViewerForm = new frmViewerPdf(); pdfViewerForm.FileName = fileName; pdfViewerForm.Text = docTipList[pIndex]; DocumentFormat docFormat = GetDocumentFormat(docType[pIndex]); pdfViewerForm.pdfViewer.LoadDocument(fileName); viewerPdfList.Add(pdfViewerForm); pdfViewerForm.Show(); } }