Exemple #1
0
        protected override void InitializeLastChance()
        {
            base.InitializeLastChance();

            MvvmCross.Plugins.DownloadCache.PluginLoader.Instance.EnsureLoaded();
            MvvmCross.Plugins.File.PluginLoader.Instance.EnsureLoaded();
            MvvmCross.Plugins.Json.PluginLoader.Instance.EnsureLoaded();

            var configuration = MvxDownloadCacheConfiguration.Default;

            configuration.MaxInMemoryBytes = 20971520;
            var fileDownloadCache = new MvxFileDownloadCache(
                configuration.CacheName,
                configuration.CacheFolderPath,
                configuration.MaxFiles,
                configuration.MaxFileAge);

            Mvx.RegisterSingleton <IMvxFileDownloadCache>(fileDownloadCache);
            //Mvx.RegisterSingleton<IMvxHttpFileDownloader>(new ARMvxHttpFileDownloader());

            var presenter = Mvx.Resolve <IMvxAndroidViewPresenter>() as IMvxMultipleViewModelCache;

            Mvx.RegisterSingleton <MvvmCross.Droid.Views.IMvxMultipleViewModelCache>(presenter ?? new ARMultipleViewModelCache());

            Mvx.CallbackWhenRegistered <IMvxValueCombinerRegistry>(service =>
            {
                service.Fill(ValueConverterAssemblies);
            });
        }
        private IMvxFileDownloadCache CreateFileDownloadCache()
        {
            var configuration = _configuration ?? MvxDownloadCacheConfiguration.Default;
            var fileDownloadCache = new MvxFileDownloadCache(configuration.CacheName,
                                                             configuration.CacheFolderPath,
                                                             configuration.MaxFiles,
                                                             configuration.MaxFileAge);

            return fileDownloadCache;
        }
Exemple #3
0
        private IMvxFileDownloadCache CreateFileDownloadCache()
        {
            var configuration     = _configuration ?? MvxDownloadCacheConfiguration.Default;
            var fileDownloadCache = new MvxFileDownloadCache(configuration.CacheName,
                                                             configuration.CacheFolderPath,
                                                             configuration.MaxFiles,
                                                             configuration.MaxFileAge);

            return(fileDownloadCache);
        }
Exemple #4
0
        private static IMvxFileDownloadCache CreateFileDownloadCache(
            MvxDownloadCacheConfiguration config)
        {
            var downloadCache = new MvxFileDownloadCache(
                config.CacheName,
                config.CacheFolderPath,
                config.MaxFiles,
                config.MaxFileAge);

            return(downloadCache);
        }
Exemple #5
0
        private MvxImageCache<Texture2D> CreateCache()
        {
            var configuration = _configuration ?? MvxDownloadCacheConfiguration.Default;

            var fileDownloadCache = new MvxFileDownloadCache(configuration.CacheName,
                                                             configuration.CacheFolderPath,
                                                             configuration.MaxFiles,
                                                             configuration.MaxFileAge);
			var fileCache = new MvxImageCache<Texture2D>(fileDownloadCache, configuration.MaxInMemoryFiles, configuration.MaxInMemoryBytes);
            return fileCache;
        }
Exemple #6
0
        protected virtual void InitialiseBitmapImageProviders()
        {
            this.RegisterServiceInstance <IMvxHttpFileDownloader>(new MvxHttpFileDownloader());

            var fileDownloadCache = new MvxFileDownloadCache("_PicturesMvvmCross", "_Caches/Pictures.MvvmCross/", 500, TimeSpan.FromDays(3.0));
            var fileCache         = new MvxImageCache <Bitmap>(fileDownloadCache, 30, 4000000);

            this.RegisterServiceInstance <IMvxImageCache <Bitmap> >(fileCache);

            this.RegisterServiceInstance <IMvxLocalFileImageLoader <Bitmap> >(new MvxAndroidLocalFileImageLoader());
        }
        protected virtual void InitialiseUIImageProviders()
        {
            this.RegisterServiceInstance <IMvxHttpFileDownloader>(new MvxHttpFileDownloader());

#warning Huge Magic numbers here
            var fileDownloadCache = new MvxFileDownloadCache("Pictures.MvvmCross", "../Library/Caches/Pictures.MvvmCross/", 500, TimeSpan.FromDays(3.0));
            var fileCache         = new MvxImageCache <UIImage>(fileDownloadCache, 30, 4000000);
            this.RegisterServiceInstance <IMvxImageCache <UIImage> >(fileCache);

            this.RegisterServiceInstance <IMvxLocalFileImageLoader <UIImage> >(new MvxTouchLocalFileImageLoader());
        }
        private MvxImageCache<UIImage> CreateCache()
        {
            var configuration = _configuration ?? MvxDownloadCacheConfiguration.Default;

            var fileDownloadCache = new MvxFileDownloadCache(configuration.CacheName,
                                                             configuration.CacheFolderPath,
                                                             configuration.MaxFiles,
                                                             configuration.MaxFileAge);
            var fileCache = new MvxImageCache<UIImage>(fileDownloadCache, configuration.MaxInMemoryFiles, configuration.MaxInMemoryBytes, configuration.DisposeOnRemoveFromCache);
            return fileCache;
        }
