private void SetVoiture() { string nomvoiture = nom.Text; string numerovoiture = numero.Text; string pilotevoiture = pilote.Text; int consommationvoiture = Convert.ToInt32(consommation.Text); int vitessevoiture = Convert.ToInt32(vitesseInit.Text); double carburant = Convert.ToDouble(carburVal.Text); Voiture voiture = new Voiture { Nom = nomvoiture, Numero = numerovoiture, Pilote = pilotevoiture, Consommation = consommationvoiture, Idpiste = _pist.Id, Vitesse = vitessevoiture, Carburant = carburant }; AccesFichier.WriteVoitureCourse(voitures); Fonction.SaveCourseVoiture(voiture); voitures.Add(voiture); numLabels.Add(new Label()); }
private void FormProjetMorpion_Load(object sender, EventArgs e) { FormJoueur FP = new FormJoueur(arrivage); FP.ShowDialog(); LangueElement = Fonction.LangageAppli(); label2.Text = LangueElement[208]; label4.Text = LangueElement[209]; lblj1.Text = LangueElement[210]; lblj2.Text = LangueElement[211]; btnRejouer.Text = LangueElement[212]; label1.Text = LangueElement[217]; Fonction.policeTexte(this); // Gestion police lblj1.Text = joueur1[0].ToString().ToUpper() + joueur1.Substring(1).ToLower(); if (mode == "0") { lblj2.Text = LangueElement[213]; against_computer = true; label4.Visible = true; label1.Visible = true; } else { lblj2.Text = joueur2[0].ToString().ToUpper() + joueur2.Substring(1).ToLower(); against_computer = false; label4.Visible = false; label1.Visible = false; } }
private void pbCode_Click(object sender, EventArgs e) { string[] recupCode = Fonction.lireCodeProjet(@"Morpion\CodeMorpion.txt"); tbCode.Text = ""; tbCode.ReadOnly = true; tbCode.BorderStyle = 0; tbCode.TabStop = false; tbCode.Visible = true; pbRetour.Visible = false; tbCode.Lines = recupCode; tbCode.BringToFront(); // panel1.Focus(); // panel1.Select(); pbCode.Visible = false; pbRetourForm.Visible = true; tbCode.Visible = true; pbRetourForm.BringToFront(); var pos = this.PointToScreen(pbRetourForm.Location); pos = tbCode.PointToClient(pos); pbRetourForm.Parent = tbCode; pbRetourForm.Location = pos; pbRetourForm.BackColor = Color.Transparent; }
public EmployeeForm(Fonction f, bool iIsNew, string employeePath = "") { InitializeComponent(); Fonction = f; IsNew = iIsNew; Text = (IsNew ? @"New " : @"Inspect ") + Fonction; if(!IsNew && employeePath.Length > 0) { var employee = new Employee(File.ReadAllLines(employeePath)); TextBoxFirstName.Text = employee.FirstName; TextBoxLastName.Text = employee.LastName; DateTimePickerBirthday.Value = employee.Birth; TextBoxPhone.Text = employee.Phone; TextBoxEmail.Text = employee.Email; if(employee.PicturePath != "") PictureBox.ImageLocation = employee.PicturePath; if(employee.Notes != "") RichTextBoxComment.Text = employee.Notes; } }
public ActionResult DeleteConfirmed(int id) { Fonction fonction = db.Fonctions.Find(id); db.Fonctions.Remove(fonction); db.SaveChanges(); return(RedirectToAction("Index")); }
private void FormProjetCodeSourceSiteWeb_Load(object sender, EventArgs e) { LangueElement = Fonction.LangageAppli(); this.Text = LangueElement[181]; lblTitreCSSW.Text = LangueElement[181]; btnCSSW.Text = LangueElement[182]; rtbCSSW.Text = LangueElement[183]; Fonction.policeTexte(this); // Gestion police }
private static string calcul_integ(Fonction f, int n) { double a = 0.0; double b = 1.0; double h = (b - a) / n; return string.Format("{0:0.0E+0}", rectangles(f, n, a, h)) + "\t\t" + string.Format("{0:0.0E+0}", trapezes(f, n, a, b, h)) + "\t\t" + string.Format("{0:0.0E+0}", simpson(f, n, a, b, h)) + "\n"; }
public ActionResult Edit([Bind(Include = "Id,nom_fonction")] Fonction fonction) { if (ModelState.IsValid) { db.Entry(fonction).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fonction)); }
/// <summary> /// Récupère la phrase représentant la fonction du personnel actuel /// </summary> /// <returns></returns> public string getStringFromFonction() { if (Fonction != null && !Fonction.Equals("neant")) { return(getPronomFromSexe() + " est " + Fonction + "."); } else { return(getPronomFromSexe() + " n'occupe pas de fonction."); } }
private void FormJoueur_Load(object sender, EventArgs e) { LangueElement = Fonction.LangageAppli(); rbOrdi.Text = LangueElement[195]; rb2j.Text = LangueElement[196]; label1.Text = LangueElement[197]; label2.Text = LangueElement[199]; btnJouer.Text = LangueElement[200]; Fonction.policeTexte(this); // Gestion police }
public ActionResult Create([Bind(Include = "Id,nom_fonction")] Fonction fonction) { if (ModelState.IsValid) { db.Fonctions.Add(fonction); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fonction)); }
private void FormProjetBoutonAnime_Load(object sender, EventArgs e) { LangueElement = Fonction.LangageAppli(); this.Text = LangueElement[187]; lblTitre.Text = LangueElement[187]; lblTexte.Text = LangueElement[188] + "\n" + LangueElement[189] + "\n" + LangueElement[190]; animated_Button1.Text = LangueElement[191]; animated_Button21.Text = LangueElement[191] + " 2"; animated_Button31.Text = LangueElement[191] + " 3"; Fonction.policeTexte(this); // Gestion police }
private void FormProjetPendu_Load(object sender, EventArgs e) { LangueElement = Fonction.LangageAppli(); this.Text = LangueElement[145]; label1.Text = LangueElement[146]; aide.Text = LangueElement[147]; label2.Text = LangueElement[148]; texteresultat.Text = LangueElement[149]; btnRejouer.Text = LangueElement[150]; gbAlphabet.Text = LangueElement[151]; Fonction.policeTexte(this); // Gestion police }
public Rally(Piste piste, Coursse course, int pistelong) { InitializeComponent(); _pist = piste; coursse = course; secteurs = Fonction.GetSecteurs(_pist.Id); voitures = new List <Voiture>(); SetForm(); GenererRavits(); _points = AccesFichier.ReadPiste(_pist.Nom); SetNbTours(); unitepiste = Fonction.Point1Km(_points.Count, pistelong); }
// GET: /Fonction/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Fonction fonction = db.Fonctions.Find(id); if (fonction == null) { return(HttpNotFound()); } return(View(fonction)); }
public static FonctionDto FromModel(Fonction model) { return(new FonctionDto() { Fonctionid = model.Fonctionid, Code = model.Code, Fonctionlibelle = model.Fonctionlibelle, DateCreation = model.DateCreation, ModifieLe = model.ModifieLe, ModifiePar = model.ModifiePar, StateCode = model.StateCode, StatusCode = model.StatusCode, Tbagent = model.Tbagent, }); }
//Evénement qui a lieu lorsque l'utilisateur sélectionne un intervenant a modifié private void cmboxChoixModifInterv_SelectedIndexChanged(object sender, EventArgs e) { if (cmboxChoixModifInterv.SelectedIndex != -1) { string intervChoisi = cmboxChoixModifInterv.SelectedItem.ToString(); IntervenantDivers intervRecup = IntervenantDivers.RecupInfoInterv(intervChoisi); txtIdModifInterv.Text = intervRecup.idInterv.ToString(); txtNomModifInterv.Text = intervRecup.nomInterv; txtPrenomModifInterv.Text = intervRecup.prenomInterv; txtSurnModifInterv.Text = intervRecup.surnomInterv; txtDateNaiModifInterv.Text = intervRecup.dateNaiInterv.ToString().Substring(0, 10); txtDateMortModifInterv.Text = intervRecup.dateMortInterv; txtNatioModifInterv.Text = Pays.TrouvNomPays(intervRecup.idPaysInterv); txtFoncModifInterv.Text = Fonction.TrouvNomFonction(intervRecup.idFonct); } }
public void Start(Fonction target) { _fonction = target; if (_type == TypeScheduler.TYPE_EVERY_TIME) { _time_execution = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, _time_execution.Hour, _time_execution.Minute, _time_execution.Second); DateTime current = DateTime.Now; TimeSpan interval = _time_execution - current; long milliseconde = (long)interval.TotalMilliseconds; _milli = milliseconde >= 0 ? milliseconde : Utils.MilliSeconds(1, 0, 0, 0) + milliseconde; } _timer = SetTimer(_day, _hour, _min, _sec); _timer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimer); _timer.Enabled = true; _timer.Start(); }
private void AssemblerBio(CVSection sectionIdentification) { FonctionGraphRepository fonctionGraphRepository = new FonctionGraphRepository(); XmlDocNode identification = sectionIdentification.Nodes.First(); Fonction fonction = new Fonction(); CV cv = new CV(); if (identification is XmlDocTable) { var paragraphs = ((XmlDocTable)identification).GetParagraphsFromColumn(2); List <string> identLines = new List <string>(); if (paragraphs.Count() == 1) { XmlDocParagraph paragraph = paragraphs.First <XmlDocParagraph>(); identLines.AddRange(paragraph.GetLinesText()); } else { foreach (var paragragh in paragraphs) { identLines.AddRange(paragragh.GetLinesText()); } } utilisateur = new Utilisateur(); utilisateur.Nom = identLines.First(); fonction = fonctionGraphRepository.CreateIfNotExists(new Dictionary <string, object> { { "Description", identLines.Last() } }); } string description = string.Empty; List <XmlDocParagraph> descriptionParagraphs = sectionIdentification.Nodes.Skip(2).Cast <XmlDocParagraph>().ToList(); descriptionParagraphs.ForEach(x => description = $"{description}\n{x.GetText()}"); cv.ResumeExperience = description; cv.Status = StatusCV.Nouveau; utilisateur.Conseiller = conseiller; conseiller.Fonction = fonction; conseiller.CVs.Add(cv); }
private void SetStat() { try { List <Voiture> mouvements = Fonction.GetVoitures(_pist.Id); Console.WriteLine(mouvements.Count); int taille = mouvements.Count; for (int i = 0; i < taille; i++) { dataGridView1.Rows.Add(mouvements[i].Nom, mouvements[i].Numero, mouvements[i].Vitesse, mouvements[i].Depassement); } } catch (Exception e) { Console.WriteLine(e); throw e; } }
//Evénement qui charge les informations du troisième intervenant sélectionné par l'utilisateur private void cmboxChoixIntervTiers_SelectedIndexChanged(object sender, EventArgs e) { try { if (cmboxChoixIntervTiers.SelectedIndex != -1) { string nomIntervTiersChoisi = cmboxChoixIntervTiers.SelectedItem.ToString(); IntervenantDivers intervTiersChoisi = IntervenantDivers.RecupInfoInterv(nomIntervTiersChoisi); txtNomIntervTiers.Text = intervTiersChoisi.nomInterv; txtPrenomIntervTiers.Text = intervTiersChoisi.prenomInterv; txtSurnIntervTiers.Text = intervTiersChoisi.surnomInterv; txtNatioIntervTiers.Text = Pays.TrouvNomPays(intervTiersChoisi.idPaysInterv); txtDateNaiIntervTiers.Text = intervTiersChoisi.dateNaiInterv.ToString().Substring(0, 10); txtDateMortIntervTiers.Text = intervTiersChoisi.dateMortInterv; txtFonctIntervTiers.Text = Fonction.TrouvNomFonction(intervTiersChoisi.idFonct); } } catch { throw new Exception("Impossible de récupérer les données du troisième intervenant sélectionné"); } }
private void insertCourse_Click(object sender, EventArgs e) { try { string idpiste = GenericForm.OnSelectedItemId(pistecombo); string npiste = GenericForm.OnSelectedItemValue(pistecombo); string pistelong = longpiste.Text; int tours = Convert.ToInt32(this.nbTours.Text); coursse = Fonction.SaveCourse(idpiste, npiste, Convert.ToInt32(textBox1.Text), tours, dateTimePicker1.Value, int.Parse(pistelong)); Console.WriteLine(idpiste); piste = Fonction.GetPiste(idpiste); Rally rally = new Rally(piste, coursse, int.Parse(pistelong)); rally.Show(); Dispose(false); } catch (Exception exception) { MessageBox.Show(@"erreur"); Console.WriteLine(exception.Message); MessageBox.Show(exception.Message); } }
public Tbagent ToModel() { return(new Tbagent() { AgentId = AgentId, Matricule = Matricule, Nom = Nom, Prenoms = Prenoms, Password = Password, Categorie = Categorie, Telephone = Telephone, Lettreaffectee = Lettreaffectee, Fonctionid = Fonctionid, IdUser = IdUser, DateCreation = DateCreation, ModifieLe = ModifieLe, ModifiePar = ModifiePar, StateCode = StateCode, StatusCode = StatusCode, Fonction = Fonction.ToModel(), Tbuser = Tbuser, }); }
private static void ShowNewEmployeeForm(Fonction f) { const bool oIsNew = true; var employeeForm = new EmployeeForm(f, oIsNew); employeeForm.ShowDialog(); }
private void ChercheGagant() { bool gagnant = false; //horizontal if ((A1.Text == A2.Text) && (A2.Text == A3.Text) && (!A1.Enabled)) { gagnant = true; } else if ((B1.Text == B2.Text) && (B2.Text == B3.Text) && (!B1.Enabled)) { gagnant = true; } else if ((C1.Text == C2.Text) && (C2.Text == C3.Text) && (!C1.Enabled)) { gagnant = true; } //vertical else if ((A1.Text == B1.Text) && (B1.Text == C1.Text) && (!A1.Enabled)) { gagnant = true; } else if ((A2.Text == B2.Text) && (B2.Text == C2.Text) && (!A2.Enabled)) { gagnant = true; } else if ((A3.Text == B3.Text) && (B2.Text == C3.Text) && (!A3.Enabled)) { gagnant = true; } //diagonal else if ((A1.Text == B2.Text) && (B2.Text == C3.Text) && (!A1.Enabled)) { gagnant = true; } else if ((A3.Text == B2.Text) && (B2.Text == C1.Text) && (!C1.Enabled)) { gagnant = true; } if (gagnant) { DesactiveBouton(); String winner = ""; if (tour) { nbj2++; lblnbj2.Text = nbj2.ToString(); winner = lblj2.Text; Fonction.ecrireFichierProjetJeu(@"Morpion\StatsMorpion.txt", winner, "Victoire"); Fonction.ecrireFichierProjetJeu(@"Morpion\StatsMorpion.txt", lblj1.Text, "Defaite"); } else { nbj1++; lblnbj1.Text = nbj1.ToString(); winner = lblj1.Text; Fonction.ecrireFichierProjetJeu(@"Morpion\StatsMorpion.txt", winner, "Victoire"); Fonction.ecrireFichierProjetJeu(@"Morpion\StatsMorpion.txt", lblj2.Text, "Defaite"); } MessageBox.Show(winner + LangueElement[214], LangueElement[215]); } else { if (nb_tour == 9) { MessageBox.Show(LangueElement[216], LangueElement[215]); } } }
private void barButtonItem38_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Fonction f = new Fonction(); f.ShowDialog(); }
/* private void Confirmation(object sender, EventArgs e) * { * DialogResult dialogResult = * MessageBox.Show("Voulez vous vraiment ravitailler?", "Confirmation", MessageBoxButtons.YesNo); * if (dialogResult == DialogResult.Yes) * { * timer1_Tick(sender,e); * } * }*/ private void timer1_Tick(object sender, EventArgs e) { int i = 0; foreach (Voiture voiture in voitures) { if (voiture.Nbtours != 0 && simulation != null) { if (_pist.PointRavitailler <= voiture.Position && voiture.Position <= _pist.PointRavitailler + 3 && voiture.Ravitailler == 2 && voiture.Nbtours == simulation.NbtoursRavit) //miandri iditra { Console.WriteLine("miditra ravit"); voiture.Position = 0; voiture.Vitesse = 1; voiture.Ravitailler = 1; //tafiditra } } if (voiture.Nbtours != 0) { if (_pist.PointRavitailler <= voiture.Position && voiture.Position <= _pist.PointRavitailler + 3 && voiture.Ravitailler == 2) //miandri iditra { Console.WriteLine("miditra ravit"); voiture.Position = 0; voiture.Vitesse = 1; voiture.Ravitailler = 1; //tafiditra } } if (voiture.Ravitailler == 0 || voiture.Ravitailler == 2) { ServiceClient client = null; if (_points.Count <= voiture.Position + voiture.Vitesse) { voiture.Nbtours += 1; Console.WriteLine(voiture.GetConsomation(unitepiste)); client = new ServiceClient("BasicHttpBinding_IService"); bool ismis = client.SortieService("PROD451", (decimal)voiture.GetConsomation(unitepiste), "1", "build"); if (ismis == false) { voiture.Vitesse = 0; } client.Close(); } TestTours(voiture); TestSecteur(voiture); TestPosition(voiture); TestCarburant(voiture); SetValeurCarburant(voiture); voiture.Position = (voiture.Position + voiture.Vitesse) % _points.Count; Voiture(Color.Blue, numLabels[i], voiture.Position, voiture.Numero, voiture.Nbtours, voiture.Rang); } else if (voiture.Ravitailler == 1) //miditra { voiture.Position = (voiture.Position + voiture.Vitesse) % ravits.Count; VoitureRavit(Color.Blue, numLabels[i], voiture.Position, voiture.Numero, voiture.Nbtours); ServiceClient client = null; if (ravits.Count / 2 == voiture.Position) { Console.WriteLine(@"Ravitailler"); Thread.Sleep(2000); client = new ServiceClient("BasicHttpBinding_IService"); bool ismis = client.SortiePneus("PROD501", 4, "1", "build"); if (!ismis) { voiture.Vitesse = 0; } client.Close(); /* ismis = client.SortieService("PROD451", (decimal) voiture.GetConsomation(unitepiste), "1", "build"); * if (ismis == false) * { * voiture.Vitesse = 0; * }*/ } if (ravits.Count - 2 < voiture.Position) { voiture.Position = _points.Count - voiture.Vitesse; voiture.Vitesse = 4; voiture.Ravitailler = 0; TextBox tbx = Controls.Find(voiture.Id + "vitesse", true).FirstOrDefault() as TextBox; if (tbx != null) { tbx.Text = voiture.Vitesse.ToString(); } } } voiture.Distance += voiture.Vitesse; list.Add(voiture.ToString()); i++; } Fonction.GereRang(voitures); ms += 100; TimeSpan span = TimeSpan.FromMilliseconds(ms); time.Text = $@"{span.Minutes:D2}min {span.Seconds:D2}s {span.Milliseconds:D3}ms"; }
public Main() { InitializeComponent(); SetListPiste(Fonction.GetPistes()); }
private void FormStatsPendu_Load(object sender, EventArgs e) { LangueElement = Fonction.LangageAppli(); this.Text = LangueElement[161]; lblStats.Text = LangueElement[161]; lblInfoVDR.Text = LangueElement[162]; var pos = this.PointToScreen(pbClassement.Location); pos = this.PointToClient(pos); pbClassement.Parent = this; pbClassement.Location = pos; pbClassement.BackColor = Color.Transparent; List <string> ListeStats = new List <string>(); ListeStats = Fonction.LireStatsProjetJeu(@"..\..\FormsCompetence\Pendu\StatsPendu.txt"); // J | V | D | R int i = 0; int l = 0; foreach (var item in ListeStats) { l++; } List <string> ListeTrieUnique = new List <string>(); foreach (var item in ListeStats) { string[] result = Regex.Split(item, @"\|"); ListeTrieUnique.Add(result[3]); } ListeTrieUnique.Sort((a, b) => - 1 * a.CompareTo(b)); // descending sort List <string> ListeTrieFini = new List <string>(); foreach (var item in ListeTrieUnique) { foreach (var item2 in ListeStats) { string[] result = Regex.Split(item2, @"\|"); if (item == result[3]) { ListeTrieFini.Add(result[0] + "|" + result[1] + "|" + result[2] + "|" + result[3]); ListeStats.Remove(result[0] + "|" + result[1] + "|" + result[2] + "|" + result[3]); break; } } } foreach (var item in ListeTrieFini) { string[] result = Regex.Split(item, @"\|"); if (i <= 9) { Label lblJoueur = new Label(); Label lblStatsJoueur = new Label(); lblJoueur.Text = result[0]; lblStatsJoueur.Text = "V : " + result[1] + " | D : " + result[2] + " | R : " + result[3]; lblJoueur.Font = new Font("Palatino Linotype", lblJ1.Font.SizeInPoints, FontStyle.Bold); lblStatsJoueur.Font = new Font("Palatino Linotype", lblJ1bis.Font.SizeInPoints); lblJoueur.BackColor = Color.Transparent; lblJoueur.AutoSize = true; lblJoueur.Visible = true; if (i == 0) { lblJoueur.SetBounds(445, 87, 200, 10); lblStatsJoueur.SetBounds(415, 105, 200, 10); this.Controls.Add(lblJoueur); this.Controls.Add(lblStatsJoueur); } else if (i == 1) { lblJoueur.SetBounds(298, 130, 200, 10); lblStatsJoueur.SetBounds(268, 148, 200, 10); this.Controls.Add(lblJoueur); this.Controls.Add(lblStatsJoueur); } else if (i == 2) { lblJoueur.SetBounds(589, 138, 200, 10); lblStatsJoueur.SetBounds(559, 156, 200, 10); this.Controls.Add(lblJoueur); this.Controls.Add(lblStatsJoueur); } else if (i == 3) { if (l == 6 || l == 5 || l == 4) { lblJoueur.SetBounds(130, 0, 200, 10); lblStatsJoueur.SetBounds(130, 20, 200, 10); label1.SetBounds(110, 0, 200, 10); panel1.Controls.Add(label1); panel1.Controls.Add(lblJoueur); panel1.Controls.Add(lblStatsJoueur); } else { lblJoueur.SetBounds(0, 0, 200, 10); lblStatsJoueur.SetBounds(0, 20, 200, 10); panel1.Controls.Add(lblJoueur); panel1.Controls.Add(lblStatsJoueur); } } else if (i == 4) { if (l == 6 || l == 5 || l == 4) { lblJoueur.SetBounds(130, 60, 200, 10); lblStatsJoueur.SetBounds(130, 80, 200, 10); label2.SetBounds(110, 60, 200, 10); panel1.Controls.Add(label2); panel1.Controls.Add(lblJoueur); panel1.Controls.Add(lblStatsJoueur); } else { lblJoueur.SetBounds(0, 60, 200, 10); lblStatsJoueur.SetBounds(0, 80, 200, 10); panel1.Controls.Add(lblJoueur); panel1.Controls.Add(lblStatsJoueur); } } else if (i == 5) { if (l == 6 || l == 5 || l == 4) { lblJoueur.SetBounds(130, 120, 200, 10); lblStatsJoueur.SetBounds(130, 140, 200, 10); label3.SetBounds(110, 120, 200, 10); panel1.Controls.Add(label3); panel1.Controls.Add(lblJoueur); panel1.Controls.Add(lblStatsJoueur); } else { lblJoueur.SetBounds(0, 120, 200, 10); lblStatsJoueur.SetBounds(0, 140, 200, 10); panel1.Controls.Add(lblJoueur); panel1.Controls.Add(lblStatsJoueur); } } else if (i == 6) { lblJoueur.SetBounds(235, 0, 200, 10); lblStatsJoueur.SetBounds(235, 20, 200, 10); label6.SetBounds(215, 0, 200, 10); panel1.Controls.Add(label6); panel1.Controls.Add(lblJoueur); panel1.Controls.Add(lblStatsJoueur); } else if (i == 7) { lblJoueur.SetBounds(235, 60, 200, 10); lblStatsJoueur.SetBounds(235, 80, 200, 10); label5.SetBounds(215, 60, 200, 10); panel1.Controls.Add(label5); panel1.Controls.Add(lblJoueur); panel1.Controls.Add(lblStatsJoueur); } else if (i == 8) { lblJoueur.SetBounds(235, 120, 200, 10); lblStatsJoueur.SetBounds(235, 140, 200, 10); label4.SetBounds(215, 120, 200, 10); panel1.Controls.Add(label4); panel1.Controls.Add(lblJoueur); panel1.Controls.Add(lblStatsJoueur); } lblJoueur.BringToFront(); lblStatsJoueur.BackColor = Color.Transparent; lblStatsJoueur.AutoSize = true; lblStatsJoueur.Visible = true; lblStatsJoueur.BringToFront(); if (i == 0 || i == 1 || i == 2) { var pos4 = this.PointToScreen(lblJoueur.Location); pos4 = pbClassement.PointToClient(pos4); lblJoueur.Parent = pbClassement; lblJoueur.Location = pos4; lblJoueur.BackColor = Color.Transparent; var pos5 = this.PointToScreen(lblStatsJoueur.Location); pos5 = pbClassement.PointToClient(pos5); lblStatsJoueur.Parent = pbClassement; lblStatsJoueur.Location = pos5; lblStatsJoueur.BackColor = Color.Transparent; } } i++; } if (i == 8) { label1.Visible = true; label2.Visible = true; label3.Visible = true; label6.Visible = true; label5.Visible = true; label4.Visible = true; } if (i == 8) { label1.Visible = true; label2.Visible = true; label3.Visible = true; label6.Visible = true; label5.Visible = true; label4.Visible = false; } if (i == 7) { label1.Visible = true; label2.Visible = true; label3.Visible = true; label6.Visible = true; label5.Visible = false; label4.Visible = false; } if (i == 6) { label1.Visible = true; label2.Visible = true; label3.Visible = true; label6.Visible = false; label5.Visible = false; label4.Visible = false; } if (i == 5) { label1.Visible = true; label2.Visible = true; label3.Visible = false; label6.Visible = false; label5.Visible = false; label4.Visible = false; } if (i == 4) { label1.Visible = true; label2.Visible = false; label3.Visible = false; label6.Visible = false; label5.Visible = false; label4.Visible = false; } if (i == 3 || i == 2 || i == 1 || i == 0) { label1.Visible = false; label2.Visible = false; label3.Visible = false; label6.Visible = false; label5.Visible = false; label4.Visible = false; } Fonction.policeTexte(this); // Gestion police }
private void bouton_Click(object sender, EventArgs e, Button nomBouton) { //String motCherche = ""; int[] lesIndices; // déclare un tabelau d'entiers qui récupèrera les indices trouvés d' une lettre dans un mot int ret = -1; //aucune lettre trouvée dans le mot char l = char.Parse(nomBouton.Text); if (motAlea.ContientLettre(l)) //si la lettre du bouton cliqué est contenue dans le mot { lblInfoUtilisateur.Visible = true; lblInfoUtilisateur.ForeColor = Color.ForestGreen; lblInfoUtilisateur.Text = LangueElement[152]; lesIndices = motAlea.IndicesLettre(l); //retourne LES indices de la lettre dans le mot for (int i = 0; i < lesIndices.Length; i++) { ret = lesIndices[i]; if (ret == -1) { break; // je sors du for car plus de lettres à traiter } else { if (ret == 0) //le premier élément est à la position 0 { lblettre1.Text = motAlea.affiche(ret).ToString(); } else { if (ret == 1) { lblettre2.Text = motAlea.affiche(ret).ToString(); } else { if (ret == 2) { lblettre3.Text = motAlea.affiche(ret).ToString(); } else { if (ret == 3) { lblettre4.Text = motAlea.affiche(ret).ToString(); } else { lblettre5.Text = motAlea.affiche(ret).ToString(); } } } } } } } else // la lettre n'est pas présente dans le mot { do { pendu1.Visible = true; compteur = compteur - 1; lblPendu.Text = Convert.ToString(compteur); lblInfoUtilisateur.Visible = true; lblInfoUtilisateur.ForeColor = Color.Purple; lblInfoUtilisateur.Text = LangueElement[153]; if (compteur == 9) { pendu1.Visible = true; } else { if (compteur == 8) { pendu1.Visible = false; pendu2.Visible = true; } else { if (compteur == 7) { pendu1.Visible = false; pendu2.Visible = false; pendu3.Visible = true; } else { if (compteur == 6) { pendu1.Visible = false; pendu2.Visible = false; pendu3.Visible = false; pendu4.Visible = true; } else { if (compteur == 5) { pendu1.Visible = false; pendu2.Visible = false; pendu3.Visible = false; pendu4.Visible = false; pendu5.Visible = true; } else { if (compteur == 4) { pendu1.Visible = false; pendu2.Visible = false; pendu3.Visible = false; pendu4.Visible = false; pendu5.Visible = false; pendu6.Visible = true; } else { if (compteur == 3) { pendu1.Visible = false; pendu2.Visible = false; pendu3.Visible = false; pendu4.Visible = false; pendu5.Visible = false; pendu6.Visible = false; pendu7.Visible = true; } else { if (compteur == 2) { pendu1.Visible = false; pendu2.Visible = false; pendu3.Visible = false; pendu4.Visible = false; pendu5.Visible = false; pendu6.Visible = false; pendu7.Visible = false; pendu8.Visible = true; } else { if (compteur == 1) { pendu1.Visible = false; pendu2.Visible = false; pendu3.Visible = false; pendu4.Visible = false; pendu5.Visible = false; pendu6.Visible = false; pendu7.Visible = false; pendu8.Visible = false; pendu9.Visible = true; } else { if (compteur == 0) { pendu1.Visible = false; pendu2.Visible = false; pendu3.Visible = false; pendu4.Visible = false; pendu5.Visible = false; pendu6.Visible = false; pendu7.Visible = false; pendu8.Visible = false; pendu9.Visible = false; pendu10.Visible = true; } } } } } } } } } } } while (compteur < 0); } if (compteur == 0) { lblInfoUtilisateur.ForeColor = Color.Red; lblInfoUtilisateur.Text = LangueElement[154]; lblPendu.Visible = false; lblinfo.ForeColor = Color.Red; lblinfo.Visible = true; lblinfo.Text = LangueElement[155]; gbAlphabet.Enabled = false; btnRejouer.Visible = true; texteresultat.Visible = true; reponse.Visible = true; reponse.Text = Convert.ToString(motAlea.affiche()); pendu10.Visible = true; pendu9.Visible = false; pendu8.Visible = false; pendu7.Visible = false; pendu6.Visible = false; pendu5.Visible = false; pendu4.Visible = false; pendu3.Visible = false; pendu2.Visible = false; pendu1.Visible = false; aide.Enabled = false; perdu = perdu + 1; // nouvJoueur.Perdu(); // nouvJoueur.ModifPrcwin(); Fonction.ecrireFichierProjetJeu(@"Pendu\StatsPendu.txt", lblprenom.Text, "Defaite"); } if (lblettre1.Text != "_") { if (lblettre2.Text != "_") { if (lblettre3.Text != "_") { if (lblettre4.Text != "_") { if (lblettre5.Text != "_") { lblInfoUtilisateur.ForeColor = Color.Purple; lblInfoUtilisateur.Text = LangueElement[156]; lblPendu.Visible = false; lblinfo.ForeColor = Color.Green; lblinfo.Visible = true; lblinfo.Text = LangueElement[157]; imagegagne.Visible = true; gbAlphabet.Enabled = false; btnRejouer.Visible = true; pendu10.Visible = false; pendu9.Visible = false; pendu8.Visible = false; pendu7.Visible = false; pendu6.Visible = false; pendu5.Visible = false; pendu4.Visible = false; pendu3.Visible = false; pendu2.Visible = false; pendu1.Visible = false; aide.Enabled = false; // nouvJoueur.Gagner(); // nouvJoueur.ModifPrcwin(); gagne = gagne + 1; Fonction.ecrireFichierProjetJeu(@"Pendu\StatsPendu.txt", lblprenom.Text, "Victoire"); } } } } } }
private void aide_Click(object sender, EventArgs e) { int position_aleatoire = 0; Random rnd = new Random(); do { position_aleatoire = rnd.Next(0, 5); }while (motAlea.affiche(position_aleatoire).ToString() == lblettre1.Text || motAlea.affiche(position_aleatoire).ToString() == lblettre2.Text || motAlea.affiche(position_aleatoire).ToString() == lblettre3.Text || motAlea.affiche(position_aleatoire).ToString() == lblettre4.Text || motAlea.affiche(position_aleatoire).ToString() == lblettre5.Text); // string nomLabel = "lblettre" + (position_aleatoire + 1).ToString(); int[] lesIndices; // déclare un tabelau d'entiers qui récupèrera les indices trouvés d' une lettre dans un mot int ret = -1; //aucune lettre trouvée dans le mot char l = char.Parse(motAlea.affiche(position_aleatoire).ToString()); // if (position_aleatoire != 4) // { if (motAlea.ContientLettre(l)) //si la lettre du bouton cliqué est contenue dans le mot { lesIndices = motAlea.IndicesLettre(l); //retourne LES indices de la lettre dans le mot for (int i = 0; i < lesIndices.Length; i++) { ret = lesIndices[i]; if (ret == -1) { break; // je sors du for car plus de lettres à traiter } else { if (ret == 0) //le premier élément est à la position 0 { lblettre1.Text = motAlea.affiche(ret).ToString(); } else { if (ret == 1) { lblettre2.Text = motAlea.affiche(ret).ToString(); } else { if (ret == 2) { lblettre3.Text = motAlea.affiche(ret).ToString(); } else { if (ret == 3) { lblettre4.Text = motAlea.affiche(ret).ToString(); } else { lblettre5.Text = motAlea.affiche(ret).ToString(); } } } } } } } foreach (Control x in this.Controls) { if (x is GroupBox) { foreach (Control c in x.Controls) { if (c.Text == l.ToString()) { c.Visible = false; } } } } indice = indice + 1; aide.Enabled = false; // } if (lblettre1.Text != "_") { if (lblettre2.Text != "_") { if (lblettre3.Text != "_") { if (lblettre4.Text != "_") { if (lblettre5.Text != "_") { lblInfoUtilisateur.ForeColor = Color.Purple; lblInfoUtilisateur.Text = LangueElement[156]; lblPendu.Visible = false; lblinfo.ForeColor = Color.Green; lblinfo.Visible = true; lblinfo.Text = LangueElement[157]; imagegagne.Visible = true; gbAlphabet.Enabled = false; btnRejouer.Visible = true; pendu10.Visible = false; pendu9.Visible = false; pendu8.Visible = false; pendu7.Visible = false; pendu6.Visible = false; pendu5.Visible = false; pendu4.Visible = false; pendu3.Visible = false; pendu2.Visible = false; pendu1.Visible = false; aide.Enabled = false; // nouvJoueur.Gagner(); // nouvJoueur.ModifPrcwin(); gagne = gagne + 1; Fonction.ecrireFichierProjetJeu(@"Pendu\StatsPendu.txt", lblprenom.Text, "Victoire"); } } } } } }
void Awake() { Instance = this; }
private static double trapezes(Fonction f, double n, double a, double b, double h) { double s = 0; for(int i = 1; i < n; ++i) { s += f(a + (i * h)); } return System.Math.Abs((((b - a) / (2.0 * n)) * (f(a) + f(b) + (2.0 * s))) - 1); }
private static double rectangles(Fonction f, double n, double a, double h) { double s = 0.0; for(int i = 0; i < n; ++i) { s += f(a + h * i); } return System.Math.Abs((h * s) - 1); }
private static double simpson(Fonction f, double n, double a, double b, double h) { double s1 = 0; double s2 = 0; for(int i = 1; i < n; ++i) { s1 += f(a + (i * h)); } for(int i = 0; i < n; ++i) { s2 += f(a + (i * h) + (h / 2.0)); } return System.Math.Abs((((b - a) / (6.0 * n)) * (f(a) + f(b) + (2.0 * s1 + 4.0 * s2))) - 1); }