Beispiel #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (Reachability.IsHostReachable(Settings._baseDomain))
            {
                LoadingOverlay loadingOverlay = new LoadingOverlay(View.Frame);
                View.Add(loadingOverlay);
                Task.Run(() =>
                {
                    var image = HelperMethods.FromUrl(Settings.BanManProURL);
                    BeginInvokeOnMainThread(() =>
                    {
                        loadingOverlay.Hide();
                        BanManProImageView.Image = image;
                    });
                });
            }
            else
            {
                BanManProImageView.Image = UIImage.FromBundle("ad_placeholder.jpg");
            }

            tapGesture1 = new UITapGestureRecognizer(TapImageAction1);

            int currentIndex = this.DataObject.MagazinePageIndex;
            int totalPages   = this.DataObject.TotalPages;

            PageIndicator.SetIndicatorState(currentIndex, totalPages);
        }
 public void UpdateCell(Ad ad, SearchResultsTableSource owner)
 {
     AdProperty = ad;
     this.AircraftNameLabel.Text    = AdProperty.Name;
     this.AircraftDetailsLabel.Text = AdProperty.Teaser;
     this.AircraftImage.Image       = HelperMethods.FromUrl(AdProperty.ImageURL);
     this.NotesLabel.Text           = AdProperty.Notes;
     this.BackgroundView            = null;
     this.BackgroundColor           = UIColor.Clear;
     this.Owner = owner;
 }
Beispiel #3
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            UITableViewCell cell = tableView.DequeueReusableCell(CellIdentifier);

            if (cell == null)
            {
                cell           = new UITableViewCell(UITableViewCellStyle.Subtitle, CellIdentifier);
                cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                var backgroundColor = UIColor.FromWhiteAlpha(1f, .3f);
                cell.BackgroundColor = backgroundColor;
            }



            //Ad ad = Owner.SearchResultsAdList[indexPath.Row];

            Ad ad = (Owner.filteredAds != null)
                ? Owner.filteredAds[indexPath.Row]
                : Owner.SearchResultsAdList[indexPath.Row];

            //cell.UpdateCell(item, this);
            cell.TextLabel.Text       = ad.Name;
            cell.DetailTextLabel.Text = ad.Teaser;

            var image = SDImageCache.SharedImageCache.ImageFromDiskCache(ad.ImageURL);

            // var image = HelperMethods.GetImageFromCacheOrDefault(ad.ImageURL);



            if (image == null)
            {
                try
                {
                    image = HelperMethods.FromUrl(ad.ImageURL);
                }catch (Exception e)
                {
                    image = UIImage.FromBundle("ad_placeholder.jpg");
                }
            }
            var maxWidth = UIKit.UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone ? 100f : 150f;

            image = image.MaxResizeImage(maxWidth, maxWidth);

            cell.ImageView.Image = image;


            return(cell);
        }