Beispiel #1
0
 public StorageService()
 {
     BlobCache.ApplicationName = "xam_tweet";
     BlobCache.EnsureInitialized();
     BlobCache.ForcedDateTimeKind = DateTimeKind.Utc;
     blob = BlobCache.LocalMachine;
 }
Beispiel #2
0
        public AkavacheContext()
        {
            BlobCache.ApplicationName = "com.rubit0.YoApp";
            BlobCache.EnsureInitialized();

            _blobCache = BlobCache.UserAccount;
        }
Beispiel #3
0
        public AkavacheContext(IServiceSettings serviceSettings)
        {
            BlobCache.ApplicationName = serviceSettings.ServiceId;
            BlobCache.EnsureInitialized();

            _blobCache = BlobCache.UserAccount;
        }
Beispiel #4
0
 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 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);
        }
Beispiel #6
0
        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;
        }
Beispiel #7
0
        protected override void OnExit(object sender, EventArgs e)
        {
            this.Log().Info("Starting Espera shutdown");

            this.Log().Info("Shutting down the library");
            Locator.Current.GetService <Library>().Dispose();

            this.Log().Info("Shutting down BlobCaches");
            BlobCache.Shutdown().Wait();
            var requestCache = Locator.Current.GetService <IBlobCache>(BlobCacheKeys.RequestCacheContract);

            requestCache.InvalidateAll().Wait();
            requestCache.Dispose();
            requestCache.Shutdown.Wait();

            this.Log().Info("Shutting down NLog");
            NLog.LogManager.Shutdown();

            if (this.mobileApi != null)
            {
                this.Log().Info("Shutting down mobile API");
                this.mobileApi.Dispose();
            }

            this.Log().Info("Shutting down analytics client");
            AnalyticsClient.Instance.Dispose();

            this.Log().Info("Shutdown finished");
        }
        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>();
        }
Beispiel #9
0
        protected override void OnStart()
        {
            base.OnStart();

            BlobCache.ApplicationName = "TMTK";
            BlobCache.EnsureInitialized();
        }
Beispiel #10
0
        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>());
            });
        }
Beispiel #11
0
        protected override async void OnExit(ExitEventArgs e)
        {
            base.OnExit(e);

            AudioPlayer.Instance.Dispose();
            await BlobCache.Shutdown();
        }
Beispiel #12
0
        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 void Cleanup_Akavache()
 {
     BlobCache.Secure.InvalidateAll();
     BlobCache.UserAccount.InvalidateAll();
     BlobCache.LocalMachine.InvalidateAll();
     BlobCache.Shutdown().Wait();
 }
Beispiel #14
0
        public App()
        {
            Directory.CreateDirectory(AppDataFolderPath);

            this.Events().Exit
            .SelectMany(_ => Observable.FromAsync(() => BlobCache.Shutdown()))
            .Subscribe();
        }
Beispiel #15
0
        public void ConfigureAkavache()
        {
            BlobCache.ApplicationName = "ReactiveReaderApp";
            BlobCache.EnsureInitialized();

            Locator.CurrentMutable.RegisterConstant(BlobCache.UserAccount, typeof(IBlobCache));
            Locator.CurrentMutable.RegisterConstant(BlobCache.Secure, typeof(ISecureBlobCache));
        }
Beispiel #16
0
        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 OnActivityCreated(Activity activity, Bundle savedInstanceState)
 {
     CrossCurrentActivity.Current.Activity = activity;
     global::Xamarin.Forms.Forms.Init(activity, savedInstanceState);
     BlobCache.ApplicationName = "MyExpenses";
     BlobCache.EnsureInitialized();
     reportDatabase = new ReportDatabase();
 }
Beispiel #18
0
        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();
        }
Beispiel #20
0
 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();
 }
Beispiel #21
0
 public static void Initialize()
 {
     BlobCache.ApplicationName = "MahTestApp";
     BlobCache.EnsureInitialized();
     MvxSimpleIoCContainer.Initialize();
     Mvx.RegisterSingleton <IBlobCache>(() => BlobCache.LocalMachine);
     Mvx.RegisterType <IPlatform, ApplePlatform> ();
     Mvx.RegisterType <ISettings, AppleSettings> ();
 }
Beispiel #22
0
 protected override void OnSleep()
 {
     BlobCache.Shutdown().Wait();
     MessagingCenter.Unsubscribe <ILoginViewModel, bool>(this, "LoginStatus");
     MessagingCenter.Unsubscribe <ILogoutPage>(this, "LogMeOut");
     MessagingCenter.Unsubscribe <ITermsPage>(this, "mTermsAgreed");
     CrossConnectivity.Current.ConnectivityChanged -= ConnectionError;
     // Handle when your app sleeps
 }
        static MyPersistentBlobCache SetupCache(string cacheDirectory)
        {
            BlobCache.EnsureInitialized();

            var fixture = new MyPersistentBlobCache(cacheDirectory);

            // ensuring we are working with a clear cache
            fixture.InvalidateAll();
            return(fixture);
        }
Beispiel #24
0
        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();
        }
Beispiel #25
0
        public App()
        {
            BlobCache.ApplicationName = "simsoft";
            BlobCache.EnsureInitialized();
            InitializeComponent();
            SetUpIOC();
            var rootPage = FreshMvvm.FreshPageModelResolver.ResolvePageModel <PageModels.LoginPageModel>();

            MainPage = new FreshMvvm.FreshNavigationContainer(rootPage);
            //Navigation.initTabsSellBL();
        }
Beispiel #26
0
 public App()
 {
     BlobCache.ApplicationName = "be4care";
     BlobCache.EnsureInitialized();
     InitializeComponent();
     SetUpIOC();
     Device.BeginInvokeOnMainThread(() =>
     {
         var rootPage = FreshMvvm.FreshPageModelResolver.ResolvePageModel <PageModels.checkLoginPageModel>();
         MainPage     = new FreshMvvm.FreshNavigationContainer(rootPage);
     });
 }
Beispiel #27
0
        public MainPage()
        {
            InitializeComponent();
            SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;

            // Initialize Akavache
            BlobCache.ApplicationName = IdeaTrackr.App.ApplicationName;
            BlobCache.EnsureInitialized();

            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new IdeaTrackr.App());
        }
        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));
             */
        }
Beispiel #29
0
 public DatabaseServices()
 {
     try
     {
         BlobCache.ApplicationName = "BarelandsFarm";
         BlobCache.EnsureInitialized();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
Beispiel #30
0
        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());
            }
        }