Exemple #1
0
 public GameCatalogControl(GameToDisplay game)
 {
     InitializeComponent();
     foreach (Control control in this.Controls)
     {
         if (control != BuyButton)
         {
             control.Click += GameCatalogControl_Click;
         }
     }
     ShowGameDetails(game);
 }
Exemple #2
0
 private void ShowGameDetails(GameToDisplay game)
 {
     Name        = game.Name;
     Image       = game.Image;
     Players     = game.Players;
     Duration    = game.Duration;
     Description = game.Description;
     Price       = game.Price;
     if (game.Quantity < 1)
     {
         BuyButton.Enabled   = false;
         BuyButton.TextAlign = ContentAlignment.MiddleCenter;
         BuyButton.Text      = "Нет в наличии";
         pictureBox1.Hide();
     }
 }
Exemple #3
0
        public static GameToDisplay PrepareGameToDisplay(GameParams gameParams)
        {
            var gameToDisplay = new GameToDisplay();

            gameToDisplay.Name             = gameParams.Name;
            gameToDisplay.Image            = gameParams.Image != null? (Image)gameParams.Image.Clone() : null;
            gameToDisplay.Duration         = $"{gameParams.minDuration}-{gameParams.maxDuration}";
            gameToDisplay.Players          = $"{gameParams.minPlayers}-{gameParams.maxPlayers}";
            gameToDisplay.Price            = gameParams.Price.ToString() + "₽";
            gameToDisplay.Description      = gameParams.Description;
            gameToDisplay.Quantity         = gameParams.Quantity;
            gameToDisplay.Type             = gameParams.Type;
            gameToDisplay.Genre            = gameParams.Genre;
            gameToDisplay.Author           = gameParams.Author;
            gameToDisplay.Difficulty       = gameParams.Difficulty;
            gameToDisplay.GenreDescription = gameParams.GenreDescription;
            gameToDisplay.TypeDescription  = gameParams.TypeDescription;
            return(gameToDisplay);
        }
        private void ShowGameInfo(GameToDisplay game)
        {
            pictureBox1.Image       = game.Image;
            NameTextBox.Text        = game.Name;
            DescriptionTextBox.Text = game.Description;
            difficultyRating1.Value = game.Difficulty;
            genreTextBox.Text       = game.Genre;
            var genreToolTip = new ToolTip();

            genreToolTip.SetToolTip(genreTextBox, game.GenreDescription);
            TypeTextBox.Text = game.Type;
            var typeToolTip = new ToolTip();

            typeToolTip.SetToolTip(TypeTextBox, game.TypeDescription);
            priceTextBox.Text    = game.Price;
            PlayersTextBox.Text  = game.Players;
            durationTextBox.Text = game.Duration;
            authorTextBox.Text   = game.Author;
            QuantityLabel.Text   = $"На складе: {game.Quantity.ToString()}";
        }
 public GameInfoForm(GameToDisplay game)
 {
     InitializeComponent();
     ShowGameInfo(game);
 }