public override async void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) { if (editingStyle != UITableViewCellEditingStyle.Delete) { return; } using (var client = new TarefaService()) { try { await client.DeleteAsync(_tarefas[indexPath.Row]); } catch (Exception) { const string retorno = "Ocorreu um erro ao realizar operação! Por favor, tente novamente mais tarde!"; new UIAlertView("Deletar Tarefa", retorno, null, "OK", null).Show(); return; } } using (var client = new TarefaService()) { _tarefas = await client.ListarAsync(); } if (_tarefas != null && _tarefas?.Count > 0) { TableView.ReloadData(); } }
public override async void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. using (var client = new TarefaService()) { _tarefas = await client.ListarAsync(); } if (_tarefas != null && _tarefas?.Count > 0) { TableView.ReloadData(); } }
public override async void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); var isUpdatedApi = NSUserDefaults.StandardUserDefaults.BoolForKey("UpdatedApi"); if (!_isStarted || !isUpdatedApi) { return; } using (var client = new TarefaService()) { _tarefas = await client.ListarAsync(); } TableView.ReloadData(); NSUserDefaults.StandardUserDefaults.SetBool(false, "UpdatedApi"); }