コード例 #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);
            });
        }
コード例 #2
0
ファイル: Plugin.cs プロジェクト: martijn00/MvvmCross-Plugins
        private IMvxFileDownloadCache CreateFileDownloadCache()
        {
            var configuration = _configuration ?? MvxDownloadCacheConfiguration.Default;
            var fileDownloadCache = new MvxFileDownloadCache(configuration.CacheName,
                                                             configuration.CacheFolderPath,
                                                             configuration.MaxFiles,
                                                             configuration.MaxFileAge);

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

            return(fileDownloadCache);
        }
コード例 #4
0
ファイル: MvxPlus.cs プロジェクト: showmap/smartwalk
        private static IMvxFileDownloadCache CreateFileDownloadCache(
            MvxDownloadCacheConfiguration config)
        {
            var downloadCache = new MvxFileDownloadCache(
                config.CacheName,
                config.CacheFolderPath,
                config.MaxFiles,
                config.MaxFileAge);

            return(downloadCache);
        }
コード例 #5
0
ファイル: Plugin.cs プロジェクト: ylyking/mvx-unity-ngui
        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;
        }
コード例 #6
0
ファイル: MvxBaseAndroidSetup.cs プロジェクト: slodge/Blooor
        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());
        }
コード例 #7
0
        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());
        }
コード例 #8
0
ファイル: Plugin.cs プロジェクト: nunohorta/MvvmCross-Plugins
        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;
        }
コード例 #9
0
ファイル: Plugin.cs プロジェクト: yuewah/mvx-unity-ngui
        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);
        }
コード例 #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);
        }
コード例 #11
0
ファイル: Plugin.cs プロジェクト: JoanMiro/MvxMod
        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());
        }
コード例 #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());
        }
コード例 #13
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());
        }
コード例 #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();
        }
コード例 #15
0
        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);
        }
コード例 #16
0
ファイル: Plugin.cs プロジェクト: JoanMiro/MvxMod
        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;
            }
        }
コード例 #17
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;
            }
        }
コード例 #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;
            }
        }