Пример #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IMemoryCache cache)
        {
            //Need to initialize the list of cache
            TrakkerCache.InitializeCacheList();

//            Console.WriteLine(Configuration.GetConnectionString("DefaultConnection"));
//            string cs = Configuration["ConnectionStrings:DefaultConnection"];

            var loadDataTask = StartUpTasks.TasksOnStartUp(Configuration, cache);

            loadDataTask.Wait();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var supportedCultures = new List <CultureInfo>
            {
                new CultureInfo("en-GB"),
                new CultureInfo("en-US"),
                new CultureInfo("en"),
                new CultureInfo("fr-FR"),
                new CultureInfo("fr"),
                new CultureInfo("ml-IN"),
                new CultureInfo("hi-IN")
            };

            var options = new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture("en-US"),
                SupportedCultures     = supportedCultures,
                SupportedUICultures   = supportedCultures,
            };

            app.UseRequestLocalization(options);

            loggerFactory.AddDebug();

            app.UseCors("SiteCorsPolicy");

            app.UseAuthentication();
            app.UseMvc();
        }
Пример #2
0
    protected override void OnResume()
    {
        base.OnResume();

        Task tmpStartupWork = new Task(() =>
        {
            Log.Debug(TAG, "Performing some startup work that takes a bit of time.");
            StartUpTasks.InitializeDatabaseCreation();
            Log.Debug(TAG, "Working in the background - important stuff.");
        });

        tmpStartupWork.ContinueWith(inT =>
        {
            Log.Debug(TAG, "Work is finished - start MainActivity.");
            StartActivity(new Intent(Application.Context, typeof(MainActivity)));
        }, TaskScheduler.FromCurrentSynchronizationContext());

        tmpStartupWork.Start();
    }