partial void ReloadButton_TouchUpInside(UIButton sender) { //open a progress alert KeyVault.Tokens.Reset(); ProgressAlert = UIAlertController.Create("Reload Application Data", "Reloading please wait...", UIAlertControllerStyle.Alert); PresentViewController(ProgressAlert, true, null); Task reloadTask = Task.Run(async() => { await ApplicationData.Current.LoadApplicationData(); BeginInvokeOnMainThread(() => { ProgressAlert.DismissViewController(true, null); if (ApplicationData.Current.Errors.Count == 0) { var alert = UIAlertController.Create("Success", $"Application Data Reloaded Successfully", UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null)); PresentViewController(alert, true, null); } else { var alert = UIAlertController.Create("Error", $"Could not reload data. {ApplicationData.Current.Errors.Count} errors encountered.", UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null)); PresentViewController(alert, true, null); } }); }); }
private void ShowSuccess(DataServiceResponse <ConfirmationResponse> Response) { InvokeOnMainThread(() => { ProgressAlert.DismissViewController(true, null); var alert = UIAlertController.Create("Appointment Confirmed", $"Your appointment is confirmed. Your confirmation number is: {Response?.Data?.ConfirmationNumber}", UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, OnConfirmComplete)); PresentViewController(alert, true, null); }); }
private void ShowError(DataServiceResponse <ConfirmationResponse> Response) { InvokeOnMainThread(() => { ProgressAlert.DismissViewController(true, null); var alert = UIAlertController.Create("Schedule Error", $"Unable to confirm appointment: {Response.ErrorMessage}", UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null)); PresentViewController(alert, true, null); CancelButton.Enabled = true; ConfirmButton.Enabled = true; }); }