Exemplo n.º 1
0
        protected override void OnStartup(object sender, StartupEventArgs e)
        {
            this.Log().Info("Espera is starting...");
            this.Log().Info("******************************");
            this.Log().Info("**                          **");
            this.Log().Info("**          Espera          **");
            this.Log().Info("**                          **");
            this.Log().Info("******************************");
            this.Log().Info("Application version: " + AppInfo.Version);
            this.Log().Info("OS Version: " + Environment.OSVersion.VersionString);
            this.Log().Info("Current culture: " + CultureInfo.InstalledUICulture.Name);
            this.Log().Info("This is a {0} application", AppInfo.IsPortable ? "portable" : "non-portable");

            Directory.CreateDirectory(AppInfo.ApplicationDataPath);

            if (AppInfo.IsPortable)
            {
                Directory.CreateDirectory(AppInfo.BlobCachePath);
                BlobCache.LocalMachine = new SQLitePersistentBlobCache(Path.Combine(AppInfo.BlobCachePath, "blobs.db"));
            }

            var newBlobCache = BlobCache.LocalMachine;

            if (AkavacheToSqlite3Migration.NeedsMigration(newBlobCache))
            {
                var oldBlobCache = new DeprecatedBlobCache(AppInfo.BlobCachePath);
                var migration    = new AkavacheToSqlite3Migration(oldBlobCache, newBlobCache);

                migration.Run();

                this.Log().Info("Removing all items from old BlobCache");
                oldBlobCache.InvalidateAll().Wait();

                this.Log().Info("Shutting down old BlobCache");
                oldBlobCache.Dispose();
                this.Log().Info("BlobCache shutdown finished");
            }

            this.SetupLager();

            this.SetupAnalyticsClient();

            this.SetupMobileApi();

            this.DisplayRootViewFor <ShellViewModel>();
        }
Exemplo n.º 2
0
        protected override void OnStartup(object sender, StartupEventArgs e)
        {
            this.Log().Info("Espera is starting...");
            this.Log().Info("******************************");
            this.Log().Info("**                          **");
            this.Log().Info("**          Espera          **");
            this.Log().Info("**                          **");
            this.Log().Info("******************************");
            this.Log().Info("Application version: " + AppInfo.Version);
            this.Log().Info("OS Version: " + Environment.OSVersion.VersionString);
            this.Log().Info("Current culture: " + CultureInfo.InstalledUICulture.Name);

            Directory.CreateDirectory(AppInfo.ApplicationRootPath);
            Directory.CreateDirectory(AppInfo.BlobCachePath);
            BlobCache.LocalMachine = new SQLitePersistentBlobCache(Path.Combine(AppInfo.BlobCachePath, "blobs.db"));

            var newBlobCache = BlobCache.LocalMachine;

            if (AkavacheToSqlite3Migration.NeedsMigration(newBlobCache))
            {
                var oldBlobCache = new DeprecatedBlobCache(AppInfo.BlobCachePath);
                var migration = new AkavacheToSqlite3Migration(oldBlobCache, newBlobCache);

                migration.Run();

                this.Log().Info("Removing all items from old BlobCache");
                oldBlobCache.InvalidateAll().Wait();

                this.Log().Info("Shutting down old BlobCache");
                oldBlobCache.Dispose();
                this.Log().Info("BlobCache shutdown finished");
            }

            this.SetupLager();

            this.SetupAnalyticsClient();

            this.SetupMobileApi();

            this.DisplayRootViewFor<ShellViewModel>();
        }