Exemple #9
0
        private MvxImageCache <Texture2D> CreateCache()
        {
            var configuration = _configuration ?? MvxDownloadCacheConfiguration.Default;

            var fileDownloadCache = new MvxFileDownloadCache(configuration.CacheName,
                                                             configuration.CacheFolderPath,
                                                             configuration.MaxFiles,
                                                             configuration.MaxFileAge);
            var fileCache = new MvxImageCache <Texture2D>(fileDownloadCache, configuration.MaxInMemoryFiles, configuration.MaxInMemoryBytes);

            return(fileCache);
        }
Exemple #10
0
        private MvxImageCache <UIImage> CreateCache()
        {
            var configuration = _configuration ?? MvxDownloadCacheConfiguration.Default;

            var fileDownloadCache = new MvxFileDownloadCache(configuration.CacheName,
                                                             configuration.CacheFolderPath,
                                                             configuration.MaxFiles,
                                                             configuration.MaxFileAge);
            var fileCache = new MvxImageCache <UIImage>(fileDownloadCache, configuration.MaxInMemoryFiles, configuration.MaxInMemoryBytes, configuration.DisposeOnRemoveFromCache);

            return(fileCache);
        }
Exemple #11
0
        public void Load()
        {
            File.PluginLoader.Instance.EnsureLoaded();

            this.RegisterServiceInstance<IMvxHttpFileDownloader>(new MvxHttpFileDownloader());

#warning Huge Magic numbers here - what cache sizes should be used?
            var fileDownloadCache = new MvxFileDownloadCache("Pictures.MvvmCross",
                                                             "../Library/Caches/Pictures.MvvmCross/", 500,
                                                             TimeSpan.FromDays(3.0));
            var fileCache = new MvxImageCache<UIImage>(fileDownloadCache, 30, 4000000);
            this.RegisterServiceInstance<IMvxImageCache<UIImage>>(fileCache);

            this.RegisterServiceInstance<IMvxLocalFileImageLoader<UIImage>>(new MvxTouchLocalFileImageLoader());
        }
Exemple #12
0
        public void Load()
        {
#warning One day I would like to decouple this implementation from the FileStore plugin
            File.PluginLoader.Instance.EnsureLoaded();

            Mvx.RegisterSingleton <IMvxHttpFileDownloader>(new MvxHttpFileDownloader());

#warning Huge Magic numbers here - what cache sizes should be used?
            var fileDownloadCache = new MvxFileDownloadCache("Pictures.MvvmCross",
                                                             "../Library/Caches/Pictures.MvvmCross/", 500,
                                                             TimeSpan.FromDays(3.0));
            var fileCache = new MvxImageCache <UIImage>(fileDownloadCache, 30, 4000000);
            Mvx.RegisterSingleton <IMvxImageCache <UIImage> >(fileCache);

            Mvx.RegisterType <IMvxImageHelper <UIImage>, MvxDynamicImageHelper <UIImage> >();
            Mvx.RegisterSingleton <IMvxLocalFileImageLoader <UIImage> >(new MvxTouchLocalFileImageLoader());
        }
        public void Load()
        {
#warning One day I would like to decouple this implementation from the FileStore plugin
            File.PluginLoader.Instance.EnsureLoaded();

            Mvx.RegisterSingleton<IMvxHttpFileDownloader>(new MvxHttpFileDownloader());

#warning Huge Magic numbers here - what cache sizes should be used?
            var fileDownloadCache = new MvxFileDownloadCache("Pictures.MvvmCross",
                                                             "../Library/Caches/Pictures.MvvmCross/", 500,
                                                             TimeSpan.FromDays(3.0));
            var fileCache = new MvxImageCache<UIImage>(fileDownloadCache, 30, 4000000);
            Mvx.RegisterSingleton<IMvxImageCache<UIImage>>(fileCache);

            Mvx.RegisterType<IMvxImageHelper<UIImage>, MvxDynamicImageHelper<UIImage>>();
            Mvx.RegisterSingleton<IMvxLocalFileImageLoader<UIImage>>(new MvxTouchLocalFileImageLoader());
        }
