예제 #1
0
 private void hyperLinkEdit1_OpenLink(object sender, DevExpress.XtraEditors.Controls.OpenLinkEventArgs e)
 {
     try
     {
         if (hyperLinkEdit1.EditValue != null)
         {
             NetworkFileSystemUtilsProxy p = new NetworkFileSystemUtilsProxy();
             string temp = p.CopyUncFileToLocalTempFolder(hyperLinkEdit1.EditValue.ToString());
             System.Diagnostics.Process.Start(temp);
         }
     }
     catch (Exception ex)
     {
         ErrorHandler.Show(ex);
     }
 }
예제 #2
0
        private void imageListBoxControl1_DoubleClick(object sender, EventArgs e)
        {
            if (_previewDoc == null)
            {
                return;
            }
            try
            {
                if (imageListBoxControl1.SelectedItem != null)
                {
                    try
                    {
                        CheckSecurityForAttachmentView();
                    }
                    catch (AccessDeniedException)
                    {
                        ErrorHandler.Show("Funzionalità non abilitata. Accesso negato");
                        return;
                    }

                    //una volta verificata la sicurezza devo verificare se l'utente loggato ha il profilo per vedere l'allegato
                    if (!_previewDoc.Scope.IsVisibleFromProfile(SecurityManager.Instance.CurrentUser.Role.Profiles.Select(z => z.Description).ToList(), SecurityManager.Instance.CurrentUser.Username))
                    {
                        ErrorHandler.Show("Funzionalità non abilitata. Accesso negato");
                        return;
                    }

                    AttachmentForDocument c = (imageListBoxControl1.SelectedItem as DevExpress.XtraEditors.Controls.ImageListBoxItem).Value as AttachmentForDocument;
                    if (c.AttachmentExist)
                    {
                        NetworkFileSystemUtilsProxy p = new NetworkFileSystemUtilsProxy();
                        string temp = p.CopyUncFileToLocalTempFolder(c.AttachmentCompletePath);

                        Process.Start(temp);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
            }
        }
예제 #3
0
        private int GetFileImageIndex(AttachmentForDocument attachmentForDocument)
        {
            if (attachmentForDocument == null)
            {
                throw new ArgumentException("Allegato");
            }

            if (!attachmentForDocument.AttachmentExist)
            {
                //aggiungo l'icona di warning all'imagecollection
                imageList1.Images.Add(Properties.Resources.warning_16);
                return(imageList1.Images.Count - 1);
            }

            SHFILEINFO shinfo = new SHFILEINFO();
            //SHFILEINFO shinfo1 = new SHFILEINFO();
            IntPtr hImgSmall; //the handle to the system image list
            //IntPtr hImgLarge; //the handle to the system image list

            //copio il file localmente per fare in modo che possa trarne le informazioni per l'icona

            NetworkFileSystemUtilsProxy p = new NetworkFileSystemUtilsProxy();
            string temp = p.CopyUncFileToLocalTempFolder(attachmentForDocument.AttachmentCompletePath);

            //Use this to get the small Icon
            hImgSmall = Win32.SHGetFileInfo(temp, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_SMALLICON);
            //The icon is returned in the hIcon member of the shinfo struct
            System.Drawing.Icon myIcon = System.Drawing.Icon.FromHandle(shinfo.hIcon);

            ////Use this to get the large Icon
            //hImgLarge = Win32.SHGetFileInfo(fName, 0, ref shinfo1, (uint)Marshal.SizeOf(shinfo1), Win32.SHGFI_ICON | Win32.SHGFI_LARGEICON);
            ////The icon is returned in the hIcon member of the shinfo struct
            //System.Drawing.Icon myIcon1 = System.Drawing.Icon.FromHandle(shinfo1.hIcon);

            imageList1.Images.Add(myIcon);


            return(imageList1.Images.Count - 1);
        }