public SqlitePersistentBlobCache(string databaseFile, IScheduler scheduler = null, IServiceProvider serviceProvider = null) { Scheduler = scheduler ?? RxApp.TaskpoolScheduler; ServiceProvider = serviceProvider; BlobCache.EnsureInitialized(); _connection = new SQLiteAsyncConnection(databaseFile, storeDateTimeAsTicks: true); _connection.CreateTableAsync <CacheElement>(); _inflightCache = new MemoizingMRUCache <string, IObservable <CacheElement> >((key, ce) => { return(_connection.QueryAsync <CacheElement>("SELECT * FROM CacheElement WHERE Key=? LIMIT 1;", key) .SelectMany(x => { return (x.Count == 1) ? Observable.Return(x[0]) : ObservableThrowKeyNotFoundException(key); }) .SelectMany(x => { if (x.Expiration < Scheduler.Now.UtcDateTime) { return Invalidate(key).SelectMany(_ => ObservableThrowKeyNotFoundException(key)); } else { return Observable.Return(x); } })); }, 10); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); #if false // Use for diagnosing image resources in the portable library var assembly = typeof(IdeaTrackr.Extensions.ImageResourceExtension).GetTypeInfo().Assembly; foreach (var res in assembly.GetManifestResourceNames()) { System.Diagnostics.Debug.WriteLine("found resource: " + res); } #endif // Initialize Akavache BlobCache.ApplicationName = App.ApplicationName; BlobCache.EnsureInitialized(); Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); //if ((int)Android.OS.Build.VERSION.SdkInt >= 21) //{ // ActionBar.SetIcon(new ColorDrawable(Resources.GetColor(Android.Resource.Color.Transparent))); //} }
public AkavacheContext(IServiceSettings serviceSettings) { BlobCache.ApplicationName = serviceSettings.ServiceId; BlobCache.EnsureInitialized(); _blobCache = BlobCache.UserAccount; }
public AkavacheContext() { BlobCache.ApplicationName = "com.rubit0.YoApp"; BlobCache.EnsureInitialized(); _blobCache = BlobCache.UserAccount; }
protected override void OnStart() { // Handle when your app starts //Make sure you set the application name before doing any inserts or gets BlobCache.ApplicationName = "RegistroPropiedadBlob"; BlobCache.EnsureInitialized(); }
public void Start() { I18N.Current .SetNotFoundSymbol("$") .SetFallbackLocale("it") .SetThrowWhenKeyNotFound( true) // Optional: Throw an exception when keys are not found (recommended only for debugging) //.SetLogger(text => Debug.WriteLine(text)) // action to output traces .Init(GetType().Assembly); // assembly where locales live BlobCache.ApplicationName = "Beer Shop"; BlobCache.EnsureInitialized(); IsMock = false; if (IsMock) { InjectMockServices(); } else { InjectServices(); } Services.Service.Instance.Start(); ExceptionLogger.NonFatalException -= LogExceptionInAppOutput; ExceptionLogger.NonFatalException += LogExceptionInAppOutput; }
protected override void OnStart() { base.OnStart(); BlobCache.ApplicationName = "TMTK"; BlobCache.EnsureInitialized(); }
public override void Initialize() { base.Initialize(); BlobCache.ApplicationName = "Xamarines"; BlobCache.EnsureInitialized(); Mvx.RegisterSingleton <IAuthenticationService>(() => { return(new PersistAuthenticationDataServiceDecorator(new InMemoryAuthenticationService())); }); Mvx.RegisterSingleton <ExceptionGuardService>(() => new ExceptionGuardService(new SampleBasedExceptionGuard())); Mvx.RegisterType <LoginViewModel, LoginViewModel>(); Mvx.RegisterType <MainViewModel, MainViewModel>(); var authService = Mvx.Resolve <IAuthenticationService>(); bool isSignedIn = false; /*Task.Run(async () => * { * isSignedIn = await authService.IsSignedIn(); * * if (isSignedIn) * RegisterAppStart<MainViewModel>(); * else * RegisterAppStart<LoginViewModel>(); * });*/ RegisterAppStart <LoginViewModel>(); }
public override void Initialize() { BlobCache.ApplicationName = "LHNXA"; BlobCache.EnsureInitialized(); Mvx.RegisterSingleton <IAuthenticationService>(() => { return(new PersistAuthenticationDataServiceDecorator(new InMemoryAuthenticationService())); }); Mvx.RegisterType <LoginViewModel, LoginViewModel>(); Mvx.RegisterType <MainViewModel, MainViewModel>(); Mvx.RegisterType <IMvxAppStart>(() => { var authService = Mvx.Resolve <IAuthenticationService>(); bool isSignedIn = false; Task.Run(async() => { isSignedIn = await authService.IsSignedIn(); }).Wait(); if (isSignedIn) { return(new MvxAppStart <MainViewModel>()); } return(new MvxAppStart <LoginViewModel>()); }); }
public StorageService() { BlobCache.ApplicationName = "xam_tweet"; BlobCache.EnsureInitialized(); BlobCache.ForcedDateTimeKind = DateTimeKind.Utc; blob = BlobCache.LocalMachine; }
protected override void OnStart() { AppCenter.Start($"android={Constants.AppCenterKey};", typeof(Analytics), typeof(Crashes)); BlobCache.EnsureInitialized(); BlobCache.ApplicationName = Constants.AppName; BlobCache.ForcedDateTimeKind = DateTimeKind.Utc; }
public void ConfigureAkavache() { BlobCache.ApplicationName = "ReactiveReaderApp"; BlobCache.EnsureInitialized(); Locator.CurrentMutable.RegisterConstant(BlobCache.UserAccount, typeof(IBlobCache)); Locator.CurrentMutable.RegisterConstant(BlobCache.Secure, typeof(ISecureBlobCache)); }
public void OnActivityCreated(Activity activity, Bundle savedInstanceState) { CrossCurrentActivity.Current.Activity = activity; global::Xamarin.Forms.Forms.Init(activity, savedInstanceState); BlobCache.ApplicationName = "MyExpenses"; BlobCache.EnsureInitialized(); reportDatabase = new ReportDatabase(); }
void StorageSettup() { /* ================================================================================================== * Your application's name. Set this at startup, this defines where your data will be stored * (usually at %AppData%\[ApplicationName]) * ================================================================================================*/ BlobCache.ApplicationName = "XamarinCI"; BlobCache.EnsureInitialized(); }
public static void Initialize() { BlobCache.ApplicationName = "MahTestApp"; BlobCache.EnsureInitialized(); MvxSimpleIoCContainer.Initialize(); Mvx.RegisterSingleton <IBlobCache>(() => BlobCache.LocalMachine); Mvx.RegisterType <IPlatform, ApplePlatform> (); Mvx.RegisterType <ISettings, AppleSettings> (); }
protected override void OnInitialized() { InitializeComponent(); BlobCache.ApplicationName = "LazyDevCache"; BlobCache.EnsureInitialized(); NavigationService.NavigateAsync("NavigationPage/MainPage"); }
/// <summary> /// Initializes a new instance of the <see cref="SqlRawPersistentBlobCache"/> class. /// </summary> /// <param name="databaseFile">The location of the database file.</param> /// <param name="scheduler">The scheduler to perform operations on.</param> public SqlRawPersistentBlobCache(string databaseFile, IScheduler scheduler = null) { Scheduler = scheduler ?? BlobCache.TaskpoolScheduler; BlobCache.EnsureInitialized(); Connection = new SQLiteConnection(databaseFile, storeDateTimeAsTicks: true); _initializer = Initialize(); }
static MyPersistentBlobCache SetupCache(string cacheDirectory) { BlobCache.EnsureInitialized(); var fixture = new MyPersistentBlobCache(cacheDirectory); // ensuring we are working with a clear cache fixture.InvalidateAll(); return(fixture); }
public override void OnCreate() { BlobCache.ApplicationName = "MahTestApp"; BlobCache.EnsureInitialized(); MvxSimpleIoCContainer.Initialize(); Mvx.RegisterSingleton <IBlobCache>(() => BlobCache.LocalMachine); Mvx.RegisterType <IPlatform, DroidPlatform> (); Mvx.RegisterType <ISettings, DroidSettings> (); base.OnCreate(); }
public App() { BlobCache.ApplicationName = "simsoft"; BlobCache.EnsureInitialized(); InitializeComponent(); SetUpIOC(); var rootPage = FreshMvvm.FreshPageModelResolver.ResolvePageModel <PageModels.LoginPageModel>(); MainPage = new FreshMvvm.FreshNavigationContainer(rootPage); //Navigation.initTabsSellBL(); }
public App() { BlobCache.ApplicationName = "be4care"; BlobCache.EnsureInitialized(); InitializeComponent(); SetUpIOC(); Device.BeginInvokeOnMainThread(() => { var rootPage = FreshMvvm.FreshPageModelResolver.ResolvePageModel <PageModels.checkLoginPageModel>(); MainPage = new FreshMvvm.FreshNavigationContainer(rootPage); }); }
public DatabaseServices() { try { BlobCache.ApplicationName = "BarelandsFarm"; BlobCache.EnsureInitialized(); } catch (Exception ex) { Console.WriteLine(ex); } }
private RenderRepository() { BlobCache.ApplicationName = ClassName; BlobCache.EnsureInitialized(); /* * Mapper.CreateMap<Models.AccountModel, ViewModels.Settings.Profile> () * .ForMember(dest => dest.AccountId, opt => opt.MapFrom(src => src.Id)) * .ForMember(dest => dest.StreetAddress1, opt => opt.MapFrom(src => src.Address1)) * .ForMember(dest => dest.StreetAddress2, opt => opt.MapFrom(src => src.Address2)); */ }
public override void OnActivated(UIApplication application) { // Never call base here Debug.WriteLine("OnActivated"); BlobCache.EnsureInitialized(); if (Settings.Token != null) { Task.Run(async() => await Mvx.Resolve <ISignalRClient>().StartAsync()); } }
public MainPage() { InitializeComponent(); SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape; // Initialize Akavache BlobCache.ApplicationName = IdeaTrackr.App.ApplicationName; BlobCache.EnsureInitialized(); global::Xamarin.Forms.Forms.Init(); LoadApplication(new IdeaTrackr.App()); }
protected override void OnStart() { AppCenter.Start($"android={Constants.AppCenterKey};", typeof(Analytics), typeof(Crashes)); // Handle when your app starts BlobCache.EnsureInitialized(); #if DEBUG BlobCache.ApplicationName = "Tracked Dev"; #else BlobCache.ApplicationName = "Tracked"; #endif BlobCache.ForcedDateTimeKind = DateTimeKind.Utc; }
public PersistentBlobCache( string cacheDirectory = null, IFilesystemProvider filesystemProvider = null, IScheduler scheduler = null, Action <AsyncSubject <byte[]> > invalidateCallback = null) { BlobCache.EnsureInitialized(); this.filesystem = filesystemProvider ?? Locator.Current.GetService <IFilesystemProvider>(); if (this.filesystem == null) { throw new Exception("No IFilesystemProvider available. This should never happen, your DependencyResolver is broken"); } this.CacheDirectory = cacheDirectory ?? filesystem.GetDefaultRoamingCacheDirectory(); this.Scheduler = scheduler ?? BlobCache.TaskpoolScheduler; // Here, we're not actually caching the requests directly (i.e. as // byte[]s), but as the "replayed result of the request", in the // AsyncSubject - this makes the code infinitely simpler because // we don't have to keep a separate list of "in-flight reads" vs // "already completed and cached reads" memoizedRequests = new MemoizingMRUCache <string, AsyncSubject <byte[]> >( (x, c) => FetchOrWriteBlobFromDisk(x, c, false), 20, invalidateCallback); var cacheIndex = FetchOrWriteBlobFromDisk(BlobCacheIndexKey, null, true) .Catch(Observable.Return(new byte[0])) .Select(x => Encoding.UTF8.GetString(x, 0, x.Length).Split('\n') .SelectMany(ParseCacheIndexEntry) .ToDictionary(y => y.Key, y => y.Value)) .Select(x => new ConcurrentDictionary <string, CacheIndexEntry>(x)); cacheIndex.Subscribe(x => CacheIndex = x); flushThreadSubscription = Disposable.Empty; if (!ModeDetector.InUnitTestRunner()) { flushThreadSubscription = actionTaken .Where(_ => CacheIndex != null) .Throttle(TimeSpan.FromSeconds(30), Scheduler) .SelectMany(_ => FlushCacheIndex(true)) .Subscribe(_ => this.Log().Debug("Flushing cache")); } this.Log().Info("{0} entries in blob cache index", CacheIndex.Count); }
public CacheService() { BlobCache.ApplicationName = KeyValues.AppName; BlobCache.EnsureInitialized(); BlobCache.ForcedDateTimeKind = DateTimeKind.Utc; _blob = BlobCache.LocalMachine; _apiService = Locator.Current.GetService <IApiService>(); _blob.GetAllKeys().Subscribe(keys => { if (keys is null || !keys.Any()) { _blob.InsertObject(nameof(GitHubRepository), new List <GitHubRepository>()); } }); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); TabLayoutResource = Resource.Layout.tabs; ToolbarResource = Resource.Layout.toolbar; global::Xamarin.Forms.Forms.Init(this, bundle); AndroidAppLinks.Init(this); BlobCache.ApplicationName = "SimpleUITestApp"; BlobCache.EnsureInitialized(); Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); LoadApplication(App = new App()); }
protected override void OnResume() { base.OnResume(); BlobCache.ApplicationName = "FanReact"; BlobCache.EnsureInitialized(); ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => { var isOk = true; // If there are errors in the certificate chain, look at each error to determine the cause. if (sslPolicyErrors != SslPolicyErrors.None) { for (var i = 0; i < chain.ChainStatus.Length; i++) { if (chain.ChainStatus[i].Status != X509ChainStatusFlags.RevocationStatusUnknown) { chain.ChainPolicy.RevocationFlag = X509RevocationFlag.EntireChain; chain.ChainPolicy.RevocationMode = X509RevocationMode.Online; chain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 1, 0); chain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllFlags; var chainIsValid = chain.Build((X509Certificate2)certificate); if (!chainIsValid) { isOk = false; } } } } return(isOk); }; Forms.Init(this, new Bundle()); Application app = new App(new DroidDependencySetup()); LoadApplication(app); CheckUserAuth(); var pInfo = PackageManager.GetPackageInfo(PackageName, 0); var trackingService = Resolver.Resolve <IViewTrackingService>(); trackingService.InitializeTracking(pInfo.VersionName); }