示例#1
0
        private void FormCalculs_Load(object sender, EventArgs e)
        {
            this.Text = Application.ProductName;

            /*
             * if (DateTime.Now.CompareTo(new DateTime(2012, 07, 1)) > 0)
             * {
             *  MessageBox.Show("L'application est périmée. Obtenez une mise à jour auprès de l'auteur ou téléchargez la dernière version.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
             *
             *  if (ApplicationDeployment.IsNetworkDeployed)
             *  {
             *      miseÀJourToolStripMenuItem_Click(null, EventArgs.Empty);
             *  }
             *
             *  this.Close();
             *  return;
             * }
             */

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                miseAJourToolStripMenuItem.Enabled = true;
                //miseÀJourToolStripMenuItem.ToolTipText = string.Format("Dernière recherche: {0}", ApplicationDeployment.CurrentDeployment.TimeOfLastUpdateCheck);

                this.Text += string.Format(" - version {0}", ApplicationDeployment.CurrentDeployment.CurrentVersion);

                if (ApplicationDeployment.CurrentDeployment.IsFirstRun)
                {
                    MessageBox.Show(@"Merci d'utiliser CalculsCE1 !

Le chronomètre et l'étoile récompensent les plus rapides.
Nouveau module pour apprendre l'écriture des nombres en français.
Contrôle hebdomadaire des mises à jour en tâche de fond ou avec le menu.
Le bouton + permet de gérer la liste des prénoms et photos.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);

                    // recharge les photos en ressources le cas échéant
                    if (Properties.Settings.Default.PhotosSupp != null)
                    {
                        foreach (var i in Properties.Settings.Default.PhotosSupp)
                        {
                            FormDownload.Download(i, true);
                        }
                    }
                }
            }
            else
            {
                miseAJourToolStripMenuItem.Enabled = false;
            }

            Historique.Add(DateTime.Now.ToString());
        }
        private void UserControlResult_Load(object sender, EventArgs e)
        {
            Enfants.Init(comboBoxPrenom);
            Historique.SetListBox(listBoxHistorique);

            toolStripStatusLabelSucces.Text  = "";
            toolStripStatusLabelErreurs.Text = "";

            toolStripProgressBar1.Minimum = 0;
            toolStripProgressBar1.Maximum = 5000;   // 5 secondes
            toolStripProgressBar1.Step    = 100;    //
            timerProgressBar.Interval     = 100;    // mise à jour toutes les 100 ms

            toolTip1.SetToolTip(buttonAjoutEnfant, "Ajoute un prénom personnalisé");

            // timer pour afficher l'horloge
            timerHeure_Tick(null, null);
            timerHeure.Interval = 1000;
            timerHeure.Start();
        }
示例#3
0
        /// <summary>
        /// sélectionne un enfant
        /// </summary>
        /// <param name="comboBox1">contrôle ComboBox de la liste des enfants</param>
        /// <param name="pictureBox1">contrôle pour afficher la photo</param>
        public static void Selecteur(ComboBox comboBox1, PictureBox pictureBox1)
        {
            try
            {
                if (comboBox1.SelectedItem == null)
                {
                    pictureBox1.Image = null;
                    return;
                }

                Enfant e = (Enfant)comboBox1.SelectedItem;

                if ((pictureBox1.Tag as string) == e.key)
                {
                    return;
                }

                pictureBox1.Tag = e.key;
                Properties.Settings.Default.Prénom = e.prenom;
                Historique.Add(e.prenom);
                pictureBox1.Image = e.image;
            }
            catch { }
        }
        public void verifie()
        {
            timerProgressBar.Stop();

            string         resultat;
            ResultatCalcul r;

            try
            {
                r = userControlCalcul.Vérifie(out resultat);
            }
            catch
            {
                FormErreur.Show("SAISIE INVALIDE - RECOMMENCE");
                return;
            }

            if (r == ResultatCalcul.ErreurSaisie)
            {
                timerProgressBar.Start();
                return;
            }

            if (toolStripProgressBar1.Value < toolStripProgressBar1.Maximum)
            {
                if (r != ResultatCalcul.OK)
                {
                    etoilesConsécutives = 0;
                    resultat           += " *";
                }
                else
                {
                    ++etoilesConsécutives;
                    resultat += " " + new string('*', etoilesConsécutives);
                }
            }
            else
            {
                etoilesConsécutives = 0;
            }

            Historique.Add(resultat);

            if (r != ResultatCalcul.OK)
            {
                toolStripStatusLabelErreurs.Text = string.Format("Erreurs: {0}", ++erreurs);

                timerProgressBar.Start();
                return;
            }

            toolStripStatusLabelSucces.Text = string.Format("Succès: {0}", ++succes);

            labelBravo.Visible      = true;
            pictureBoxPhoto.Visible = true;
            if (toolStripProgressBar1.Value < toolStripProgressBar1.Maximum)
            {
                pictureBoxStar.Visible = true;
            }
            toolStripProgressBar1.Value = 0;

            if (etoilesConsécutives >= 5)
            {
                new FormBravo(comboBoxPrenom.Text).ShowDialog(this);
                etoilesConsécutives = 0;
            }

            timerEncore.Interval = 3000;         // nouveau calcul dans 3 secondes
            timerEncore.Start();
        }
 private void UserControlResult_ControlRemoved(object sender, ControlEventArgs e)
 {
     Historique.SetListBox(null);
 }