public IGImageGalleryViewController(UrlImageStore <TKey> imageStore, UrlImageStore <TKey> thumbnailImageStore) : base() { this.images = new List <IGImage <TKey> >(); this.ImageStore = imageStore; this.ThumbnailImageStore = thumbnailImageStore; this.Images = new List <IGImage <TKey> >(); //this.NavigationController.NavigationBar.BarStyle = UIBarStyle.Black; //this.NavigationController.NavigationBar.Translucent = true; scrollView = new UIScrollView(this.View.Bounds); scrollView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; scrollView.ScrollEnabled = true; //scrollView.DelaysContentTouches = true; this.igView = new IGView <TKey>(scrollView.Bounds, this.Images, this.ImageStore, this.ThumbnailImageStore); this.igView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; this.igView.ImageTapped += delegate(int imageIndex) { Console.WriteLine("Image Tap[ped: " + imageIndex); singleViewController = new IGSingleImageViewController <TKey>(this.Images, imageIndex, this.ImageStore); singleViewController.SingleRightBarButton = this.SingleRightBarButton; this.BeginInvokeOnMainThread(delegate { this.NavigationController.PushViewController(singleViewController, true); }); }; scrollView.AddSubview(this.igView); this.View.AddSubview(scrollView); }
public void ShowGalery (List<Picture> pictures) { if (pictures == null) return; var images = pictures.OrderBy (p => p.SortOrder).ToIGImage (); UIImage defaultImage = UIImage.FromFile ("image/preloader.png"); var imageStore = new UrlImageStore<string> (50, "galery", null); imageStore.DefaultImage = defaultImage; var thumbnailImageStore = new UrlImageStore<string> (50, "galeryThumbnail", ScaleImage); thumbnailImageStore.DefaultImage = defaultImage; var igVC = new IGImageGalleryViewController<string> (images, imageStore, thumbnailImageStore, _rootViewConroller.NavigationController); igVC.View.Frame = this.View.Bounds; //igVC.Title = Locale.GetText ("Bilder"); //_rootViewConroller.NavigationController.PushViewController (igVC, true); //this.View = igVC.View; this.Add (igVC.View); }
public IGView(RectangleF frame, List <IGImage <TKey> > images, UrlImageStore <TKey> imageStore, UrlImageStore <TKey> thumbnailImageStore) : base(frame) { this.Images = images; this.ImageStore = imageStore; this.ThumbnailImageStore = thumbnailImageStore; }
public IGView(List <IGImage <TKey> > images, UrlImageStore <TKey> imageStore, UrlImageStore <TKey> thumbnailImageStore) : base() { this.Images = images; this.ImageStore = imageStore; this.ThumbnailImageStore = thumbnailImageStore; }
private ImageManager() { imageStore = new UrlImageStore("myImageStore", processImage); }
public IGSingleImageViewController(List <IGImage <TKey> > images, int imageIndex, UrlImageStore <TKey> imageStore) : base() { this.Images = images; this.ImageIndex = imageIndex; this.ImageStore = imageStore; this.scrollView = new UIScrollView(this.View.Bounds); this.scrollView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.scrollView.BackgroundColor = UIColor.Black; this.scrollView.ScrollEnabled = true; this.scrollView.MinimumZoomScale = 0.5f; this.scrollView.MaximumZoomScale = 3.0f; var img = this.Images[this.ImageIndex]; this.Title = img.Title; bool showActivity = !this.ImageStore.Exists(img.Id); UIImage imgUI = this.ImageStore.RequestImage(img.Id, img.Url, this); this.imageView = new UIImageView(imgUI); this.imageView.Frame = scrollView.Bounds; this.imageView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.scrollView.Delegate = new ScrollViewDelegate(this.imageView); this.scrollView.AddSubview(this.imageView); this.scrollView.ContentSize = this.imageView.Image.Size; this.View.AddSubview(this.scrollView); float descHeight = this.View.StringSize(this.Images[imageIndex].Caption, UIFont.SystemFontOfSize(13.0f), new SizeF(this.View.Bounds.Width - 10, this.View.Bounds.Height - 15), UILineBreakMode.WordWrap).Height; this.descriptionView = new UITextView(new RectangleF(0, this.View.Frame.Height - descHeight - 15 - 44, this.View.Frame.Width, descHeight + 15)); this.descriptionView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; this.descriptionView.Text = this.Images[imageIndex].Caption; this.descriptionView.BackgroundColor = UIColor.Black.ColorWithAlpha(0.5f); this.descriptionView.Font = UIFont.SystemFontOfSize(13.0f); this.descriptionView.TextColor = UIColor.White; this.descriptionView.Editable = false; this.View.AddSubview(this.descriptionView); this.activityView = new UIActivityIndicatorView(new RectangleF((this.View.Bounds.Width - 30) / 2, (this.View.Bounds.Height - 30) / 2, 30, 30)); this.activityView.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin; this.activityView.Hidden = !showActivity; this.activityView.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge; this.View.AddSubview(this.activityView); if (showActivity) { this.activityView.StartAnimating(); } //this.activityView.StartAnimating(); //this.Title = this.Images[imageIndex].Title; tapGesture = new UITapGestureRecognizer(); tapGesture.NumberOfTapsRequired = 1; tapGesture.DelaysTouchesEnded = true; tapGesture.DelaysTouchesBegain = true; tapGesture.AddTarget(this, TapSelector); this.View.AddGestureRecognizer(tapGesture); swipeLeft = new UISwipeGestureRecognizer(); swipeLeft.Direction = UISwipeGestureRecognizerDirection.Left; swipeLeft.Delegate = new SwipeRecognizerDelegate(); swipeLeft.AddTarget(this, SwipeLeftSelector); this.View.AddGestureRecognizer(swipeLeft); swipeRight = new UISwipeGestureRecognizer(); swipeRight.Direction = UISwipeGestureRecognizerDirection.Right; swipeRight.Delegate = new SwipeRecognizerDelegate(); swipeRight.AddTarget(this, SwipeRightSelector); this.View.AddGestureRecognizer(swipeRight); this.scrollView.DelaysContentTouches = true; }