private void OnSendReviewClick(object sender, EventArgs arg) { var spinner = UIUtils.ShowSpinner(this); int rating = Convert.ToInt32(reviewRating.Rating); DataGate.SendReview(mua.Id, GlobalStorage.Settings.CustomerId, rating, reviewEntry.Text, (res) => { if (res.Code == ResponseCode.OK && res.Result.ToString() == "true") { DataGate.GetMua(mua.Id, (data) => { if (data.Code == ResponseCode.OK) { mua = new MuaArtist(JObject.Parse(data.Result), true); } DataGate.CanWriteReview(mua.Id, GlobalStorage.Settings.CustomerId, data2 => { CanSendReview = (data2.Code == ResponseCode.OK && data2.Result == "true"); UIUtils.HideSpinner(this, spinner); Device.BeginInvokeOnMainThread(() => { BuildReview(); }); }); }); } else { UIUtils.ShowMessage("Review send fail. Try later", this); UIUtils.HideSpinner(this, spinner); } }); }
private void OnItemSelected(object sender, ItemTappedEventArgs e) { SpinnerShowChange(true); var selItem = e.Item as MuaDataItem; DataGate.GetMua(selItem.Id, (data) => { if (data.Code == ResponseCode.OK) { var jobj = JObject.Parse(data.Result); bool canWriteReview = !string.IsNullOrEmpty(GlobalStorage.Settings.CustomerId); if (!canWriteReview) { ShowMuaPage(jobj, canWriteReview); } else { DataGate.CanWriteReview(selItem.Id, GlobalStorage.Settings.CustomerId, data2 => { canWriteReview = (data2.Code == ResponseCode.OK && data2.Result == "true"); ShowMuaPage(jobj, canWriteReview); }); } } else { SpinnerShowChange(false); Device.BeginInvokeOnMainThread(() => { this.DisplayAlert("Tiro", "Nothing was found", "OK"); }); } }); }