Esempio n. 1
0
        private void AddDomainButton_Click(object sender, EventArgs e)
        {
            AddDomainForm form = new AddDomainForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                Boolean ok = true;

                foreach (Domain d in DomainList)
                {
                    if (d.Name.Equals(form.domainName))
                    {
                        ok = false;
                    }
                }

                if (DomainList.Count == 0 || ok)
                {
                    DomainList.Add(new Domain(form.domainName));
                    //DomainListbox_SelectedIndexChanged(this, null);
                    statusLabel.Text = "Le domaine \"" + form.domainName + "\" a été ajouté";
                    EnableDomainButtons();
                    AddAccountButton.Enabled    = true;
                    UnsavedModifications        = true;
                    DomainListbox.SelectedIndex = DomainList.Count - 1; //Set focus on last domain
                }
                else
                {
                    MessageBox.Show("Le domaine \"" + form.domainName + "\" existe déjà !", "Erreur", MessageBoxButtons.OK);
                    statusLabel.Text = "Le domaine \"" + form.domainName + "\" existe déjà !";
                }
            }
        }
Esempio n. 2
0
 private void ModDomainButton_Click(object sender, EventArgs e)
 {
     if (DomainListbox.SelectedIndex > -1)
     {
         AddDomainForm form = new AddDomainForm("Modifier un domaine", "Nouveau nom de domaine : ");
         if (form.ShowDialog() == DialogResult.OK)
         {
             statusLabel.Text = "Le domaine \"" + ((Domain)DomainListbox.SelectedValue).Name + "\" a été modifié en \"" + form.domainName + "\"";
             DomainList[DomainListbox.SelectedIndex].Name = form.domainName;
             UnsavedModifications = true;
         }
     }
 }