Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            uid = Convert.ToInt32(CurrentUser.getUserId());
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Tasting);
            try
            {
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);

                ServiceWrapper     svc        = new ServiceWrapper();
                ItemReviewResponse uidreviews = new ItemReviewResponse();
                // ItemRatingResponse irr = svc.GetItemReviewUID(uid).Result;

                uidreviews = svc.GetItemReviewUID(uid).Result;

                //if (uidreviews.Reviews.Count == 0)
                //{
                //    SetContentView(Resource.Layout.Dummy);
                //}
                List <Review> myArr1;
                myArr1 = uidreviews.Reviews.ToList();


                var wineList = FindViewById <ListView>(Resource.Id.listView1);
                // myArr1 = SampleData1();
                Review          edit      = new Review();
                ReviewPopup     editPopup = new ReviewPopup(this, edit);
                MyReviewAdapter adapter   = new MyReviewAdapter(this, myArr1);
                //if (adapter.Count == 0)
                //{
                //    TextView infoText = FindViewById<TextView>(Resource.Id.txtInfo);
                //    infoText.Text = "You haven't reviewed anything";
                //}
                //adapter.Edit_Click += editPopup.EditPopup;

                wineList.Adapter = adapter;

                // wineList.ItemClick += listView_ItemClick;

                wineList.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                {
                    int WineID = myArr1[args.Position].WineId;
                    var intent = new Intent(this, typeof(detailViewActivity));
                    intent.PutExtra("WineID", WineID);
                    StartActivity(intent);
                };
                ProgressIndicator.Hide();
            }
            catch (Exception exe)
            {
                AlertDialog.Builder aler = new AlertDialog.Builder(this);
                aler.SetTitle("Sorry");
                aler.SetMessage("We're under maintainence");
                aler.SetNegativeButton("Ok", delegate { });
                Dialog dialog = aler.Create();
                dialog.Show();
            }
        }
Пример #2
0
        public void RefreshParent()
        {
            ServiceWrapper svc = new ServiceWrapper();

            var             uidreviews = svc.GetItemReviewUID(uid).Result;
            ListView        wineList   = FindViewById <ListView>(Resource.Id.listView1);
            Review          edit       = new Review();
            ReviewPopup     editPopup  = new ReviewPopup(this, edit);
            MyReviewAdapter adapter    = new MyReviewAdapter(this, uidreviews.Reviews.ToList());

            //adapter.Edit_Click += editPopup.EditPopup;

            wineList.Adapter = adapter;
            adapter.NotifyDataSetChanged();
        }
Пример #3
0
        public void RefreshParent()
        {
            ServiceWrapper  svc        = new ServiceWrapper();
            var             uidreviews = svc.GetItemReviewUID(uid).Result;
            ListView        wineList   = FindViewById <ListView>(Resource.Id.listView1);
            Review          edit       = new Review();
            ReviewPopup     editPopup  = new ReviewPopup(this, edit);
            MyReviewAdapter adapter    = new MyReviewAdapter(this, uidreviews.Reviews.ToList());
            //adapter.Edit_Click += editPopup.EditPopup;
            int c = uidreviews.Reviews.Count;

            if (c == 0)
            {
                SetContentView(Resource.Layout.ReviewEmpty);
                txtName = FindViewById <TextView>(Resource.Id.textView1);
                Imag    = FindViewById <ImageView>(Resource.Id.imageView1);
            }
            wineList.Adapter = adapter;
            adapter.NotifyDataSetChanged();
        }
Пример #4
0
        protected override void OnCreate(Bundle bundle)
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            base.OnCreate(bundle);
            uid = Convert.ToInt32(CurrentUser.getUserId());
            try
            {
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ServiceWrapper     svc        = new ServiceWrapper();
                ItemReviewResponse uidreviews = new ItemReviewResponse();
                uidreviews = svc.GetItemReviewUID(uid).Result;
                List <Review> myArr1;
                myArr1 = uidreviews.Reviews.ToList();
                int c = uidreviews.Reviews.Count;
                if (c == 0)
                {
                    var data = svc.GetMyTastingsList(uid).Result;


                    SetContentView(Resource.Layout.ReviewEmpty);
                    txtName = FindViewById <TextView>(Resource.Id.textView1);
                    if (data.TastingList.Count != 0)
                    {
                        txtName.Text = "You have tasted " + data.TastingList.Count + " wines.\n We would love to hear your feedback.";
                    }
                    else
                    {
                        txtName.Text = "Please taste and then review.";
                    }
                    Imag = FindViewById <ImageView>(Resource.Id.imageView1);
                    var TaskA = new System.Threading.Tasks.Task(() =>
                    {
                        Imag.SetImageResource(Resource.Drawable.ReviewIns);
                    });
                    TaskA.Start();
                }
                else
                {
                    SetContentView(Resource.Layout.MyReviews);
                    var             wineList  = FindViewById <ListView>(Resource.Id.listView1);
                    Review          edit      = new Review();
                    ReviewPopup     editPopup = new ReviewPopup(this, edit);
                    MyReviewAdapter adapter   = new MyReviewAdapter(this, myArr1);
                    wineList.Adapter = adapter;

                    wineList.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                    {
                        string WineBarcode = myArr1[args.Position].Barcode;
                        int    storeID     = Convert.ToInt32(myArr1[args.Position].PlantFinal);
                        LoggingClass.LogInfoEx("Clicked on " + myArr1[args.Position].Barcode + " to enter into wine details From ReviewAct", screenid);
                        ProgressIndicator.Show(this);
                        //AndHUD.Shared.Show(this, "Loading...", Convert.ToInt32(MaskType.Clear));
                        var intent = new Intent(this, typeof(DetailViewActivity));
                        intent.PutExtra("WineBarcode", WineBarcode);
                        intent.PutExtra("storeid", storeID);
                        StartActivity(intent);
                    };

                    LoggingClass.LogInfo("Entered into My Review", screenid);
                }
                ProgressIndicator.Hide();
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                AndHUD.Shared.Dismiss();
                ProgressIndicator.Hide();
                AlertDialog.Builder aler = new AlertDialog.Builder(this);
                aler.SetTitle("Sorry");
                aler.SetMessage("We're under maintainence");
                aler.SetNegativeButton("Ok", delegate { });
                Dialog dialog = aler.Create();
                dialog.Show();
            }
            st.Stop();
            LoggingClass.LogTime("Reviewactivity", st.Elapsed.TotalSeconds.ToString());
        }