Example #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, sc2dsstatsContext context, ILoggerFactory loggerFactory)
        {
            CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;

            ApplicationLogging.LoggerFactory = loggerFactory;

            context.Database.Migrate();

            var path = ElectronService.GetPath().GetAwaiter().GetResult();

            DSData.Init(path);
            NameService.Init(context, path).GetAwaiter().GetResult();

            app.UseResponseCompression();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });
            WebPreferences wp = new WebPreferences();

            wp.NodeIntegration = false;

            Task.Run(async() => await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions()
            {
                AutoHideMenuBar = true,
                Width           = 1920,
                Height          = 1080,
                X = 0,
                Y = 0,
                WebPreferences = wp
            }));
        }
Example #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;

            DSdata.Init();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }


            // app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });

            if (Status.isFirstRun)
            {
                Task.Run(() => { app.ApplicationServices.GetService <StartupBackgroundService>().StartAsync(new System.Threading.CancellationToken()); });
            }
            Task.Run(() => { paxgame.Init(); });
            Task.Run(async() =>
            {
                await Electron.WindowManager.CreateWindowAsync();
                await ElectronService.Resize();
                //DSdata.DesktopUpdateAvailable = await ElectronService.CheckForUpdate();
                //DSdata.DesktopUpdateAvailable = await ElectronService.CheckForUpdateAndNotify();
            });
        }
 public DefaultViewModel(ElectronService electronService)
 {
     _electronService = electronService;
     Title            = "Hello from DotVVM!";
 }