Exemplo n.º 1
0
        public List <CustomImage> GenerateImageCollectionByCategory(PuzzleTag baseForm, string category, int weidth, int height)
        {
            var newImageCollection = new List <CustomImage>(16);
            var capacity           = 16;

            for (int i = 0; i < capacity; i++)
            {
                Image image = imageProvider.SetDefaultSize(weidth, height).GetImageByCategory(category);

                baseForm.UpdateStatusMessage($"ПОИСК ИЗОБРАЖЕНИЙ ПО КАТЕГОРИИ '{category.ToUpper()}' ... ({i+1} из 16)");

                var newImage = new CustomImage
                {
                    Name        = $"{category}{i}.Jpeg",
                    Category    = category,
                    AllowUpdate = true,
                    Image       = image
                };

                newImageCollection.Add(newImage);
                newImageCollection.Add(newImage);
            }

            libManager.AddCategory(category);
            libManager.InitializeNewCollection(newImageCollection);

            return(libManager.GetImageCollection());
        }
Exemplo n.º 2
0
 private void SaveCustomImageCollection(string collectionName, List <CustomImage> imageCollection)
 {
     if (imageCollection != null && imageCollection.Count == 32)
     {
         string libPath = libManager.LibraryPath;
         fileManager.SaveNewCollection(imageCollection, collectionName, libPath);
         libManager.AddCategory(collectionName);
         libManager.InitializeNewCollection(imageCollection);
     }
 }