async void CommentUpdate_Clicked(object sender, System.EventArgs e) { try { commentsEntry.Text = CommentEntry.Text; if (AssetEntry.Text == null && commentsEntry.Text == null) { await DisplayAlert("Error", "Please fill in missing fields.", "Ok"); } else if (AssetEntry.Text == null) { await DisplayAlert("Error", "Please fill in asset ID/barcode.", "Ok"); } else if (commentsEntry.Text == null) { await DisplayAlert("Error", "Please fill in comments.", "Ok"); //LocationEntry.IsVisible = false; //statusFrameEntry.IsVisible = true; } else { DateTime now = DateTime.Now.ToLocalTime(); Dictionary <string, string> dict = new Dictionary <string, string>(); dict["asset"] = AssetEntry.Text; dict["newComment"] = commentsEntry.Text; dict["time"] = now.ToString(); var isSuccess = await cloudStore.EditComment(dict); if (isSuccess) { commentstack.IsVisible = false; await DisplayAlert("Success", "Comments are updated.", "Ok"); App.Current.MainPage = new MainViewAssetPage(); //AssetEntry.Text = string.Empty; //LocationEntry.Text = string.Empty; } else { await DisplayAlert("Error", "Update failed. Please try again.", "Ok"); } } } catch (Exception ex) { } }