Beispiel #1
0
 private void Button2_Click(object sender, EventArgs e)
 {
     if (textBoxPumpWeight.Text != String.Empty && players.Count >= 2)
     {
         int  weight      = 0;
         bool parseWeight = int.TryParse(textBoxPumpWeight.Text, out weight);
         if (parseWeight && weight >= 40 && weight <= 140)
         {
             server.ClearPlayer();
             view.ClearInfo();
             foreach (var p in players)
             {
                 server.AddPlayer(p.name, (Skills.SkillsPlayerEnum)p.skills);
             }
             view.SetPumpkinWeight(weight);
             server.NewPumpkinWeight(weight);
             server.UpdateVictory();
             Task.Factory.StartNew(() => server.NewTry());
             this.Close();
         }
         else
         {
             MessageBox.Show("Вес тыквы в приделах от 40 до 140");
         }
     }
     else
     {
         if (textBoxPumpWeight.Text == String.Empty)
         {
             MessageBox.Show("Введите вес тыквы");
         }
         if (players.Count < 2)
         {
             MessageBox.Show("Введите больше игроков");
         }
     }
 }