private async Task LoadDataAsync() { CheckInternetConnection(); try { PostItemsSource = await BloggyServices.GetPostsAsync(); } catch (Exception ex) { Console.WriteLine(ex.Message); await Application.Current.MainPage.DisplayAlert("Error", "An error occured, Something went wrong", "Cancel"); return; } }
private async void UpdateProfile(object obj) { if (string.IsNullOrEmpty(CurrentUser.Name)) { string msg = "Blog name is required."; await Application.Current.MainPage.DisplayAlert("Error updating a profile", msg, "OK"); return; } if (BloggyConstant.CheckConnectivity() == false) { var msg = "No internet connection. Please check and try again"; await Application.Current.MainPage.DisplayAlert("Connection Error", msg, "Cancel"); return; } try { if (CurrentUser != null && !string.IsNullOrEmpty(CurrentUser.Id)) { await BloggyServices.UpdateMemberAsync(CurrentUser, ImageArray); // Messaging center update previous page OnRefreshSettingsPage(); await Application.Current.MainPage.Navigation.PopAsync(); } } catch (Exception ex) { var msg = "An error occured, Something went wrong"; Console.WriteLine(ex.Message); await Application.Current.MainPage.DisplayAlert("Error", msg, "Cancel"); return; } }