コード例 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public async void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            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");
            });

            // --- Create the Electon shell's main application window
            await AppWindow.Create();
        }
コード例 #2
0
        /// <summary>
        /// Factory method to create the singleton instance
        /// </summary>
        /// <returns></returns>
        public static async Task Create()
        {
            if (Instance != null)
            {
                return;
            }
            var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
            {
                Title  = "ZX Spectrum IDE",
                Width  = 1152,
                Height = 864,
                Show   = true,
                Frame  = false
            });

            Instance = new AppWindow(browserWindow);
            browserWindow.OnReadyToShow += () =>
            {
                Console.WriteLine("OnReadyToShow invoked");
                browserWindow.Show();
            };
            browserWindow.OnFocus      += () => StateStore.Dispatch(new AppGotFocusAction());
            browserWindow.OnBlur       += () => StateStore.Dispatch(new AppLostFocusAction());
            browserWindow.OnRestore    += () => StateStore.Dispatch(new RestoreWindowAction());
            browserWindow.OnMaximize   += () => StateStore.Dispatch(new MaximizeWindowAction());
            browserWindow.OnMinimize   += () => StateStore.Dispatch(new MinimizeWindowAction());
            browserWindow.OnUnmaximize += () => StateStore.Dispatch(new RestoreWindowAction());
        }