public WorkItem(string sourcePath, int width, int height, CreatedDelegate createdDelegate) { _width = width; _height = height; _sourcePath = sourcePath; _createdDelegate = createdDelegate; }
protected static bool CreateThumbCallback(string sourcePath, int width, int height, CreatedDelegate createdDelegate) { bool success = false; byte[] imageData = null; ImageType imageType = ImageType.Unknown; try { if (Directory.Exists(sourcePath) || File.Exists(sourcePath)) success = GetThumbnailInternal(sourcePath, width, height, false, out imageData, out imageType); } catch (Exception ex) { ServiceRegistration.Get<ILogger>().Warn("ThumbnailGenerator: Error creating thumbnails", ex); } if (createdDelegate != null) createdDelegate(sourcePath, success, imageData, imageType); return success; }
protected bool CreateThumbCallback(string sourcePath, int width, int height, CreatedDelegate createdDelegate) { bool success = false; byte[] imageData = null; ImageType imageType = ImageType.Unknown; try { if (Directory.Exists(sourcePath) || File.Exists(sourcePath)) { success = GetThumbnailInternal(sourcePath, width, height, false, out imageData, out imageType); } } catch (Exception ex) { ServiceRegistration.Get <ILogger>().Warn("ThumbnailGenerator: Error creating thumbnails", ex); } if (createdDelegate != null) { createdDelegate(sourcePath, success, imageData, imageType); } return(success); }
public void GetThumbnail_Async(string fileOrFolderPath, int width, int height, CreatedDelegate createdDelegate) { InitProviders(); if (IsCreating(fileOrFolderPath)) return; if (width == 0) width = DEFAULT_THUMB_WIDTH; if (height == 0) height = DEFAULT_THUMB_WIDTH; WorkItem newItem = new WorkItem(fileOrFolderPath, width, height, createdDelegate); lock (this) { _workToDo.Enqueue(newItem); if (_workerThread != null) return; _workerThread = new Thread(Worker) { IsBackground = true, Name = "ThumbGen" }; _workerThread.Start(); } }
public void GetThumbnail_Async(string fileOrFolderPath, CreatedDelegate createdDelegate) { GetThumbnail_Async(fileOrFolderPath, DEFAULT_THUMB_WIDTH, DEFAULT_THUMB_HEIGHT, createdDelegate); }
public void GetThumbnail_Async(string fileOrFolderPath, int width, int height, CreatedDelegate createdDelegate) { InitProviders(); if (IsCreating(fileOrFolderPath)) { return; } if (width == 0) { width = DEFAULT_THUMB_WIDTH; } if (height == 0) { height = DEFAULT_THUMB_WIDTH; } WorkItem newItem = new WorkItem(fileOrFolderPath, width, height, createdDelegate); lock (this) { _workToDo.Enqueue(newItem); if (_workerThread != null) { return; } _workerThread = new Thread(Worker) { IsBackground = true, Name = "ThumbGen" }; _workerThread.Start(); } }