Beispiel #1
0
        // 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);
        }
Beispiel #2
0
        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;
            }
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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));
                }
            }
        }
Beispiel #5
0
 // 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;
 }
Beispiel #7
0
 public TileImage(ImagePlacement placement)
 {
     Placement = placement;
 }