Пример #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var            cache  = HNKCache.SharedCache;
            HNKCacheFormat format = (HNKCacheFormat)cache.Formats["thumbnail"];

            if (format == null)
            {
                format = new HNKCacheFormat("thumbnail")
                {
                    Size               = new SizeF(320, 240),
                    ScaleMode          = HNKScaleMode.AspectFill,
                    CompressionQuality = 0.5f,
                    DiskCapacity       = 1 * 1024 * 1024,
                    PreloadPolicy      = HNKPreloadPolicy.LastSession
                };
            }

            var fetcher = new HNKNetworkFetcher(new NSUrl("https://media-cdn.tripadvisor.com/media/photo-s/03/9b/30/26/seattle.jpg"));

            fetcher.FetchImage((imag) => { HanekeImageView.Image = imag; }, (err) => { });
            HanekeImageView.SetCacheFormat(format);
            //HanekeImageView.SetImage(new NSUrl("https://www.xamarin.com/content/images/pages/branding/assets/xamagon.png"), UIImage.FromBundle("41015.png") );
            HanekeButton.SetBackgroundImage(new NSUrl("https://www.xamarin.com/content/images/pages/branding/assets/xamagon.png"), UIControlState.Normal, UIImage.FromBundle("41015.png"));
        }
Пример #2
0
        static HNKCacheFormat getCacheFormat(CGSize size)
        {
            var name = $"avatar{size.GetHashCode ()}";

            var format = HNKCache.SharedCache.Formats [name] as HNKCacheFormat;

            if (format == null)
            {
                format = new HNKCacheFormat(name)
                {
                    Size          = new CGSize(size.Width, size.Height),
                    ScaleMode     = HNKScaleMode.AspectFit,
                    DiskCapacity  = 10 * 1024 * 1024,                    // 10MB
                    PreloadPolicy = HNKPreloadPolicy.LastSession
                };
            }

            return(format);
        }
Пример #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            HNKCacheFormat format = (HNKCacheFormat)HNKCache.SharedCache().Formats["thumbnail"];

            if (format == null)
            {
                format = new HNKCacheFormat("thumbnail")
                {
                    Size               = new SizeF(320, 240),
                    ScaleMode          = HNKScaleMode.AspectFill,
                    CompressionQuality = 0.5f,
                    DiskCapacity       = 1 * 1024 * 1024,
                    PreloadPolicy      = HNKPreloadPolicy.LastSession
                };
            }


            TheImageView.SetCacheFormat(format);
            TheButton.SetBackgroundImage(new NSUrl("https://raw.githubusercontent.com/Haneke/Haneke/master/Assets/github-header.png"), UIControlState.Normal);
            TheImageView.SetImage(new NSUrl("https://raw.githubusercontent.com/Haneke/Haneke/master/Assets/github-header.png"));
        }
Пример #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            HNKCacheFormat format = (HNKCacheFormat)HNKCache.SharedCache().Formats["thumbnail"];
            if (format == null)
            {
                format = new HNKCacheFormat("thumbnail")
                    {
                        Size = new SizeF(320, 240),
                        ScaleMode = HNKScaleMode.AspectFill,
                        CompressionQuality = 0.5f,
                        DiskCapacity = 1 * 1024 * 1024,
                        PreloadPolicy = HNKPreloadPolicy.LastSession
                    };
            }

            HanekeImageView.SetCacheFormat(format);
            HanekeImageView.SetImage(new NSUrl("http://images.kpopstarz.com/data/images/full/190451/katy-perry-sex-bomb.png?w=300"), UIImage.FromBundle("41015.png") );
            HanekeButton.SetBackgroundImage(new NSUrl("http://images.kpopstarz.com/data/images/full/190451/katy-perry-sex-bomb.png?w=300"), UIControlState.Normal, UIImage.FromBundle("41015.png"));

            var cache = HanekeImageView.CacheFormat();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var            cache  = HNKCache.SharedCache();
            HNKCacheFormat format = (HNKCacheFormat)cache.Formats["thumbnail"];

            if (format == null)
            {
                format = new HNKCacheFormat("thumbnail")
                {
                    Size               = new SizeF(320, 240),
                    ScaleMode          = HNKScaleMode.AspectFill,
                    CompressionQuality = 0.5f,
                    DiskCapacity       = 1 * 1024 * 1024,
                    PreloadPolicy      = HNKPreloadPolicy.LastSession
                };
            }


            HanekeImageView.SetCacheFormat(format);
            HanekeImageView.SetImage(new NSUrl("http://images.kpopstarz.com/data/images/full/190451/katy-perry-sex-bomb.png?w=300"), UIImage.FromBundle("41015.png"));
            HanekeButton.SetBackgroundImage(new NSUrl("http://images.kpopstarz.com/data/images/full/190451/katy-perry-sex-bomb.png?w=300"), UIControlState.Normal, UIImage.FromBundle("41015.png"));
        }