Ejemplo n.º 1
0
        private void PopupViewerMultiDocs(string pFileName, string pMetadata, string pFileExt, string pDocURL)
        {
            bool isDocExists = false;

            //for (int i = 0; i < viewerRtfList.Count - 1; i++ )
            foreach (frmViewerRtf viewDoc in viewerRtfList)
            {
                //if (viewDoc.Url == pUrl)
                if (viewDoc.FileName == pFileName)
                {
                    if (!viewDoc.Visible)
                    {
                        if (viewDoc.IsDisposed)
                        {
                            continue;
                        }
                        viewDoc.Show();
                    }
                    else
                    {
                        viewDoc.Focus();
                    }
                    isDocExists = true;
                    break;
                }
            }

            if (!isDocExists)
            {
                frmViewerRtf rtfViewer = new frmViewerRtf();
                //Israel -- Whether filename or URL, this value must be unique.
                //rtfViewer.Url = pUrl;
                rtfViewer.FileName = pFileName;
                rtfViewer.Text     = pMetadata;

                DocumentFormat docFormat = GetDocumentFormat(pFileExt);
                //byte[] docSvcByteStream = vaultSvcDal.GetDocumentForURL(pUrl);
                byte[] docSvcByteStream = vaultSvcDal.GetDocumentForFileName(pFileName, pMetadata, pDocURL);

                if (docSvcByteStream.Length > 0)
                {
                    using (MemoryStream docMemStream = new MemoryStream(docSvcByteStream))
                    {
                        rtfViewer.richEditControl.LoadDocument(docMemStream, docFormat);
                    }
                }

                viewerRtfList.Add(rtfViewer);
                rtfViewer.Show();
            }
        }
Ejemplo n.º 2
0
        private void PopupViewerMultiDocs(string pFileName, string pMetadata, string pFileExt, string pDocURL)
        {
            bool isDocExists = false;

            //for (int i = 0; i < viewerRtfList.Count - 1; i++ )
            foreach (frmViewerRtf viewDoc in viewerRtfList)
            {
                //if (viewDoc.Url == pUrl)
                if (viewDoc.FileName == pFileName)
                {
                    if (!viewDoc.Visible)
                    {
                        if (viewDoc.IsDisposed)
                        {
                            continue;
                        }                        
                        viewDoc.Show();
                    }
                    else
                    {
                        viewDoc.Focus();
                    }
                    isDocExists = true;
                    break;
                }
            }

            if (!isDocExists)
            {
                frmViewerRtf rtfViewer = new frmViewerRtf();
                //Israel -- Whether filename or URL, this value must be unique.
                //rtfViewer.Url = pUrl;
                rtfViewer.FileName = pFileName;
                rtfViewer.Text = pMetadata;

                DocumentFormat docFormat = GetDocumentFormat(pFileExt);
                //byte[] docSvcByteStream = vaultSvcDal.GetDocumentForURL(pUrl);
                byte[] docSvcByteStream = vaultSvcDal.GetDocumentForFileName(pFileName, pMetadata, pDocURL);                    
                    
                if (docSvcByteStream.Length > 0)
                {
                    using (MemoryStream docMemStream = new MemoryStream(docSvcByteStream))
                    {
                        rtfViewer.richEditControl.LoadDocument(docMemStream, docFormat);
                    }
                }

                viewerRtfList.Add(rtfViewer);
                rtfViewer.Show();
            }
        }