internal Browser(IChannelOwner parent, string guid, BrowserInitializer initializer) : base(parent, guid) { Channel = new BrowserChannel(guid, parent.Connection, this); IsConnected = true; Channel.Closed += (sender, e) => DidClose(); _initializer = initializer; }
internal Browser(ConnectionScope scope, string guid, BrowserInitializer initializer) { _scope = scope.CreateChild(guid); _channel = new BrowserChannel(guid, scope, this); IsConnected = true; _channel.Closed += (sender, e) => { IsConnected = false; _isClosedOrClosing = true; Disconnected?.Invoke(this, EventArgs.Empty); _scope.Dispose(); _closedTcs.TrySetResult(true); }; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, BrowserChannel browserChannel, MessageBusInteractor messageBusInteractor) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); } app.UseCors(MyAllowSpecificOrigins); app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapHub <SignalrHub>("/signalr"); endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); }); app.UseSpa(spa => { if (env.IsDevelopment()) { spa.Options.SourcePath = "../../frontend"; spa.UseProxyToSpaDevelopmentServer("http://localhost:3000"); //spa.UseReactDevelopmentServer(npmScript: "start"); } }); // Open the Electron-Window here // Task.Run(async () => await Electron.WindowManager.CreateWindowAsync( // new BrowserWindowOptions // { // Width = 1260, // Height = 1200, // })); }
/// <inheritdoc/> public async Task <IBrowser> LaunchAsync( bool?headless = default, BrowserChannel channel = default, string executablePath = default, IEnumerable <string> args = default, Proxy proxy = default, string downloadsPath = default, bool?chromiumSandbox = default, IEnumerable <KeyValuePair <string, object> > firefoxUserPrefs = default, bool?handleSIGINT = default, bool?handleSIGTERM = default, bool?handleSIGHUP = default, float?timeout = default, IEnumerable <KeyValuePair <string, string> > env = default, bool?devtools = default, float?slowMo = default, IEnumerable <string> ignoreDefaultArgs = default, bool?ignoreAllDefaultArgs = default) => (await _channel.LaunchAsync( headless, channel, executablePath, args, proxy, downloadsPath, chromiumSandbox, firefoxUserPrefs, handleSIGINT, handleSIGTERM, handleSIGHUP, timeout, env, devtools, slowMo, ignoreDefaultArgs, ignoreAllDefaultArgs).ConfigureAwait(false)).Object;
/// <inheritdoc/> public async Task <IBrowserContext> LaunchPersistentContextAsync( string userDataDir, bool?headless = default, BrowserChannel channel = default, string executablePath = default, IEnumerable <string> args = default, Proxy proxy = default, string downloadsPath = default, bool?chromiumSandbox = default, bool?handleSIGINT = default, bool?handleSIGTERM = default, bool?handleSIGHUP = default, float?timeout = default, IEnumerable <KeyValuePair <string, string> > env = default, bool?devtools = default, float?slowMo = default, bool?acceptDownloads = default, bool?ignoreHTTPSErrors = default, bool?bypassCSP = default, ViewportSize viewportSize = default, ScreenSize screenSize = default, string userAgent = default, float?deviceScaleFactor = default, bool?isMobile = default, bool?hasTouch = default, bool?javaScriptEnabled = default, string timezoneId = default, Geolocation geolocation = default, string locale = default, IEnumerable <string> permissions = default, IEnumerable <KeyValuePair <string, string> > extraHTTPHeaders = default, bool?offline = default, HttpCredentials httpCredentials = default, ColorScheme colorScheme = default, string recordHarPath = default, bool?recordHarOmitContent = default, string recordVideoDir = default, RecordVideoSize recordVideoSize = default, IEnumerable <string> ignoreDefaultArgs = default, bool?ignoreAllDefaultArgs = default) => (await _channel.LaunchPersistentContextAsync( userDataDir, headless, channel, executablePath, args, proxy, downloadsPath, chromiumSandbox, handleSIGINT, handleSIGTERM, handleSIGHUP, timeout, env, devtools, slowMo, acceptDownloads, ignoreHTTPSErrors, bypassCSP, viewportSize, screenSize, userAgent, deviceScaleFactor, isMobile, hasTouch, javaScriptEnabled, timezoneId, geolocation, locale, permissions, extraHTTPHeaders, offline, httpCredentials, colorScheme, recordHarPath, recordHarOmitContent, recordVideoDir, recordVideoSize, ignoreDefaultArgs, ignoreAllDefaultArgs).ConfigureAwait(false)).Object;
public Browser(ConnectionScope scope, string guid, BrowserInitializer initializer) { _scope = scope; _channel = new BrowserChannel(guid, scope, this); }