static int Main(string[] args) { try { HostHelpers.SetupDefaultExceptionHandlers(); string appDirectory = AppDomain.CurrentDomain.BaseDirectory; string startUrl = string.Format("file:///{0}Views/chromely.html", appDirectory); ChromelyConfiguration config = ChromelyConfiguration .Create() .WithCefTitle("chromely") .WithCefIconFile("chromely.ico") .WithCefAppArgs(args) .WithCefHostSize(1200, 900) .WithCefLogFile("logs\\chromely.cef_new.log") .WithCefStartUrl(startUrl) .WithCefLogSeverity(LogSeverity.Info) .UseDefaultLogger("logs\\chromely_new.log", true) .RegisterSchemeHandler("http", "chromely.com", new CefGlueSchemeHandlerFactory()); using (var app = new CefGlueBrowserHost(config)) { // Register external url schems app.RegisterExternalUrlScheme(new UrlScheme("https://github.com/mattkol/Chromely", true)); // Register service assemblies app.RegisterServiceAssembly(Assembly.GetExecutingAssembly()); // Note ensure external is valid folder. // Uncomment to refgister external restful service dlls string serviceAssemblyFile = @"C:\ChromelyDlls\Chromely.Service.Demo.dll"; app.RegisterServiceAssembly(serviceAssemblyFile); // Scan assemblies for Controller routes app.ScanAssemblies(); return(app.Run(args)); } } catch (Exception exception) { Log.Error(exception); } return(0); }
static int Main(string[] args) { try { HostHelpers.SetupDefaultExceptionHandlers(); /* * Start url (load html) options: */ // Options 1 - real standard urls // string startUrl = "https://google.com"; // Options 2 - using local resource file handling with default/custom local scheme handler // Requires - (sample) UseDefaultResourceSchemeHandler("local", string.Empty) // or register new resource scheme handler - RegisterSchemeHandler("local", string.Empty, new CustomResourceHandler()) // string startUrl = "local://app/chromely.html"; // Options 3 - using file protocol - using default/custom scheme handler for Ajax/Http requests // Requires - (sample) UseDefaultResourceSchemeHandler("local", string.Empty) // or register new resource handler - RegisterSchemeHandler("local", string.Empty, new CustomResourceHandler()) // Requires - (sample) UseDefaultHttpSchemeHandler("http", "chromely.com") // or register new http scheme handler - RegisterSchemeHandler("http", "test.com", new CustomHttpHandler()) string appDirectory = AppDomain.CurrentDomain.BaseDirectory; string startUrl = $"file:///{appDirectory}app/chromely.html"; ChromelyConfiguration config = ChromelyConfiguration .Create() .WithHostTitle("chromely") .WithHostIconFile("chromely.ico") .WithAppArgs(args) .WithHostSize(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") // Set multi-threaded_message_loop false // only supported on windows .WithCustomSetting(CefSettingKeys.MultiThreadedMessageLoop, false) .WithCustomSetting(CefSettingKeys.SingleProcess, true) .WithCommandLineArg("disable-gpu", "1") .WithCommandLineArg("disable-gpu-compositing", "1") .WithCommandLineArg("disable-smooth-scrolling", "1") .WithCommandLineArg("no-sandbox", "1"); using (var app = new CefGlueBrowserHost(config)) { // Register external url schems app.RegisterUrlScheme(new UrlScheme("https://github.com/mattkol/Chromely", true)); /* * Register service assemblies * Uncomment relevant part to register assemblies */ // 1. Register current/local assembly: app.RegisterServiceAssembly(Assembly.GetExecutingAssembly()); // 2. Register external assembly with file name: // string serviceAssemblyFile = @"C:\ChromelyDlls\Chromely.Service.Demo.dll"; // app.RegisterServiceAssembly(serviceAssemblyFile); // 3. Register external assemblies with list of filenames: // string serviceAssemblyFile1 = @"C:\ChromelyDlls\Chromely.Service.Demo.dll"; // List<string> filenames = new List<string>(); // filenames.Add(serviceAssemblyFile1); // app.RegisterServiceAssemblies(filenames); // 4. Register external assemblies directory: // string serviceAssembliesFolder = @"C:\ChromelyDlls"; // app.RegisterServiceAssemblies(serviceAssembliesFolder); // Scan assemblies for Controller routes app.ScanAssemblies(); return(app.Run(args)); } } catch (Exception exception) { Log.Error(exception); } return(0); }
static int Main(string[] args) { try { HostHelpers.SetupDefaultExceptionHandlers(); string appDirectory = AppDomain.CurrentDomain.BaseDirectory; string startUrl = string.Format("file:///{0}Views/chromely.html", appDirectory); ChromelyConfiguration config = ChromelyConfiguration .Create() .WithCefTitle("chromely") .WithCefIconFile("chromely.ico") .WithCefAppArgs(args) .WithCefHostSize(1200, 900) .WithCefLogFile("logs\\chromely.cef_new.log") .WithCefStartUrl(startUrl) .WithCefLogSeverity(LogSeverity.Info) .UseDefaultLogger("logs\\chromely_new.log", true) .RegisterSchemeHandler("http", "chromely.com", new CefGlueSchemeHandlerFactory()); using (var app = new CefGlueBrowserHost(config)) { // Register external url schems app.RegisterUrlScheme(new UrlScheme("https://github.com/mattkol/Chromely", true)); /* * Register service assemblies * Uncomment relevant part to register assemblies */ // 1. Register current/local assembly: app.RegisterServiceAssembly(Assembly.GetExecutingAssembly()); // 2. Register external assembly with file name: //string serviceAssemblyFile = @"C:\ChromelyDlls\Chromely.Service.Demo.dll"; //app.RegisterServiceAssembly(serviceAssemblyFile); // 3. Register external assemblies with list of filenames: //string serviceAssemblyFile1 = @"C:\ChromelyDlls\Chromely.Service.Demo.dll"; //List<string> filenames = new List<string>(); //filenames.Add(serviceAssemblyFile1); //app.RegisterServiceAssemblies(filenames); // 4. Register external assemblies directory: string serviceAssembliesFolder = @"C:\ChromelyDlls"; app.RegisterServiceAssemblies(serviceAssembliesFolder); // Scan assemblies for Controller routes app.ScanAssemblies(); return(app.Run(args)); } } catch (Exception exception) { Log.Error(exception); } return(0); }