コード例 #1
0
ファイル: PostSearchHandler.cs プロジェクト: Kenffy/Bloggies
        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;
            }
        }
コード例 #2
0
        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;
            }
        }