Exemplo n.º 1
0
        private async void Incluir()
        {
            var novoAluno   = new Aluno(Aluno.Nome, Aluno.Endereco, Aluno.Bairro, Aluno.Cidade);
            var alunoCriado = alunoService.Incluir(novoAluno);

            if (!alunoService.Validar)
            {
                var linq = alunoService.Notifications.Select(msg => msg.Mensagem);
                await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", linq));

                alunoService.ClearNotifications();
            }
            if (alunoCriado != null)
            {
                Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Incluindo dados do aluno. Aguarde...");

                Progresso.SetIndeterminate();
                var   t = Task.Factory.StartNew(() => { BuscarAlunos(); });
                await t;
                await Progresso?.CloseAsync();

                await this.dialog.ShowMessageAsync(this, "Atenção", "Aluno cadastrado com sucesso !!!");

                Limpar();
            }
        }