private void Ajout_Clk(object sender, EventArgs e) { //if(txtAjout.Text == "") //{ // string s = (string)lbPoubelle.SelectedItem; // lbPioche.Items.Add(s); // lbPoubelle.Items.Remove(s); //} if (txtAjout.Text != "") { if (PiocheClass.IsMotValid(txtAjout.Text)) { string motConverti = PiocheClass.Normaliser(txtAjout.Text).ToUpper(); if (!estPresent(motConverti)) { lbPioche.Items.Add(motConverti); } txtAjout.Clear(); txtAjout.Focus(); } else { error.SetError(txtAjout, "Le mot que vous avez entré n'est pas valide."); // txtAjout.Clear(); txtAjout.Focus(); } } //Méthode save dans dico à appeler //Fichiertxt.Add }
private void AjoutPhrase(string ligne) { string tampon = string.Empty; for (int i = 0; i < ligne.Length; i++) { if (!char.IsLetter(ligne[i])) { if (tampon != "") { if (PiocheClass.IsMotValid(tampon)) { string motConverti = PiocheClass.Normaliser(tampon).ToUpper(); if (!estPresent(motConverti)) { lbPioche.Items.Add(motConverti); } } tampon = string.Empty; } } else { tampon += (ligne[i]); } } if (tampon != "") { if (PiocheClass.IsMotValid(tampon)) { string motConverti = PiocheClass.Normaliser(tampon).ToUpper(); if (!estPresent(motConverti)) { lbPioche.Items.Add(motConverti); } } tampon = string.Empty; } }