Exemplo n.º 1
0
 public ShellPageRendererTracker(IShellContext context)
 {
     _context = context;
     _nSCache = new NSCache();
     _context.Shell.PropertyChanged += HandleShellPropertyChanged;
     _fontManager = context.Shell.RequireFontManager();
 }
Exemplo n.º 2
0
 public ImageCacheManager()
 {
     imageCache = new NSCache {
         Name           = "ImageCacheManager",
         CountLimit     = 20,              // Max 20 images in memory.
         TotalCostLimit = 10 * 1024 * 1024 // Max 10MB used.
     };
 }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the Cache class.
        /// </summary>
        /// <param name="cachePercentageSize">The percentage of total physical memoery that the cache will be allowed to grow.</param>
        protected Cache(float cachePercentageSize)
        {
            if (cachePercentageSize >= 1.0f)
            {
                throw new ArgumentOutOfRangeException(nameof(cachePercentageSize), "The percentage size must be less than 1.0f.");
            }

            this.cache = new NSCache();
            this.cache.TotalCostLimit = (nuint)(NSProcessInfo.ProcessInfo.PhysicalMemory * cachePercentageSize);
        }
Exemplo n.º 4
0
        private ImageCache(int maxCacheSize)
        {
            _cache = new NSCache();
            _cache.TotalCostLimit = (nuint)(NSProcessInfo.ProcessInfo.PhysicalMemory * 0.2); // 20% of physical memory

            // Can't use minilogger here, we would have too many dependencies
            decimal sizeInMB = System.Math.Round((decimal)_cache.TotalCostLimit/(1024*1024), 2);
            System.Diagnostics.Debug.WriteLine(string.Format("LruCache size: {0}MB", sizeInMB));

            // if we get a memory warning notification we should clear the cache
            NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UIApplicationDidReceiveMemoryWarningNotification"), notif => Clear());
        }
Exemplo n.º 5
0
        public ShellPageRendererTracker(IShellContext context)
        {
            _context = context;
            _nSCache = new NSCache();
            _context.Shell.PropertyChanged += HandleShellPropertyChanged;

            if (_context.Shell.Toolbar != null)
            {
                _context.Shell.Toolbar.PropertyChanged += OnToolbarPropertyChanged;
            }

            _fontManager = context.Shell.RequireFontManager();
        }
Exemplo n.º 6
0
        private ImageCache(int maxCacheSize, IMiniLogger logger)
        {
			_logger = logger;
            _cache = new NSCache();
			_imageInformations = new ConcurrentDictionary<string, ImageInformation>();
            _cache.TotalCostLimit = (nuint)(NSProcessInfo.ProcessInfo.PhysicalMemory * 0.2); // 20% of physical memory

            decimal sizeInMB = System.Math.Round((decimal)_cache.TotalCostLimit/(1024*1024), 2);
            logger.Debug(string.Format("LruCache size: {0}MB", sizeInMB));

            // if we get a memory warning notification we should clear the cache
            NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UIApplicationDidReceiveMemoryWarningNotification"), notif => Clear());
        }
Exemplo n.º 7
0
        private ImageCache(int maxCacheSize)
        {
            _cache = new NSCache();
            _cache.TotalCostLimit = (nuint)(NSProcessInfo.ProcessInfo.PhysicalMemory * 0.2); // 20% of physical memory

            // Can't use minilogger here, we would have too many dependencies
            decimal sizeInMB = System.Math.Round((decimal)_cache.TotalCostLimit / (1024 * 1024), 2);

            System.Diagnostics.Debug.WriteLine(string.Format("LruCache size: {0}MB", sizeInMB));

            // if we get a memory warning notification we should clear the cache
            NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UIApplicationDidReceiveMemoryWarningNotification"), notif => Clear());
        }
Exemplo n.º 8
0
        private ImageCache(int maxCacheSize, IMiniLogger logger)
        {
            _cache                = new NSCache();
            _imageInformations    = new ConcurrentDictionary <string, ImageInformation>();
            _cache.TotalCostLimit = (nuint)(NSProcessInfo.ProcessInfo.PhysicalMemory * 0.2); // 20% of physical memory

            decimal sizeInMB = System.Math.Round((decimal)_cache.TotalCostLimit / (1024 * 1024), 2);

            logger.Debug(string.Format("LruCache size: {0}MB", sizeInMB));

            // if we get a memory warning notification we should clear the cache
            NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UIApplicationDidReceiveMemoryWarningNotification"), notif => Clear());
        }
Exemplo n.º 9
0
        public static UIImage GetImage(Image image)
        {
            if (ImageCache == null)
                ImageCache = new NSCache ();

            NSObject key = NSObject.FromObject (image.Name);
            UIImage img = ImageCache.ObjectForKey (key) as UIImage;
            if (img == null) {
                if (NSFileManager.DefaultManager.FileExists (image.ImagePath)) {
                    img = UIImage.FromBundle (image.ImagePath);
                    ImageCache.SetObjectforKey (img, key);
                }
                else
                    Console.WriteLine("Couldn't find image for {0}", image.ImagePath);
            }
            return img;
        }
Exemplo n.º 10
0
        ImageCache(int maxCacheSize, IMiniLogger logger)
        {
            _logger            = logger;
            _cache             = new NSCache();
            _imageInformations = new ConcurrentDictionary <string, ImageInformation>();

            if (maxCacheSize <= 0)
            {
                _cache.TotalCostLimit = (nuint)(NSProcessInfo.ProcessInfo.PhysicalMemory * 0.2d); // 20% of physical memory
            }
            else
            {
                _cache.TotalCostLimit = (nuint)Math.Min((NSProcessInfo.ProcessInfo.PhysicalMemory * 0.05d), maxCacheSize);
            }

            double sizeInMB = Math.Round(_cache.TotalCostLimit / 1024d / 1024d, 2);

            logger.Debug(string.Format("Image memory cache size: {0} MB", sizeInMB));

            // if we get a memory warning notification we should clear the cache
            NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UIApplicationDidReceiveMemoryWarningNotification"), notif => Clear());
        }
 public ShellPageRendererTracker(IShellContext context)
 {
     _context = context;
     _nSCache = new NSCache();
 }
Exemplo n.º 12
0
		public TCAsyncImage ()
		{
			cacheImages = new NSCache ();
		}
Exemplo n.º 13
0
        //static string storeid = "2";

        static BlobWrapper()
        {
            wineBottles = new NSCache();
            profilePics = new NSCache();
        }
 public ClusterIconGeneratorHandler(ClusterOptions options)
 {
     iconCache    = new NSCache();
     this.options = options;
 }
Exemplo n.º 15
0
 public CustomTileOverlay(string urlTemplate) : base(urlTemplate)
 {
     _cache = new NSCache();
     _cache.RemoveAllObjects();
 }
 public GMUClusterIconGeneratorHandler(ClusterOptions options)
 {
     this._iconCache = new NSCache();
     this._options   = options;
 }