Esempio n. 1
0
        private void buttonOKNome_Click(object sender, EventArgs e)
        {
            //Editar nome galeria
            if (listBoxGalerias.SelectedIndex == -1)
            {
                _FormInicio.EscreverNaConsola("Galeria em falta!");
                return;
            }

            if (String.IsNullOrEmpty(textBoxNNomeGal.Text) || textBoxNNomeGal.Text == " ")
            {
                _FormInicio.EscreverNaConsola("Erro nome incorreto!");
                return;
            }

            //Se o nome for igual
            if (textBoxNNomeGal.Text.Equals(listaGalerias[listBoxGalerias.SelectedIndex].Designacao))
            {
                _FormInicio.EscreverNaConsola("Nome já existe!");
                return;
            }


            try
            {
                //Editar Galeria
                Funcionalidades.EditarGaleria(textBoxNNomeGal.Text, _este.Nome, listaGalerias[listBoxGalerias.SelectedIndex]);

                listBoxGalerias.SelectedIndex = -1;
                textBoxNNomeGal.Clear();

                CarregarGalerias();
            }
            catch
            {
                _FormInicio.EscreverNaConsola("Erro ao editar galeria");
            }

            buttonSair.Hide();
            atualizar = true;
        }