Ejemplo n.º 1
0
        public void Register(Action <Func <object>, Type, string> registerFunction)
        {
            registerFunction(() => new JsonSerializerSettings()
            {
                ObjectCreationHandling = ObjectCreationHandling.Replace,
                ReferenceLoopHandling  = ReferenceLoopHandling.Ignore,
                TypeNameHandling       = TypeNameHandling.All,
            }, typeof(JsonSerializerSettings), null);

            var akavacheDriver = new AkavacheDriver();

            registerFunction(() => akavacheDriver, typeof(ISuspensionDriver), null);

#if APPKIT || UIKIT
            BlobCache.ApplicationName = NSBundle.MainBundle.BundleIdentifier;
            registerFunction(() => new MacFilesystemProvider(), typeof(IFilesystemProvider), null);
#endif

#if ANDROID
            var ai = Application.Context.PackageManager.GetApplicationInfo(Application.Context.PackageName, 0);
            BlobCache.ApplicationName = ai.LoadLabel(Application.Context.PackageManager);

            registerFunction(() => new AndroidFilesystemProvider(), typeof(IFilesystemProvider), null);
#endif
        }
Ejemplo n.º 2
0
        public void Register(Action<Func<object>, Type, string> registerFunction)
        {
            registerFunction(() => new JsonSerializerSettings() 
            {
                ObjectCreationHandling = ObjectCreationHandling.Replace,
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
                TypeNameHandling = TypeNameHandling.All,
            }, typeof(JsonSerializerSettings), null);

            var akavacheDriver = new AkavacheDriver();
            registerFunction(() => akavacheDriver, typeof(ISuspensionDriver), null);

#if APPKIT || UIKIT
            BlobCache.ApplicationName = NSBundle.MainBundle.BundleIdentifier;
            registerFunction(() => new MacFilesystemProvider(), typeof(IFilesystemProvider), null);
#endif

#if ANDROID
            var ai = Application.Context.PackageManager.GetApplicationInfo(Application.Context.PackageName, 0);
            BlobCache.ApplicationName = ai.LoadLabel(Application.Context.PackageManager);

            registerFunction(() => new AndroidFilesystemProvider(), typeof(IFilesystemProvider), null);
#endif
        }