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()); }
private void HandleClicks(object sender, EventArgs e) { Control control = (Control)sender; if (control.Name.Contains("CustomButton")) { if (ruler.IsGameStarted) { ruler.OpenCard(control.Name); } else { var card = buttonManager.ButtonsCollection().GetCustomButtonByName(control.Name); var imageCollection = libManager.GetImageCollection(); var customImage = imageCollection.FirstOrDefault(n => n.Image == card.Image); if (customImage != null && customImage.AllowUpdate) { var newImage = customImageCollectionConfigurator.UpdateImage(customImage); buttonManager.RefreshButtonImage(card, newImage); SoundPlayer.PlayButtonSound(); } else { SoundPlayer.PlayCannotOpenCardSound(); messageBar.Set("Нажмите ESC чтобы войти в меню"); messageBar.Show(3000, true); } } } }