Exemple #1
0
        private void PopupViewerTif(string pFileName, string pMetadata, string pDocURL)
        {
            bool isDocExists = false;

            foreach (frmViewerTif viewTif in viewerTifList)
            {
                //if (viewTif.Url == pUrl)
                if (viewTif.FileName == pFileName)
                {
                    if (!viewTif.Visible)
                    {
                        viewTif.Show();
                    }
                    else
                    {
                        viewTif.Focus();
                    }
                    viewTif.Show();
                    isDocExists = true;
                    break;
                }
            }

            if (!isDocExists)
            {
                frmViewerTif tifViewerForm = new frmViewerTif();
                //tifViewerForm.Url = pUrl;
                tifViewerForm.FileName = pFileName;
                tifViewerForm.Text     = pMetadata;

                //Image img = Image.FromFile(pFileName);
                Image img = null;

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

                if (docSvcByteStream.Length > 0)
                {
                    using (MemoryStream docMemStream = new MemoryStream(docSvcByteStream))
                    {
                        img = Image.FromStream(docMemStream);
                    }
                }

                tifViewerForm.pictureEdit.Image = img;
                viewerTifList.Add(tifViewerForm);

                tifViewerForm.Show();
            }
        }
        private void PopupViewerTif(string pFileName, string pMetadata, string pDocURL)
        {
            bool isDocExists = false;

            foreach (frmViewerTif viewTif in viewerTifList)
            {
                //if (viewTif.Url == pUrl)
                if (viewTif.FileName == pFileName)
                    {
                    if (!viewTif.Visible)
                    {
                        viewTif.Show();
                    }
                    else
                    {
                        viewTif.Focus();
                    }
                    viewTif.Show();
                    isDocExists = true;
                    break;
                }
            }

            if (!isDocExists)
            {
                frmViewerTif tifViewerForm = new frmViewerTif();
                //tifViewerForm.Url = pUrl;
                tifViewerForm.FileName = pFileName;
                tifViewerForm.Text = pMetadata;

                //Image img = Image.FromFile(pFileName);
                Image img = null;

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

                if (docSvcByteStream.Length > 0)
                {
                    using (MemoryStream docMemStream = new MemoryStream(docSvcByteStream))
                    {
                        img = Image.FromStream(docMemStream);
                    }
                }                    
                    
                tifViewerForm.pictureEdit.Image = img;
                viewerTifList.Add(tifViewerForm);

                tifViewerForm.Show();
            }
        }