示例#1
0
 public bool SelectHoverItem(Point location)
 {
     SelectedObject = null;
     Parallel.ForEach(Images.Where(obj => obj.ThumbImage.CheckIsHover(location)), obj =>
     {
         SelectedObject = obj;
     });
     return(SelectedObject != null);
 }
示例#2
0
        public void Load(List <string> filePaths)
        {
            var count         = filePaths.Count;
            var thumbElements = new List <ThumbElement>();

            for (var i = 0; i < count; i++)
            {
                var filePath = filePaths[i];


                var thumbElement = new ThumbElement()
                {
                    FullPath    = filePath,
                    Name        = Path.GetFileNameWithoutExtension(filePaths[i]),
                    Description = string.Empty,
                };
                thumbElements.Add(thumbElement);
            }
            Load(thumbElements);
        }
示例#3
0
        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);
            }
        }
示例#4
0
 public bool SelectHoverItem(Point location)
 {
     SelectedObject = null;
     Parallel.ForEach(Images.Where(obj => obj.ThumbImage.CheckIsHover(location)), obj =>
     {
         SelectedObject = obj;
     });
     return (SelectedObject != null);
 }
示例#5
0
        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);
            }
        }
示例#6
0
        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);
            }
        }