예제 #1
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }

            return(AttachmentManager.GetAttachmentBitmap3(value as Attachment));
        }
예제 #2
0
        private static ImageSource ProcessCommand2(ArgPoint Point, AttachCmd cmd, string Url, ref Attachment a)
        {
            a = null;

            try
            {
                switch (cmd)
                {
                case AttachCmd.ATTACH_IMG_OR_PDF:
                    a = AttachmentManager.AttachLocalFile(Point);
                    if (a != null)
                    {
                        return(GetAttachmentBitmap3(a));
                    }
                    break;

                case AttachCmd.ATTACH_PDF:
                    a = AttachmentManager.AttachPDF(Point);
                    if (a != null)
                    {
                        return(GetAttachmentBitmap3(a));
                    }
                    break;

                case AttachCmd.ATTACH_PDF_FROM_URL:
                    a = AttachmentManager.AttachPdfFromURL(Point, Url);
                    if (a != null)
                    {
                        return(GetAttachmentBitmap3(a));
                    }
                    break;

                case AttachCmd.ATTACH_IMAGE:
                    a = AttachmentManager.AttachPicture(Point);
                    if (a != null)
                    {
                        return(GetAttachmentBitmap3(a));
                    }
                    break;

                case AttachCmd.ATTACH_IMAGE_URL:
                    a = AttachmentManager.AttachFromURL(Point, Url);
                    if (a != null)
                    {
                        return(GetAttachmentBitmap3(a));
                    }
                    break;

                case AttachCmd.ATTACH_YOUTUBE:
                    a = AttachmentManager.AttachFromYoutube(Point, Url);
                    if (a != null)
                    {
                        return(new BitmapImage());    //returning stub for external error-checking
                    }
                    break;
                }
            }
            catch (Exception)
            {
                MessageDlg.Show(
                    "Cannot process attachment. If it's link, check it's correct. If it's file, ensure program has permissions to access it",
                    "Error");
                return(null);
            }

            return(null);
        }