public void calcul()
 {
     if (face == 0)
     {
         MessageBox.Show("Vous n'avez pas choisi de dé.");
     }
     else
     {
         if (verif_nb(nb_des.Text))
         {
             if (obj_text.Text != "")
             {
                 jeu();
             }
             if (verif_jeu)
             {
                 DeGenerique dg = new DeGenerique(face);
                 Lancer l = new Lancer(dg, int.Parse(nb_des.Text));
                 l.roll();
                 Thread.Sleep(1500);
                 journal.maj(l);
                 for (int i = 0; i < l.Lancers.Length - 1; i++)
                 {
                     show += l.Lancers[i] + " + ";
                 }
                 show += l.Lancers[l.Lancers.Length - 1] + " = " + l.resultat + " .";
                 if (obj_text.Text != "")
                 {
                     Jeu j = new Jeu(int.Parse(obj_text.Text), Condition, l);
                     j.ResultatJeu();
                 }
                 AffRes.Invoke((Action)(() =>
                 {
                     AffRes.Text = show;
                     Jeter.Image = Resource.dice_game_gamble_roll_label_64;
                 }));
             }
             else
             {
                 Jeter.Image = Resource.dice_game_gamble_roll_label_64;
                 verif_jeu = true;
             }
         }
         else
         {
             MessageBox.Show("Vérifiez le nombre de dés que vous avez entré.");
         }
     }
 }
        private void jeter_Click(object sender, EventArgs e)
        {
            System.Timers.Timer waiter = new System.Timers.Timer();
            waiter.Interval = 5000;
            show            = "";
            Lancer l;

            if (piped_values.Text == "")
            {
                if (face == 4)
                {
                    Jeter.Image = Resource.d4_gif;
                }
                Jeter.Image = Resource.dice_game_gamble_roll_label_64;
                DeGenerique dg = new DeGenerique(face);
                l = new Lancer(dg, int.Parse(nb_des.Text));
                l.roll();
                journal.maj(l);
                for (int i = 0; i < l.Lancers.Length - 1; i++)
                {
                    show += l.Lancers[i] + " + ";
                }
                show       += l.Lancers[l.Lancers.Length - 1] + " = " + l.resultat + " .";
                AffRes.Text = show;
            }
            else
            {
                String[] val_pip  = piped_values.Text.Split(';');
                int[]    temp_val = new int[val_pip.Length];
                for (int i = 0; i < val_pip.Length; i++)
                {
                    temp_val[i] = int.Parse(val_pip[i]);
                }
                DePipe dp = new DePipe(temp_val.Length, temp_val);
                l = new Lancer(dp, int.Parse(nb_des.Text));
                l.roll();
                journal.maj(l);
                for (int i = 0; i < l.Lancers.Length; i++)
                {
                    if (i < l.Lancers.Length - 1)
                    {
                        show += l.Lancers[i] + " + ";
                    }
                }
                show       += l.Lancers[l.Lancers.Length - 1] + " = " + l.resultat + " .";
                AffRes.Text = show;
            }

            if (obj_text.Text != "")
            {
                Jeu j = new Jeu(int.Parse(obj_text.Text), Condition, l);
                j.ResultatJeu();
            }

            //show="" ;
            //sum = 0;
            //for(int i = 0; i < results.Length-1; i++)
            //{
            //    results[i] = randy.Next(1, face);
            //    show += results[i] + " + ";
            //    sum +=  results[i];
            //}
            //results[results.Length - 1] = randy.Next(1, face);
            //show += results[results.Length - 1] + " = ";
            //sum += results[results.Length - 1];
            //show += sum + " .";
            //textBox1.Text = show;
        }
 public void calcul_pipe()
 {
     bool erreur = false;
     if (piped_values.Text != "")
     {
         String[] val_pip = piped_values.Text.Split(';');
         int[] temp_val = new int[val_pip.Length];
         for (int i = 0; i < val_pip.Length; i++)
         {
             try
             {
                 temp_val[i] = int.Parse(val_pip[i]);
             }
             catch
             {
                 erreur = true;
             }
         }
         if (erreur)
         {
             MessageBox.Show("Vérifiez les faces du dés. Seuls les chiffres sont admis, et s'il y a plusieurs faces, elles doivent être séparées par des points-virgules.");
             Jeter.Image = Resource.dice_game_gamble_roll_label_64;
         }
         else
         {
             if (verif_nb(nb_des.Text))
             {
                 if (obj_text.Text != "")
                 {
                     jeu_pipe(temp_val);
                 }
                 if (verif_jeu)
                 {
                     DePipe dp = new DePipe(temp_val.Length, temp_val);
                     Lancer l = new Lancer(dp, int.Parse(nb_des.Text));
                     l.roll();
                     journal.maj(l);
                     for (int i = 0; i < l.Lancers.Length; i++)
                     {
                         if (i < l.Lancers.Length - 1)
                         {
                             show += l.Lancers[i] + " + ";
                         }
                     }
                     show += l.Lancers[l.Lancers.Length - 1] + " = " + l.resultat + " .";
                     Thread.Sleep(1500);
                     AffRes.Invoke((Action)(() =>
                     {
                         if (obj_text.Text != "")
                         {
                             Jeu j = new Jeu(int.Parse(obj_text.Text), Condition, l);
                             j.ResultatJeu();
                         }
                         AffRes.Text = show;
                         Jeter.Image = Resource.dice_game_gamble_roll_label_64;
                     }));
                 }
                 else
                 {
                     verif_jeu = true;
                     Jeter.Image = Resource.dice_game_gamble_roll_label_64;
                 }
             }
             else
             {
                 MessageBox.Show("Vérifiez le nombre de dés que vous avez entré.");
                 Jeter.Image = Resource.dice_game_gamble_roll_label_64;
             }
         }
     }
     else
     {
         MessageBox.Show("Vous n'avez pas indiqué de faces pour votre dé.");
         Jeter.Image = Resource.dice_game_gamble_roll_label_64;
     }
 }
        public void calcul_pipe()
        {
            bool erreur = false;

            if (piped_values.Text != "")
            {
                String[] val_pip  = piped_values.Text.Split(';');
                int[]    temp_val = new int[val_pip.Length];
                for (int i = 0; i < val_pip.Length; i++)
                {
                    try
                    {
                        temp_val[i] = int.Parse(val_pip[i]);
                    }
                    catch
                    {
                        erreur = true;
                    }
                }
                if (erreur)
                {
                    MessageBox.Show("Vérifiez les faces du dés. Seuls les chiffres sont admis, et s'il y a plusieurs faces, elles doivent être séparées par des points-virgules.");
                    Jeter.Image = Resource.dice_game_gamble_roll_label_64;
                }
                else
                {
                    if (verif_nb(nb_des.Text))
                    {
                        if (obj_text.Text != "")
                        {
                            jeu_pipe(temp_val);
                        }
                        if (verif_jeu)
                        {
                            DePipe dp = new DePipe(temp_val.Length, temp_val);
                            Lancer l  = new Lancer(dp, int.Parse(nb_des.Text));
                            l.roll();
                            journal.maj(l);
                            for (int i = 0; i < l.Lancers.Length; i++)
                            {
                                if (i < l.Lancers.Length - 1)
                                {
                                    show += l.Lancers[i] + " + ";
                                }
                            }
                            show += l.Lancers[l.Lancers.Length - 1] + " = " + l.resultat + " .";
                            Thread.Sleep(1500);
                            AffRes.Invoke((Action)(() =>
                            {
                                if (obj_text.Text != "")
                                {
                                    Jeu j = new Jeu(int.Parse(obj_text.Text), Condition, l);
                                    j.ResultatJeu();
                                }
                                AffRes.Text = show;
                                Jeter.Image = Resource.dice_game_gamble_roll_label_64;
                            }));
                        }
                        else
                        {
                            verif_jeu   = true;
                            Jeter.Image = Resource.dice_game_gamble_roll_label_64;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Vérifiez le nombre de dés que vous avez entré.");
                        Jeter.Image = Resource.dice_game_gamble_roll_label_64;
                    }
                }
            }
            else
            {
                MessageBox.Show("Vous n'avez pas indiqué de faces pour votre dé.");
                Jeter.Image = Resource.dice_game_gamble_roll_label_64;
            }
        }
        private void jeter_Click(object sender, EventArgs e)
        {
            System.Timers.Timer waiter = new System.Timers.Timer();
            waiter.Interval=5000;
            show = "";
            Lancer l;
            if (piped_values.Text == "")
            {
                if(face==4)
                {
                    Jeter.Image = Resource.d4_gif;
                }
                Jeter.Image = Resource.dice_game_gamble_roll_label_64;
                DeGenerique dg = new DeGenerique(face);
                l = new Lancer(dg, int.Parse(nb_des.Text));
                l.roll();
                journal.maj(l);
                for(int i = 0; i < l.Lancers.Length-1; i++)
                {
                    show += l.Lancers[i] + " + ";
                }
                show += l.Lancers[l.Lancers.Length-1] + " = " + l.resultat + " .";
                AffRes.Text = show;
            }
            else
            {
                String[] val_pip = piped_values.Text.Split(';');
                int[] temp_val = new int[val_pip.Length];
                for (int i = 0; i < val_pip.Length;i++)
                {
                    temp_val[i] = int.Parse(val_pip[i]);
                }
                DePipe dp = new DePipe(temp_val.Length, temp_val);
                l = new Lancer(dp, int.Parse(nb_des.Text));
                l.roll();
                journal.maj(l);
                for (int i = 0; i < l.Lancers.Length; i++)
                {
                    if(i< l.Lancers.Length - 1)
                    {
                        show += l.Lancers[i] + " + ";
                    }
                }
                show += l.Lancers[l.Lancers.Length - 1] + " = " + l.resultat + " .";
                AffRes.Text = show;

            }

            if (obj_text.Text != "")
            {
                Jeu j = new Jeu(int.Parse(obj_text.Text), Condition, l);
                j.ResultatJeu();
            }

            //show="" ;
            //sum = 0;
            //for(int i = 0; i < results.Length-1; i++)
            //{
            //    results[i] = randy.Next(1, face);
            //    show += results[i] + " + ";
            //    sum +=  results[i];
            //}
            //results[results.Length - 1] = randy.Next(1, face);
            //show += results[results.Length - 1] + " = ";
            //sum += results[results.Length - 1];
            //show += sum + " .";
            //textBox1.Text = show;
        }