Beispiel #1
0
        private void PopupViewerRtf(Int32 pIndex)
        {
            string       fileName    = docList[pIndex];
            bool         isDocExists = false;
            frmViewerRtf currentViewForm;

            //for (int i = 0; i < viewerRtfList.Count - 1; i++ )
            foreach (frmViewerRtf viewDoc in viewerRtfList)
            {
                if (viewDoc.FileName == fileName)
                {
                    if (!viewDoc.Visible)
                    {
                        //viewerRtfList[i].FileName = String.Empty;
                        //this.RemoveOwnedForm(viewerRtfList[i]);
                        //viewerRtfList.RemoveAt(i);
                        viewDoc.Show();
                    }
                    else
                    {
                        viewDoc.Focus();
                    }
                    isDocExists = true;
                    break;
                }
            }

            if (!isDocExists)
            {
                frmViewerRtf rtfViewer = new frmViewerRtf();
                rtfViewer.FileName = fileName;
                rtfViewer.Text     = docTipList[pIndex];

                DocumentFormat docFormat = GetDocumentFormat(docType[pIndex]);
                rtfViewer.richEditControl.LoadDocument(fileName, docFormat);
                viewerRtfList.Add(rtfViewer);

                rtfViewer.Show();
            }
        }
Beispiel #2
0
        private void PopupViewerRtf(Int32 pIndex)
        {
            string fileName = docList[pIndex];
            bool isDocExists = false;
            frmViewerRtf currentViewForm;

            //for (int i = 0; i < viewerRtfList.Count - 1; i++ )
            foreach (frmViewerRtf viewDoc in viewerRtfList)
            {
                if (viewDoc.FileName == fileName)
                {
                    if (!viewDoc.Visible)
                    {
                        //viewerRtfList[i].FileName = String.Empty;
                        //this.RemoveOwnedForm(viewerRtfList[i]);
                        //viewerRtfList.RemoveAt(i);
                        viewDoc.Show();
                    }
                    else
                    {
                        viewDoc.Focus();
                    }
                    isDocExists = true;
                    break;
                }
            }

            if (!isDocExists)
            {
                frmViewerRtf rtfViewer = new frmViewerRtf();
                rtfViewer.FileName = fileName;
                rtfViewer.Text = docTipList[pIndex];

                DocumentFormat docFormat = GetDocumentFormat(docType[pIndex]);
                rtfViewer.richEditControl.LoadDocument(fileName, docFormat);
                viewerRtfList.Add(rtfViewer);

                rtfViewer.Show();
            }
        }