/// <inheritdoc/> public WindowController(IChromelyWindow window, IChromelyNativeHost nativeHost, IChromelyConfiguration config, IChromelyRouteProvider routeProvider, IChromelyRequestHandler requestHandler, IChromelyRequestSchemeProvider requestSchemeProvider, ChromelyHandlersResolver handlersResolver) : base(window, nativeHost, config, routeProvider, requestHandler, handlersResolver) { // WindowController.NativeWindow _nativeHost.HostCreated += OnWindowCreated; _nativeHost.HostMoving += OnWindowMoving; _nativeHost.HostSizeChanged += OnWindowSizeChanged; _nativeHost.HostClose += OnWindowClose; _requestSchemeProvider = requestSchemeProvider; // Set CefBinariesDownloader var objList = _handlersResolver?.Invoke(typeof(ICefBinariesDownloader)); var tempLoader = objList?.FirstOrDefault() as ICefBinariesDownloader; if (tempLoader is not null) { _binariesDownloader = tempLoader; } }
private static int Main(string[] args) { CiTrace("Application", "Started"); // measure startup time (maybe including CEF download) _startupTimer = new Stopwatch(); _startupTimer.Start(); var core = typeof(ChromelyConfiguration).Assembly; CiTrace("Chromely.Core", core.GetName().Version.ToString()); CiTrace("Platform", ChromelyRuntime.Platform.ToString()); var appDirectory = AppDomain.CurrentDomain.BaseDirectory; CiTrace("AppDirectory", appDirectory); var startUrl = $"file:///{appDirectory}/index.html"; var windowStyle = new WindowCreationStyle(); windowStyle.WindowStyles = WindowStyles.WS_OVERLAPPEDWINDOW | WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CLIPSIBLINGS; windowStyle.WindowExStyles = WindowExStyles.WS_EX_APPWINDOW | WindowExStyles.WS_EX_WINDOWEDGE; var config = ChromelyConfiguration .Create() .WithDebuggingMode(true) .WithLoadingCefBinariesIfNotFound(true) .WithSilentCefBinariesLoading(true) .RegisterEventHandler <ConsoleMessageEventArgs>(CefEventKey.ConsoleMessage, OnWebBrowserConsoleMessage) .WithAppArgs(args) .WithHostBounds(1000, 600) .WithHostCustomStyle(windowStyle) //.WithHostFlag(HostFlagKey.CenterScreen, true | false - default true) //.WithHostFlag(HostFlagKey.Frameless, true | false - default false) //.WithHostFlag(HostFlagKey.KioskMode, true | false - default false) .WithHostFlag(HostFlagKey.NoResize, true) // - default false) .WithHostFlag(HostFlagKey.NoMinMaxBoxes, true) // - default false) .WithStartUrl(startUrl); CiTrace("Configuration", "Created"); try { using (_window = ChromelyWindow.Create(config)) { _window.RegisterEventHandler(CefEventKey.FrameLoadEnd, new ChromelyEventHandler <FrameLoadEndEventArgs>(CefEventKey.FrameLoadEnd, OnFrameLoaded)); CiTrace("Window", "Created"); var result = _window.Run(args); CiTrace("RunResult", result.ToString()); } } catch (Exception ex) { Console.WriteLine(ex); throw; } CiTrace("Application", "Done"); return(0); }
public DefaultLifeSpanHandler(IChromelyConfiguration config, IChromelyRequestHandler requestHandler, IChromelyRouteProvider routeProvider, IChromelyWindow window) { _config = config; _requestHandler = requestHandler; _routeProvider = routeProvider; _browser = window as ChromiumBrowser; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultRequestHandler"/> class. /// </summary> /// <param name="config">Instance of <see cref="IChromelyConfiguration"/>.</param> /// <param name="requestHandler">Instance of <see cref="IChromelyRequestHandler"/>.</param> /// <param name="routeProvider">Instance of <see cref="IChromelyRouteProvider"/>.</param> /// <param name="window">Instance of <see cref="IChromelyWindow"/>.</param> /// <param name="resourceRequestHandler">Instance of <see cref="CefResourceRequestHandler"/>.</param>> public DefaultRequestHandler(IChromelyConfiguration config, IChromelyRequestHandler requestHandler, IChromelyRouteProvider routeProvider, IChromelyWindow window, CefResourceRequestHandler?resourceRequestHandler = null) { _config = config; _requestHandler = requestHandler; _routeProvider = routeProvider; _browser = window as ChromiumBrowser; _resourceRequestHandler = resourceRequestHandler; }
public ChromelyWindowController(IChromelyWindow window, IChromelyNativeHost nativeHost, IChromelyConfiguration config, IChromelyRouteProvider routeProvider, IChromelyRequestHandler requestHandler, ChromelyHandlersResolver handlersResolver) { _window = window; _nativeHost = nativeHost; _config = config; _routeProvider = routeProvider; _requestHandler = requestHandler; _handlersResolver = handlersResolver; }
private static int Main(string[] args) { CiTrace("Application", "Started"); // measure startup time (maybe including CEF download) _startupTimer = new Stopwatch(); _startupTimer.Start(); var core = typeof(ChromelyConfiguration).Assembly; CiTrace("Chromely.Core", core.GetName().Version.ToString()); CiTrace("Platform", ChromelyRuntime.Platform.ToString()); var appDirectory = AppDomain.CurrentDomain.BaseDirectory; CiTrace("AppDirectory", appDirectory); var startUrl = $"file:///{appDirectory}/index.html"; var config = ChromelyConfiguration .Create() .WithDebuggingMode(true) .WithLoadingCefBinariesIfNotFound(true) .WithSilentCefBinariesLoading(true) //.WithFramelessHost() .RegisterEventHandler <ConsoleMessageEventArgs>(CefEventKey.ConsoleMessage, OnWebBrowserConsoleMessage) .WithAppArgs(args) .WithHostSize(1000, 600) .WithStartUrl(startUrl); CiTrace("Configuration", "Created"); try { using (_window = ChromelyWindow.Create(config)) { _window.RegisterEventHandler(CefEventKey.FrameLoadEnd, new ChromelyEventHandler <FrameLoadEndEventArgs>(CefEventKey.FrameLoadEnd, OnFrameLoaded)); _window.RegisterEventHandler(CefEventKey.BeforeClose, new ChromelyEventHandler <BeforeCloseEventArgs>(CefEventKey.BeforeClose, OnBeforeClose)); CiTrace("Window", "Created"); var result = _window.Run(args); CiTrace("RunResult", result.ToString()); } } catch (Exception ex) { Console.WriteLine(ex); throw; } CiTrace("Application", "Done"); return(0); }
public AppBuilder UseWindow <TService>(IChromelyWindow chromelyWindow = null) where TService : IChromelyWindow { if (chromelyWindow != null) { _chromelyWindow = chromelyWindow; } else { _chromelyUseWindowType = null; EnsureIsDerivedType(typeof(IChromelyWindow), typeof(TService)); _chromelyUseWindowType = typeof(TService); } return(this); }
public WindowController(IChromelyWindow window, IChromelyNativeHost nativeHost, IChromelyConfiguration config, IChromelyRouteProvider routeProvider, IChromelyRequestTaskRunner requestTaskRunner, IChromelyCommandTaskRunner commandTaskRunner, IChromelyRequestSchemeHandlerProvider requestSchemeHandlerProvider, ChromelyHandlersResolver handlersResolver) : base(window, nativeHost, config, routeProvider, requestTaskRunner, commandTaskRunner, handlersResolver) { // WindowController.NativeWindow _nativeHost.HostCreated += OnWindowCreated; _nativeHost.HostMoving += OnWindowMoving; _nativeHost.HostSizeChanged += OnWindowSizeChanged; _nativeHost.HostClose += OnWindowClose; _requestSchemeHandlerProvider = requestSchemeHandlerProvider; }
/// <inheritdoc/> public WindowController(IChromelyWindow window, IChromelyNativeHost nativeHost, IChromelyConfiguration config, IChromelyRouteProvider routeProvider, IChromelyRequestHandler requestHandler, IChromelyRequestSchemeProvider requestSchemeProvider, ICefDownloader binariesDownloader, ChromelyHandlersResolver handlersResolver) : base(window, nativeHost, config, routeProvider, requestHandler, handlersResolver) { // WindowController.NativeWindow _nativeHost.HostCreated += OnWindowCreated; _nativeHost.HostMoving += OnWindowMoving; _nativeHost.HostSizeChanged += OnWindowSizeChanged; _nativeHost.HostClose += OnWindowClose; _requestSchemeProvider = requestSchemeProvider; _binariesDownloader = binariesDownloader; }
protected virtual void Dispose(bool disposing) { if (_disposed) { return; } // If there are managed resources if (disposing) { } _nativeHost?.Dispose(); _window?.Dispose(); _nativeHost = null; _window = null; _disposed = true; }
/// <summary> Setup the chromely instance. </summary> /// <param name="args"> The arguments to pass in. </param> public void Setup(string[] args) { HostHelpers.SetupDefaultExceptionHandlers(); var config = ChromelyConfiguration .Create() .WithHostMode(WindowState.Normal) .WithHostTitle("chromely") .WithHostIconFile("chromely.ico") .WithAppArgs(args) .WithHostSize(1200, 700) .WithLogFile("logs\\chromely.cef_new.log") .WithStartUrl(StartUrl) .WithLogSeverity(LogSeverity.Info) .WithDefaultSubprocess() .UseDefaultLogger("logs\\chromely_new.log") .UseDefaultResourceSchemeHandler("local", string.Empty) .UseDefaultHttpSchemeHandler("http", "chromely.com") // The single process should only be used for debugging purpose. // For production, this should not be needed when the app is published and an cefglue_winapi_netcoredemo.exe // is created. #if DEBUG // Alternate approach for multi-process, is to add a subprocess application // .WithCustomSetting(CefSettingKeys.BrowserSubprocessPath, full_path_to_subprocess) .WithCustomSetting(CefSettingKeys.SingleProcess, true) #endif ; Window = ChromelyWindow.Create(config); // Register external url schemes Window.RegisterUrlScheme(new UrlScheme("https://github.com/chromelyapps/Chromely", true)); // Register current/local assembly Window.RegisterServiceAssembly(Assembly.GetExecutingAssembly()); // Scan assemblies for Controller routes Window.ScanAssemblies(); }
public ChromelyLifeSpanHandler(IChromelyConfiguration config, IChromelyCommandTaskRunner commandTaskRunner, IChromelyWindow window) : base(config, commandTaskRunner, window) { }
public ChromelyLifeSpanHandler(IChromelyConfiguration config, IChromelyRequestHandler requestHandler, IChromelyRouteProvider routeProvider, IChromelyWindow window) : base(config, requestHandler, routeProvider, window) { }
public WindowController(IChromelyConfiguration config, IChromelyWindow window) { _config = config; _window = window; }
public RekoBrowserHostController(IChromelyWindow window, IChromelyNativeHost nativeHost, IChromelyConfiguration config, IChromelyRouteProvider routeProvider, IChromelyRequestTaskRunner requestTaskRunner, IChromelyCommandTaskRunner commandTaskRunner, IChromelyRequestSchemeProvider requestSchemeProvider, ChromelyHandlersResolver handlersResolver) : base(window, nativeHost, config, routeProvider, requestTaskRunner, commandTaskRunner, requestSchemeProvider, handlersResolver) { }
public ChromelyRequestHandler(IChromelyConfiguration config, IChromelyRequestHandler requestHandler, IChromelyRouteProvider routeProvider, IChromelyWindow window, CefResourceRequestHandler resourceRequestHandler = null) : base(config, requestHandler, routeProvider, window, resourceRequestHandler) { }
/// <summary> /// Initializes a new instance of the <see cref="DefaultRequestHandler"/> class. /// </summary> public DefaultRequestHandler(IChromelyConfiguration config, IChromelyCommandTaskRunner commandTaskRunner, IChromelyWindow window, CefResourceRequestHandler resourceRequestHandler = null) { _config = config; _commandTaskRunner = commandTaskRunner; _browser = window as ChromiumBrowser; _resourceRequestHandler = resourceRequestHandler; }
public static int Main(string[] args) { var appDir = AppDomain.CurrentDomain.BaseDirectory; const string startUrl = "local://dist/index.html"; var config = ChromelyConfiguration .Create() .WithHostMode(WindowState.Normal) .WithHostTitle("PayDemo") // .WithHostIconFile("") .WithAppArgs(args) .WithDebuggingMode(true) .WithHostBounds(1200, 900) .WithLogFile("logs\\chromely.cef_new.log") .WithStartUrl(startUrl) .WithLogSeverity(LogSeverity.Info) .UseDefaultLogger("logs\\chromely_new.log") .UseDefaultResourceSchemeHandler("local", string.Empty) .UseDefaultHttpSchemeHandler("http", "chromely.com") .WithHostFlag(HostFlagKey.CenterScreen, true) .WithHostFlag(HostFlagKey.NoResize, true) ; switch (Environment.OSVersion.Platform) { case PlatformID.Win32S: case PlatformID.Win32Windows: case PlatformID.Win32NT: case PlatformID.WinCE: case PlatformID.Xbox: config.UseDefaultSubprocess(); break; case PlatformID.Unix: config .UseDefaultSubprocess(false) .WithCustomSetting(CefSettingKeys.BrowserSubprocessPath, Path.Combine(appDir, "PayDemo.Subprocess")) .WithCustomSetting(CefSettingKeys.MultiThreadedMessageLoop, false) .WithCustomSetting(CefSettingKeys.SingleProcess, true) .WithCustomSetting(CefSettingKeys.NoSandbox, false) .WithCommandLineArg("disable-gpu", "1") .WithCommandLineArg("disable-gpu-compositing", "1") .WithCommandLineArg("disable-smooth-scrolling", "1") .WithCommandLineArg("no-sandbox", "1") ; break; case PlatformID.MacOSX: break; default: throw new ArgumentOutOfRangeException(); } using (var window = ChromelyWindow.Create(config)) { MainWindow = window; // MainWindow.RegisterUrlScheme(new UrlScheme("",true)); MainWindow.RegisterServiceAssembly(Assembly.GetExecutingAssembly()); MainWindow.ScanAssemblies(); return(MainWindow.Run(args)); } }
public WinApiWindowService(IChromelyWindow window) { _window = window; }
public DefaultLifeSpanHandler(IChromelyConfiguration config, IChromelyCommandTaskRunner commandTaskRunner, IChromelyWindow window) { _config = config; _commandTaskRunner = commandTaskRunner; _browser = window as ChromiumBrowser; }
public ChromelyRequestHandler(IChromelyConfiguration config, IChromelyCommandTaskRunner commandTaskRunner, IChromelyWindow window, CefResourceRequestHandler resourceRequestHandler = null) : base(config, commandTaskRunner, window, resourceRequestHandler) { }
public ChromelyLoadHandler(IChromelyConfiguration config, IChromelyWindow window) : base(config, window) { }
/// <summary> /// Initializes a new instance of the <see cref="DefaultLoadHandler"/> class. /// </summary> public DefaultLoadHandler(IChromelyConfiguration config, IChromelyWindow window) { _config = config; _browser = window as ChromiumBrowser; }