Ejemplo 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());
        }
Ejemplo n.º 2
0
        public ControlMap(PuzzleTag form)
        {
            this.form               = form;
            this.controlMap         = new List <Control>();
            this.textBoxControlMap  = new List <TextBox>();
            this.buttonControlMap   = new List <Button>();
            this.labelBoxControlMap = new List <Label>();

            InitializeControls();
        }
Ejemplo n.º 3
0
 public PaintForm(SettingsForm settingsForm, PuzzleTag baseForm, string newCollectionName)
 {
     this.settingsForm      = settingsForm;
     this.baseForm          = baseForm;
     this.newCollectionName = newCollectionName;
     InitializeComponent();
     InitPictureLibrary();
     points = new List <Point>();
     draw   = true;
 }
Ejemplo n.º 4
0
        public async Task <IActionResult> ByTag(string variant, string tag)
        {
            if (Regex.IsMatch(tag, "[^0-9a-zA-Z-]"))
            {
                return(ViewResultForHttpError(HttpContext, new HttpErrors.NotFound("Invalid tag.")));
            }

            tag = tag.ToLowerInvariant();
            List <Puzzle> puzzles = await puzzleRepository.FindByVariantAndTag(variant, tag) ?? new List <Puzzle>();

            if (puzzles.Count == 0)
            {
                await tagRepository.MaybeRemoveTagAsync(variant, tag);

                return(ViewResultForHttpError(HttpContext, new HttpErrors.NotFound("That tag has no puzzles for this variant.")));
            }

            PuzzleTag tagDetails = await tagRepository.FindTag(variant, tag);

            ViewBag.Variant     = tagDetails.Variant;
            ViewBag.Tag         = tagDetails.Name;
            ViewBag.Description = tagDetails.Description;
            return(View(puzzles.Select(p => p.ID).OrderBy(x => x).ToList()));
        }