Пример #1
0
        public void RefreshParent()
        {
            ServiceWrapper svc    = new ServiceWrapper();
            int            wineid = Intent.GetIntExtra("WineID", 138);


            ItemDetailsResponse myData = svc.GetItemDetails(wineid).Result;
            var SkuRating = svc.GetItemReviewsByWineID(wineid).Result;

            this.Title = "Wine Details";



            var commentsView = FindViewById <ListView>(Resource.Id.listView2);

            reviewAdapter comments = new reviewAdapter(this, SkuRating.Reviews.ToList());

            commentsView.Adapter = comments;
            comments.NotifyDataSetChanged();
        }
Пример #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.detailedView);
            wineid = Intent.GetIntExtra("WineID", 123);
            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ServiceWrapper      svc       = new ServiceWrapper();
            ItemDetailsResponse myData    = new ItemDetailsResponse();
            ItemReviewResponse  SkuRating = new ItemReviewResponse();

            this.Title = "Wine Details";
            var      commentsView = FindViewById <ListView>(Resource.Id.listView2);
            TextView WineName     = FindViewById <TextView>(Resource.Id.txtWineName); //Assigning values to respected Textfields

            WineName.Focusable = false;
            TextView WineProducer = FindViewById <TextView>(Resource.Id.txtProducer);

            WineProducer.Focusable = false;
            TextView Vintage = FindViewById <TextView>(Resource.Id.txtVintage);

            Vintage.Focusable = false;
            TextView WineDescription = FindViewById <TextView>(Resource.Id.txtWineDescription);

            WineDescription.Focusable = false;
            RatingBar AvgRating = FindViewById <RatingBar>(Resource.Id.avgrating);

            AvgRating.Focusable = false;
            TableRow tr5 = FindViewById <TableRow>(Resource.Id.tableRow5);

            try
            {
                downloadAsync(this, System.EventArgs.Empty, wineid);
                myData    = svc.GetItemDetails(wineid).Result;
                SkuRating = svc.GetItemReviewsByWineID(wineid).Result;
                reviewAdapter comments = new reviewAdapter(this, SkuRating.Reviews.ToList());
                commentsView.Adapter = comments;
                setListViewHeightBasedOnChildren1(commentsView);
                WineName.Text        = myData.ItemDetails.Name;
                WineName.InputType   = Android.Text.InputTypes.TextFlagNoSuggestions;
                Vintage.Text         = myData.ItemDetails.Vintage.ToString();
                WineProducer.Text    = myData.ItemDetails.Producer;
                WineDescription.Text = myData.ItemDetails.Description;
                AvgRating.Rating     = (float)myData.ItemDetails.AverageRating;
                Review edit = new Review();
                edit.WineId = wineid;
                ReviewPopup editPopup   = new ReviewPopup(this, edit);
                RatingBar   RatingInput = FindViewById <RatingBar>(Resource.Id.ratingInput);//Taking rating stars input
                RatingInput.RatingBarChange += editPopup.CreatePopup;

                var metrics    = Resources.DisplayMetrics;
                var widthInDp  = ConvertPixelsToDp(metrics.WidthPixels);
                var heightInDp = ConvertPixelsToDp(metrics.HeightPixels);

                //imgWine = FindViewById<ImageView>(Resource.Id.imgWine12);
                HighImageWine = FindViewById <ImageView>(Resource.Id.WineImage);

                //ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
                //string path = pppd.CreateDirectoryForPictures();
                //var filePath = System.IO.Path.Combine(path + "/" + wineid + ".jpg");
                //if (System.IO.File.Exists(filePath))
                //{
                //    Bitmap imageBitmap = BitmapFactory.DecodeFile(filePath);
                //    imgWine.SetImageBitmap(imageBitmap);
                //}
                //else
                //{
                //    Bitmap imageBitmap = BlobWrapper.Bottleimages(wineid);
                //    imgWine.SetImageBitmap(imageBitmap);
                //}
                //imgWine.LayoutParameters = new RelativeLayout.LayoutParams(1100, 1100);
                BitmapFactory.Options options = new BitmapFactory.Options
                {
                    InJustDecodeBounds = false,
                    OutHeight          = 75,
                    OutWidth           = 75
                };
                ProgressIndicator.Hide();
                Bitmap result = BitmapFactory.DecodeResource(Resources, Resource.Drawable.placeholder_re, options);
            }
            catch (Exception ex)
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Sorry");
                alert.SetMessage("We're under maintainence");
                alert.SetNegativeButton("Ok", delegate { });
                Dialog dialog = alert.Create();
                dialog.Show();
            }
            //downloadButton = FindViewById<Button>(Resource.Id.Download);
            //try
            //{
            //    //downloadButton.Enabled = true;
            //    downloadButton.Click += downloadAsync;
            //    //downloadButton.Enabled = false;

            //}

            //catch (Exception e) { }
        }