/// <summary> /// Resolves Resource to a thumbnail image</summary> /// <param name="resourceUri">Resource URI to resolve</param> /// <returns>Thumbnail image</returns> public Image Resolve(Uri resourceUri) { string path = ThumbnailService.GetResourcePath(resourceUri); if (path == null) { return(null); } Bitmap bitmap = null; string extension = Path.GetExtension(path); if (extension.EndsWith("jpg", StringComparison.InvariantCultureIgnoreCase) || extension.EndsWith("bmp", StringComparison.InvariantCultureIgnoreCase) || extension.EndsWith("png", StringComparison.InvariantCultureIgnoreCase) || extension.EndsWith("tif", StringComparison.InvariantCultureIgnoreCase) || extension.EndsWith("gif", StringComparison.InvariantCultureIgnoreCase)) { using (FileStream strm = File.OpenRead(path)) { bitmap = new Bitmap(strm); strm.Close(); } } return(bitmap); }
public ResourceLister( ICommandService commandService, IControlHostService controlHostService, ISettingsService settingsService, ThumbnailService thumbnailService) { m_commandService = commandService; m_controlHostService = controlHostService; m_settingsService = settingsService; m_thumbnailService = thumbnailService; m_thumbnailService.ThumbnailReady += ThumbnailManager_ThumbnailReady; }