private void FormAjouterDeclaration_FormClosing(object sender, FormClosingEventArgs e) { bool r = false; foreach (Form f in Application.OpenForms) { if (f.Name == "FormFenetrePrincipale") { r = true; } } if (!r) { FormFenetrePrincipale f = new FormFenetrePrincipale(); f.Show(); } }
private void buttonConnexion_Click(object sender, EventArgs e) { try { DirectoryEntry Ldap = new DirectoryEntry("LDAP://sio.local/OU=OU-SLAM,OU=OU-Etudiants,DC=sio,DC=local", textBoxUser.Text, textBoxPassword.Text); DirectoryEntry de = Ldap.NativeObject as DirectoryEntry; Thread t = new Thread(() => Application.Run(new FormFenetrePrincipale())); Docker = textBoxUser.Text; Form menu = new FormFenetrePrincipale(); menu.Show(); this.Hide(); } catch (Exception Ex) { MessageBox.Show("erreur LDAP" + Ex.Message); } }