public void Load(List <string> filePaths) { Clear(); var count = filePaths.Count; if (count > MaxCapacity) { count = MaxCapacity; } var thumbnailCreation = new ThumbnailCreation() { MaxImageLength = 400 }; for (var i = 0; i < count; i++) { var filePath = filePaths[i]; var bitmap = thumbnailCreation.CreateThumbnailImage(filePath); Debug.WriteLine($"({bitmap.Width},{bitmap.Height})"); var angle = (double)((i * 360.0f) / count); var thumbImage = new ThumbImage(new Bitmap(bitmap), CircleCenter, angle) { HoverColor = HoverColor }; bitmap.Dispose(); var thumbElement = new ThumbElement() { FullPath = filePath, Name = Path.GetFileNameWithoutExtension(filePaths[i]), Description = string.Empty, ThumbImage = thumbImage, }; Images.Add(thumbElement); } }
public void Load(List<string> filePaths) { Clear(); var count = filePaths.Count; if (count > MaxCapacity) { count = MaxCapacity; } for (var i = 0; i < count; i++) { var filePath = filePaths[i]; var thumbnailCreation = new ThumbnailCreation(); var bitmap = thumbnailCreation.CreateThumbnailImage(filePath); var angle = (double)((i * 360.0f) / count); var thumbImage = new ThumbImage(new Bitmap(bitmap), CircleCenter, angle) { HoverColor = HoverColor }; var thumbElement = new ThumbElement() { FullPath = filePath, Name = Path.GetFileNameWithoutExtension(filePaths[i]), Description = string.Empty, ThumbImage = thumbImage, }; Images.Add(thumbElement); } }
public void Load(List <ThumbElement> thumbElements) { if (thumbElements == null || !thumbElements.Any()) { return; } Clear(); var count = thumbElements.Count; if (count > MaxCapacity) { count = MaxCapacity; } var thumbnailCreation = new ThumbnailCreation() { MaxImageLength = MaxImageLength }; for (var i = 0; i < count; i++) { var item = thumbElements[i]; Image bitmap = null; if (!string.IsNullOrEmpty(item.ImageBase64String)) { if (Images.Any(x => x.ImageBase64String == item.ImageBase64String)) { continue; } bitmap = thumbnailCreation.CreateFromBase64String(item.ImageBase64String, ScalingOption, DestinationSize); } else { if (Images.Any(x => x.FullPath == item.FullPath)) { continue; } bitmap = thumbnailCreation.CreateThumbnailImage(item.FullPath, ScalingOption, DestinationSize); } if (bitmap == null) { continue; } var angle = (double)((i * 360.0f) / count); var thumbImage = new ThumbImage() { Name = item.Name, ThumbOriginalBitmap = new Bitmap(bitmap), OriginalAngle = angle, CircleCenter = CircleCenter, HoverColor = HoverColor, SelectedColor = SelectedColor, IsSelected = item.IsSelected, }; bitmap.Dispose(); var thumbElement = new ThumbElement() { FullPath = item.FullPath, Name = item.Name, Description = item.Description, ThumbImage = thumbImage, IsSelected = item.IsSelected, }; Images.Add(thumbElement); } }