Exemple #14
0
        protected override void InitializeLastChance()
        {
            MvvmCross.Plugins.DownloadCache.PluginLoader.Instance.EnsureLoaded();
            MvvmCross.Plugins.File.PluginLoader.Instance.EnsureLoaded();
            MvvmCross.Plugins.Json.PluginLoader.Instance.EnsureLoaded();

            var configuration = MvxDownloadCacheConfiguration.Default;

            configuration.MaxInMemoryBytes = 20971520;
            var fileDownloadCache = new MvxFileDownloadCache(
                configuration.CacheName,
                configuration.CacheFolderPath,
                configuration.MaxFiles,
                configuration.MaxFileAge);

            Mvx.RegisterSingleton <IMvxFileDownloadCache>(fileDownloadCache);
            Mvx.RegisterSingleton <IMvxHttpFileDownloader>(new ARMvxHttpFileDownloader());

            base.InitializeLastChance();
        }
        private IMvxImageCache <Bitmap> CreateCache()
        {
            var configuration = MvxDownloadCacheConfiguration.Default;

            configuration.MaxInMemoryBytes = 1 * 1024 * 1024;

            var fileDownloadCache = new MvxFileDownloadCache(configuration.CacheName,
                                                             configuration.CacheFolderPath,
                                                             configuration.MaxFiles,
                                                             configuration.MaxFileAge);

            // TODO change ImageCache for different cases
            // - use MvxImageCache for default behaviour (which leads to often crashes)
            // - use ImmutableImageCache or ConcurrentImageCache to test the fix

            var fileCache = new ImmutableImageCache <Bitmap>(fileDownloadCache, configuration.MaxInMemoryFiles,
                                                             configuration.MaxInMemoryBytes, configuration.DisposeOnRemoveFromCache);

            return(fileCache);
        }
Exemple #16
0
        public void Load()
        {
            File.PluginLoader.Instance.EnsureLoaded();

            this.RegisterServiceInstance<IMvxHttpFileDownloader>(new MvxHttpFileDownloader());

#warning Huge Magic numbers here - what cache sizes should be used?
            try
            {
                var fileDownloadCache = new MvxFileDownloadCache("_PicturesMvvmCross", "_Caches/Pictures.MvvmCross/",
                                                                 500, TimeSpan.FromDays(3.0));
                var fileCache = new MvxImageCache<Bitmap>(fileDownloadCache, 30, 4000000);
                this.RegisterServiceInstance<IMvxImageCache<Bitmap>>(fileCache);

                this.RegisterServiceInstance<IMvxLocalFileImageLoader<Bitmap>>(new MvxAndroidLocalFileImageLoader());
            }
            catch (Exception exception)
            {
                MvxTrace.Trace(MvxTraceLevel.Error, "Binding", "Exception {0}", exception.ToLongString());
                throw;
            }
        }
        public void Load()
        {
#warning One day I would like to decouple this implementation from the FileStore plugin
			File.PluginLoader.Instance.EnsureLoaded();

            Mvx.RegisterSingleton<IMvxHttpFileDownloader>(new MvxHttpFileDownloader());

#warning Huge Magic numbers here - what cache sizes should be used?
            try
            {
                var fileDownloadCache = new MvxFileDownloadCache("_PicturesMvvmCross", "_Caches/Pictures.MvvmCross/",
                                                                 500, TimeSpan.FromDays(3.0));
                var fileCache = new MvxImageCache<Bitmap>(fileDownloadCache, 30, 4000000);
                Mvx.RegisterSingleton<IMvxImageCache<Bitmap>>(fileCache);

                Mvx.RegisterType<IMvxImageHelper<Bitmap>, MvxDynamicImageHelper<Bitmap>>();
                Mvx.RegisterSingleton<IMvxLocalFileImageLoader<Bitmap>>(new MvxAndroidLocalFileImageLoader());
            }
            catch (Exception exception)
            {
                MvxTrace.Error( "Binding", "Exception {0}", exception.ToLongString());
                throw;
            }
        }
Exemple #18
0
        public void Load()
        {
#warning One day I would like to decouple this implementation from the FileStore plugin
            File.PluginLoader.Instance.EnsureLoaded();

            Mvx.RegisterSingleton <IMvxHttpFileDownloader>(new MvxHttpFileDownloader());

#warning Huge Magic numbers here - what cache sizes should be used?
            try
            {
                var fileDownloadCache = new MvxFileDownloadCache("_PicturesMvvmCross", "_Caches/Pictures.MvvmCross/",
                                                                 500, TimeSpan.FromDays(3.0));
                var fileCache = new MvxImageCache <Bitmap>(fileDownloadCache, 30, 4000000);
                Mvx.RegisterSingleton <IMvxImageCache <Bitmap> >(fileCache);

                Mvx.RegisterType <IMvxImageHelper <Bitmap>, MvxDynamicImageHelper <Bitmap> >();
                Mvx.RegisterSingleton <IMvxLocalFileImageLoader <Bitmap> >(new MvxAndroidLocalFileImageLoader());
            }
            catch (Exception exception)
            {
                MvxTrace.Error("Binding", "Exception {0}", exception.ToLongString());
                throw;
            }
        }