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); }
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; }
//asks for URL public static ImageSource ProcessAttachCmd(ArgPoint Point, AttachCmd cmd, ref Attachment a) { return(ProcessCommand2(Point, cmd, null, ref a)); }
//asks for URL public static ImageSource ProcessAttachCmd(ArgPoint Point, AttachCmd cmd, ref Attachment a) { return ProcessCommand2(Point, cmd, null, ref a); }