public static ThumbnailerBase CreateInstance(MimeType mimeType, bool decorateThumbnail)
        {
            ThumbnailerBase thumbnailer = null;

            switch (mimeType)
            {
            case MimeType.Audio:
                thumbnailer = new ThumbnailerAudio();
                break;

            case MimeType.Video:
                thumbnailer = new ThumbnailerVideo();
                break;

            case MimeType.Image:
                thumbnailer = new ThumbnailerImage();
                break;

            default:
                break;
            }

            if (decorateThumbnail)
            {
                return(new ThumbnailerDecoratorWatermark(thumbnailer));
            }
            else
            {
                return(thumbnailer);
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var mimeType = ((MimeTypeDisplay)comboBox1.SelectedItem).MimeType;

            var mediaInfo = new MediaInfo("Some file name", mimeType, null);

            ThumbnailerBase thumbnailer = ThumbnailerFactory.CreateThumbnailer(mediaInfo.MimeType);

            pictureBox1.Image = thumbnailer.GetThumbnail(mediaInfo);
        }