public void Register(Action<Func<object>, Type, string> registerFunction) { #if SILVERLIGHT || XAMARIN_MOBILE var fs = new IsolatedStorageProvider(); #else var fs = new SimpleFilesystemProvider(); #endif registerFunction(() => fs, typeof(IFilesystemProvider), null); var localCache = default(Lazy<IBlobCache>); var userAccount = default(Lazy<IBlobCache>); var secure = default(Lazy<ISecureBlobCache>); if (!RxApp.InUnitTestRunner()) { localCache = new Lazy<IBlobCache>(() => new CPersistentBlobCache(fs.GetDefaultLocalMachineCacheDirectory(), fs)); userAccount = new Lazy<IBlobCache>(() => new CPersistentBlobCache(fs.GetDefaultRoamingCacheDirectory(), fs)); secure = new Lazy<ISecureBlobCache>(() => new CEncryptedBlobCache(fs.GetDefaultRoamingCacheDirectory(), fs)); } else { localCache = new Lazy<IBlobCache>(() => new TestBlobCache()); userAccount = new Lazy<IBlobCache>(() => new TestBlobCache()); secure = new Lazy<ISecureBlobCache>(() => new TestBlobCache()); } registerFunction(() => localCache.Value, typeof(IBlobCache), "LocalMachine"); registerFunction(() => userAccount.Value, typeof(IBlobCache), "UserAccount"); registerFunction(() => secure.Value, typeof(ISecureBlobCache), null); registerFunction(() => new AkavacheHttpMixin(), typeof(IAkavacheHttpMixin), null); }
public void Register(IMutableDependencyResolver resolver) { #if SILVERLIGHT || XAMARIN_MOBILE var fs = new IsolatedStorageProvider(); #elif WINRT var fs = new WinRTFilesystemProvider(); #else var fs = new SimpleFilesystemProvider(); #endif resolver.Register(() => fs, typeof(IFilesystemProvider), null); #if WP8 var enc = new WP8EncryptionProvider(); #elif WINRT var enc = new WinRTEncryptionProvider(); #else var enc = new EncryptionProvider(); #endif resolver.Register(() => enc, typeof(IEncryptionProvider), null); var localCache = new Lazy<IBlobCache>(() => new InMemoryBlobCache()); var userAccount = new Lazy<IBlobCache>(() => new InMemoryBlobCache()); var secure = new Lazy<ISecureBlobCache>(() => new InMemoryBlobCache()); resolver.Register(() => localCache.Value, typeof(IBlobCache), "LocalMachine"); resolver.Register(() => userAccount.Value, typeof(IBlobCache), "UserAccount"); resolver.Register(() => secure.Value, typeof(ISecureBlobCache), null); resolver.Register(() => new AkavacheHttpMixin(), typeof(IAkavacheHttpMixin), null); #if APPKIT || UIKIT BlobCache.ApplicationName = NSBundle.MainBundle.BundleIdentifier; resolver.Register(() => 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); resolver.Register(() => new AndroidFilesystemProvider(), typeof(IFilesystemProvider), null); #endif }
public void Register(IMutableDependencyResolver resolver) { #if SILVERLIGHT || XAMARIN_MOBILE var fs = new IsolatedStorageProvider(); #elif WINRT var fs = new WinRTFilesystemProvider(); #else var fs = new SimpleFilesystemProvider(); #endif resolver.Register(() => fs, typeof(IFilesystemProvider), null); #if WP8 var enc = new WP8EncryptionProvider(); #elif WINRT var enc = new WinRTEncryptionProvider(); #else var enc = new EncryptionProvider(); #endif resolver.Register(() => enc, typeof(IEncryptionProvider), null); var localCache = new Lazy <IBlobCache>(() => new InMemoryBlobCache()); var userAccount = new Lazy <IBlobCache>(() => new InMemoryBlobCache()); var secure = new Lazy <ISecureBlobCache>(() => new InMemoryBlobCache()); resolver.Register(() => localCache.Value, typeof(IBlobCache), "LocalMachine"); resolver.Register(() => userAccount.Value, typeof(IBlobCache), "UserAccount"); resolver.Register(() => secure.Value, typeof(ISecureBlobCache), null); resolver.Register(() => new AkavacheHttpMixin(), typeof(IAkavacheHttpMixin), null); #if APPKIT || UIKIT BlobCache.ApplicationName = NSBundle.MainBundle.BundleIdentifier; resolver.Register(() => 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); resolver.Register(() => new AndroidFilesystemProvider(), typeof(IFilesystemProvider), null); #endif }
public void Register(Action <Func <object>, Type, string> registerFunction) { #if SILVERLIGHT || XAMARIN_MOBILE var fs = new IsolatedStorageProvider(); #else var fs = new SimpleFilesystemProvider(); #endif registerFunction(() => fs, typeof(IFilesystemProvider), null); var localCache = new Lazy <IBlobCache>(() => new CPersistentBlobCache(fs.GetDefaultLocalMachineCacheDirectory(), fs)); registerFunction(() => localCache.Value, typeof(IBlobCache), "LocalMachine"); var userAccount = new Lazy <IBlobCache>(() => new CPersistentBlobCache(fs.GetDefaultRoamingCacheDirectory(), fs)); registerFunction(() => userAccount.Value, typeof(IBlobCache), "UserAccount"); var secure = new Lazy <ISecureBlobCache>(() => new CEncryptedBlobCache(fs.GetDefaultRoamingCacheDirectory(), fs)); registerFunction(() => secure.Value, typeof(ISecureBlobCache), null); registerFunction(() => new AkavacheHttpMixin(), typeof(IAkavacheHttpMixin), null); }