// past image depending on placement specification public bool Paste(ImagePlacement place) { // accept file name, one only if (Clipboard.ContainsFileDropList()) { StringCollection fdl = Clipboard.GetFileDropList(); if (fdl.Count == 1) { string file = fdl[0].ToLower(); // only accept these file extensions... switch (Path.GetExtension(file)) { case ".jpg": CurrentScreen.ImageInstance.SetImage(new Bitmap(file), place); return(true); case ".bmp": CurrentScreen.ImageInstance.SetImage(new Bitmap(file), place); return(true); case ".gif": CurrentScreen.ImageInstance.SetImage(new Bitmap(file), place); return(true); case ".wav": CurrentScreen.SoundFile = file; Sound(true); return(true); } } } if (Clipboard.ContainsAudio()) { Stream sound = Clipboard.GetAudioStream(); CurrentScreen.SoundAudio = sound; Sound(true); return(true); } // accept image if (Clipboard.ContainsImage()) { CurrentScreen.ImageInstance.SetImage((Bitmap)Clipboard.GetImage(), place); return(true); } return(false); }
public void SetImage(string imagePath, ImagePlacement placement) { CheckImagePath(imagePath); switch (placement) { case ImagePlacement.Inline: UpdateTemplateType(); this.imagePath = imagePath; break; case ImagePlacement.AppLogo: this.appLogoImagePath = imagePath; break; case ImagePlacement.Hero: this.heroImagePath = imagePath; break; } }
public void SetImage(Image image, ImagePlacement placement) { string imagePath = GetTempPath(); switch (placement) { case ImagePlacement.Inline: if (tempImagePath != null) { RemoveTempFile(tempImagePath); tempImagePath = null; } tempImagePath = imagePath; break; case ImagePlacement.AppLogo: if (tempAppLogoImagePath != null) { RemoveTempFile(tempAppLogoImagePath); tempAppLogoImagePath = null; } tempAppLogoImagePath = imagePath; break; case ImagePlacement.Hero: if (tempHeroImagePath != null) { RemoveTempFile(tempHeroImagePath); tempHeroImagePath = null; } tempHeroImagePath = imagePath; break; } SaveImageToFile(image, imagePath); SetImage(imagePath, placement); }
public void AddImageToken(string tokenId, string caption, CaptionPlacement captionPlacement, string imageId, ImagePlacement imagePlacement) { /* * <mediaLink> * <caption>Caption Before</caption> * <image placement="center" xlink:href="6be7079d-a9d8-4189-9021-0f72d1642beb"/> * </mediaLink> */ XElement media = new XElement(ddue + "mediaLink"); if (null != caption) { media.Add(new XElement(ddue + "caption", new XAttribute("placement", captionPlacement.ToString()))); media.Add(new XElement(ddue + "image", new XAttribute("placement", imagePlacement.ToString()), new XAttribute(xlink + "href", imageId))); if (doc.Root != null) { doc.Root.Add(new XElement("item", new XAttribute("id", tokenId), media)); } } }
// past image depending on placement specification public bool Paste(ImagePlacement place) { // accept file name, one only if(Clipboard.ContainsFileDropList()){ StringCollection fdl = Clipboard.GetFileDropList(); if(fdl.Count == 1){ string file = fdl[0].ToLower(); // only accept these file extensions... switch (Path.GetExtension(file)) { case".jpg": CurrentScreen.ImageInstance.SetImage(new Bitmap(file), place); return true; case ".bmp": CurrentScreen.ImageInstance.SetImage(new Bitmap(file), place); return true; case ".gif": CurrentScreen.ImageInstance.SetImage(new Bitmap(file), place); return true; case ".wav": CurrentScreen.SoundFile = file; Sound(true); return true; } } } if (Clipboard.ContainsAudio()){ Stream sound = Clipboard.GetAudioStream(); CurrentScreen.SoundAudio = sound; Sound(true); return true; } // accept image if (Clipboard.ContainsImage()) { CurrentScreen.ImageInstance.SetImage((Bitmap)Clipboard.GetImage(), place); return true; } return false; }
public TileImage(ImagePlacement placement) { Placement = placement; }