コード例 #1
0
        private static Task OpenWindow(IBlazorDesktopConfiguration bdc)
        {
            return(Task.Run(async() =>
            {
                if (string.IsNullOrWhiteSpace(bdc.BrowserExecutablePath) || !File.Exists(bdc.BrowserExecutablePath))
                {
                    await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultChromiumRevision);
                }

                var browser = await Puppeteer.LaunchAsync(new LaunchOptions
                {
                    ExecutablePath = bdc.BrowserExecutablePath,
                    Headless = false,
                    Args = new[]
                    {
                        $"--app=http://localhost:{ApplicationPort}/",
                        $"--window-size={bdc.WindowWidth},{bdc.WindowHeight}",
                        "--allow-insecure-localhost",
                        "--disable-extensions"
                    }
                });
                browser.Closed += (sender, eventArgs) =>
                {
                    browser.Dispose();
                    Environment.Exit(0);
                };
            }));
        }
コード例 #2
0
 public BlazorDesktopConfigurationProvider(IBlazorDesktopConfiguration blazorDesktopConfiguration) =>
		public static void UseLocalBrowser(this IBlazorDesktopConfiguration config)
		{