コード例 #1
0
        public override void ViewDidLoad()
        {
            LoggingClass.LogInfo("Entered into favorite", screen);
            try
            {
                this.CollectionView.Add(refreshControl);
                refreshControl.ValueChanged += (rcSender, e) =>
                {
                    //Refresh this view
                    myData = svc.GetItemFavsUID(CurrentUser.RetreiveUserId()).Result;
                    if (myData.ItemList.Count == 0)
                    {
                        UIImageView ImgIns = new UIImageView();
                        ImgIns.Image = UIImage.FromFile("FavIns.png");
                        UILabel NoFav = new UILabel();
                        NoFav.Text          = myData.ErrorDescription;
                        NoFav.LineBreakMode = UILineBreakMode.WordWrap;
                        NoFav.Lines         = 0;
                        CGSize sTemp = new CGSize(View.Frame.Width, 100);
                        sTemp               = NoFav.SizeThatFits(sTemp);
                        NoFav.Frame         = new CGRect(0, 50, View.Frame.Width - 20, sTemp.Height);
                        NoFav.TextAlignment = UITextAlignment.Center;
                        ImgIns.Frame        = new CGRect((View.Frame.Width / 2) - 100, 50 + sTemp.Height + 20, 202, 381);
                        CollectionView.AddSubview(NoFav);
                        CollectionView.AddSubview(ImgIns);
                    }
                    CollectionView.ReloadData();
                    refreshControl.EndRefreshing();
                };

                myData = svc.GetItemFavsUID(CurrentUser.RetreiveUserId()).Result;
                if (myData.ItemList.Count == 0)
                {
                    UIImageView ImgIns = new UIImageView();
                    ImgIns.Image = UIImage.FromFile("FavIns.png");
                    UILabel NoFav = new UILabel();
                    NoFav.Text          = myData.ErrorDescription;
                    NoFav.LineBreakMode = UILineBreakMode.WordWrap;
                    NoFav.Lines         = 0;
                    CGSize sTemp = new CGSize(View.Frame.Width, 100);
                    sTemp               = NoFav.SizeThatFits(sTemp);
                    NoFav.Frame         = new CGRect(0, 50, View.Frame.Width - 20, sTemp.Height);
                    NoFav.TextAlignment = UITextAlignment.Center;
                    ImgIns.Frame        = new CGRect((View.Frame.Width / 2) - 100, 50 + sTemp.Height + 20, 202, 381);
                    CollectionView.AddSubview(NoFav);
                    CollectionView.AddSubview(ImgIns);
                }
                BTProgressHUD.Dismiss();
                this.View.BackgroundColor           = new UIColor(256, 256, 256, 0.8f);
                this.CollectionView.BackgroundColor = UIColor.White;
                CollectionView.RegisterClassForCell(typeof(MyFavViewCell), MyFavViewCell.Key);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace);
            }
        }
コード例 #2
0
        public override void ViewDidLoad()
        {
            //AboutController1.ViewDidLoad(base);

            ServiceWrapper svc = new ServiceWrapper();

            if (FaviouriteView)
            {
                myData = svc.GetItemFavsUID(CurrentUser.RetreiveUserId()).Result;
            }
            else
            {
                myData = svc.GetItemLists(storeId, CurrentUser.RetreiveUserId()).Result;
            }

            //View.BackgroundColor = UIColor.White;
            this.View.BackgroundColor = new UIColor(256, 256, 256, 0.8f);
            //this.View
            //this.CollectionView.BackgroundColor = UIColor.White;
            //this.CollectionView.InsertSubview(new UIImageView(UIImage.FromFile("placeholder.jpeg")), 0);
            //CollectionView.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("eno.jpg"));
            CollectionView.RegisterClassForCell(typeof(BottleCell), "BottleCell");
        }