protected override void OnAppearing() { base.OnAppearing(); MessagingCenter.Subscribe <Agendamento>(this, "AgendamentoSelecionado", async(agendamento) => { if (agendamento.Confirmado) { return; } var reenviar = await DisplayAlert("Reenviar", "Deseja reenviar o agendamento?", "sim", "não"); if (reenviar) { AgendamentoService agendamentoService = new AgendamentoService(); await agendamentoService.EnviarAgendamento(agendamento); this._viewModel.AtualizarLista(); } }); MessagingCenter.Subscribe <Agendamento>(this, "SucessoAgendamento", async(agendamento) => { await DisplayAlert("Reenviar", "Reenvio com sucesso!", "ok"); }); MessagingCenter.Subscribe <Agendamento>(this, "FalhaAgendamento", async(agendamento) => { await DisplayAlert("Reenviar", "Falha ao reenviar!", "ok"); }); }
private void AssinaturaMensagens() { MessagingCenter.Subscribe <Agendamento>(this, "AgendamentoSelecionado", async(agendamento) => { if (!agendamento.Confirmado) { var reenviar = await DisplayAlert("Reenviar Agendamento", "Deseja reenviar o agendamento?", "SIM", "NÃO"); if (reenviar) { AgendamentoService agendamentoService = new AgendamentoService(); await agendamentoService.EnviarAgendamento(agendamento); this._viewModel.AtualizarLista(); } } }); MessagingCenter.Subscribe <Agendamento>(this, "SucessoAgendamento", async(agendamento) => { await DisplayAlert("Reenviar", "Reenvio realizado com sucesso.", "OK"); }); MessagingCenter.Subscribe <Agendamento>(this, "FalhaAgendamento", async(agendamento) => { await DisplayAlert("Reenviar", "Erro ao reenviar o agendamento. Tente novamente.", "OK"); }); }
protected override void OnAppearing() { base.OnAppearing(); MessagingCenter.Subscribe <Agendamento>(this, "AgendamentoSelecionado", async(agendamento) => { if (!agendamento.Confirmado) { var reenviar = await DisplayAlert("Reenviar Agendamento", "Deseja reenviar o agendamento?", "Sim", "Não"); if (reenviar) { AgendamentoService agendamentoService = new AgendamentoService(); await agendamentoService.EnviarAgendamento(agendamento); this._viewModel.AtualizarLista(); } } }); MessagingCenter.Subscribe <Agendamento>(this, "SucessoAgendamento", async(agendamento) => { await DisplayAlert("Reenviar", "Reenvio feito com sucesso!", "OK"); }); MessagingCenter.Subscribe <Agendamento>(this, "FalhaAgendamento", async(agendamento) => { await DisplayAlert("Reenviar", "Erro ao reenviar agendamento, por favor tente mais tarde!", "OK"); }); }
protected override void OnAppearing() { base.OnAppearing(); MessagingCenter.Subscribe <Agendamento>(this, "AgendamentoSelecionadoReenvio", async(agendamento) => { if (!agendamento.Confirmado) { var reenviar = await DisplayAlert("Reenviar", "Deseja Reenviar o agendamento?", "Sim", "Não"); if (reenviar) { AgendamentoService agendamentoService = new AgendamentoService(); await agendamentoService.EnviarAgendamento(agendamento); this.viewModel.AtualizarLista(); } } }); MessagingCenter.Subscribe <Agendamento>(this, "SucessoAgendamento", async(agendamento) => { await DisplayAlert("Reeenviar", "Reenvio bem sucedido", "Ok"); }); MessagingCenter.Subscribe <Agendamento>(this, "FalhaAgendamento", async(agendamento) => { await DisplayAlert("Reenviar", "Falha no Reenvio", "Ok"); }); }
private void AssinarMenssagens() { MessagingCenter.Subscribe <Agendamento>(this, "AgendamentoSelecionado", async(agendamento) => { if (!agendamento.Confirmado) { var reeviar = await DisplayAlert("Reenviar", "Deseja reeinviar o agendamento?", "Sim", "Não"); if (reeviar) { AgendamentoService agendamentoService = new AgendamentoService(); await agendamentoService.EnviarAgendamento(agendamento); this._viewModel.AtualizarLista(); } } }); MessagingCenter.Subscribe <Agendamento>(this, "SucessoAgendamento", async(agendamento) => { await DisplayAlert("Reeinviar", "Reenvio com sucesso!", "Ok"); }); MessagingCenter.Subscribe <Agendamento>(this, "FalhaoAgendamento", async(agendamento) => { await DisplayAlert("Falha", "Falha ao reenviar!", "Ok"); }); }
protected override void OnAppearing() { base.OnAppearing(); //<objeto que recebe a mensagem> //(instancia que está assinando) MessagingCenter.Subscribe <Agendamento>(this, "AgendamentoSelecionado", async(agendamento) => { //Verifica se o agendamento não foi confirmado e então reenvia if (!agendamento.Confirmado) { //Pedindo confirmação do usuario var reenviar = await DisplayAlert("Reenviar", "Deseja reenviar o agendamento?", "sim", "não"); if (reenviar) { AgendamentoService agendamentoService = new AgendamentoService(); await agendamentoService.EnviarAgendamento(agendamento); //assim que o agendamento for reenviado, a view será notificada e vai atualizar a lista da viewmodel this._viewModel.AtualizarLista(); } } }); //(Recebe uma instancia do agendamento) MessagingCenter.Subscribe <Agendamento>(this, "SucessoAgendamento", async(agendamento) => { await DisplayAlert("Reenviar", "Reenvio com sucesso", "ok"); }); MessagingCenter.Subscribe <Agendamento>(this, "FalhaAgendamento", async(agendamento) => { await DisplayAlert("Reenviar", "Falha ao reenviar!", "ok"); }); }
public async void SalvaAgendamento() { AgendamentoService agendamentoService = new AgendamentoService(); await agendamentoService.EnviarAgendamento(this.Agendamento); }