Exemplo n.º 1
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.DisplayPerson);
     // Create your application here
     imageView    = FindViewById <ImageView>(Resource.Id.imgid);
     nameText     = FindViewById <TextView>(Resource.Id.name);
     garageText   = FindViewById <TextView>(Resource.Id.garagename);
     textEvent    = FindViewById <TextView>(Resource.Id.linkReview);
     mRatingscale = FindViewById <TextView>(Resource.Id.textView6);
     commentText  = FindViewById <EditText>(Resource.Id.editText2);
     button2      = FindViewById <Button>(Resource.Id.button2);
     ratingBar    = FindViewById <RatingBar>(Resource.Id.ratingBar);
     api          = new ImotorCareWebApi.ImotorCareWebApi();
     Id           = Intent.GetStringExtra("uid");
     Load(api.GetPersonelByID(Id));
     button2.Click   += RatePersonel;
     textEvent.Click += LoadReviews;
     ratingBar.Click += SetRatingText;
 }
Exemplo n.º 2
0
        private void RatePersonel(object sender, EventArgs e)
        {
            var numOfStars = ratingBar.Rating;
            var response   = api.RatePersonel(Id, commentText.Text, numOfStars.ToString());

            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert  = dialog.Create();
            var title = response.ToLower().Contains("success") ? "Success" : "Error";

            alert.SetTitle(title);
            alert.SetMessage(response);
            //alert.SetIcon(Resource.Drawable.alert);
            alert.SetButton("OK", (c, ev) =>
            {
                alert.Cancel();
                Load(api.GetPersonelByID(Id));
            });
            alert.SetButton2("CANCEL", (c, ev) => { });
            alert.Show();
            ratingBar.Rating = 0;
            commentText.Text = string.Empty;
        }