Ejemplo n.º 1
0
        public int Run(CefConfig config)
        {
            var res         = Instance.GetScreenResolution();
            var scaleFactor = GetScalingFactor(GetDC(IntPtr.Zero));

            config.Width  = (int)(config.Width > 0 ? config.Width * scaleFactor : res.Width * .75);
            config.Height = (int)(config.Height > 0 ? config.Height * scaleFactor : res.Height * .75);

            if (config.HideConsoleWindow)
            {
                Instance.HideConsoleWindow();
            }

            var factory = WinapiHostFactory.Init(config.Icon);

            using (var window = factory.CreateWindow(
                       () => new CefGlueHost(config),
                       config.WindowTitle,
                       constructionParams: new FrameWindowConstructionParams()))
            {
                window.SetSize(config.Width, config.Height);
                if (config.CenterToScreen)
                {
                    window.CenterToScreen();
                }
                else if (config.X != null || config.Y != null)
                {
                    window.SetPosition(config.X.GetValueOrDefault(), config.Y.GetValueOrDefault());
                }
                window.Show();

                //startTask.Wait();
                return(new EventLoop().Run(window));
            }
        }
Ejemplo n.º 2
0
        static int Main(string[] args)
        {
            try
            {
                HostHelpers.SetupDefaultExceptionHandlers();

                string startUrl = "local://app/main.html";

                ChromelyConfiguration config = ChromelyConfiguration
                                               .Create()
                                               .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")
                                               .WithDebuggingMode(true)

                                               // 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.

                                               // Alternate approach for multi-process, is to add a subprocess application
                                               // .WithCustomSetting(CefSettingKeys.BrowserSubprocessPath, full_path_to_subprocess)
                                               .WithCustomSetting(CefSettingKeys.SingleProcess, true);

                var factory = WinapiHostFactory.Init("GraphIcon.ico");
                using (var window = factory.CreateWindow(
                           () => new CefGlueBrowserHost(config),
                           "RPGCore Editor",
                           constructionParams: new FrameWindowConstructionParams()))
                {
                    // Register external url schems
                    window.RegisterUrlScheme(new UrlScheme("https://github.com/mattkol/Chromely", true));

                    // Register current/local assembly:
                    window.RegisterServiceAssembly(Assembly.GetExecutingAssembly());

                    // Register external assemblies directory:
                    string serviceAssembliesFolder = @"C:\ChromelyDlls";
                    window.RegisterServiceAssemblies(serviceAssembliesFolder);

                    // Scan assemblies for Controller routes
                    window.ScanAssemblies();

                    window.SetSize(config.HostWidth, config.HostHeight);
                    window.CenterToScreen();
                    window.Show();
                    return(new EventLoop().Run(window));
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }

            return(0);
        }
Ejemplo n.º 3
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()
                                               .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 CefSharpSchemeHandlerFactory())
                                               .RegisterJsHandler("boundControllerAsync", new CefSharpBoundObject(), null, true);

                var factory = WinapiHostFactory.Init("chromely.ico");
                using (var window = factory.CreateWindow(() => new CefSharpBrowserHost(config),
                                                         "chromely", constructionParams: new FrameWindowConstructionParams()))
                {
                    // Register external url schems
                    window.RegisterExternalUrlScheme(new UrlScheme("https://github.com/mattkol/Chromely", true));

                    // Register service assemblies
                    window.RegisterServiceAssembly(Assembly.GetExecutingAssembly());

                    // Note ensure external is valid folder.
                    // Uncomment to refgister external restful service dlls
                    string serviceAssemblyFile = @"C:\ChromelyDlls\Chromely.Service.Demo.dll";
                    window.RegisterServiceAssembly(serviceAssemblyFile);

                    // Scan assembly
                    window.ScanAssemblies();

                    window.SetSize(config.CefHostWidth, config.CefHostHeight);
                    window.CenterToScreen();
                    window.Show();
                    return(new EventLoop().Run(window));
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }

            return(0);
        }
Ejemplo n.º 4
0
        static int Main(string[] args)
        {
            string startUrl = "https://www.google.com/";

            ChromelyConfiguration config = ChromelyConfiguration.Create().WithAppArgs(args).WithHostSize(1000, 600).WithCustomSetting(CefSettingKeys.SingleProcess, true).WithStartUrl(startUrl);

            WindowFactory factory = WinapiHostFactory.Init();

            using (CefGlueBrowserHost window = factory.CreateWindow(() => new CefGlueBrowserHost(config),
                                                                    "chromely", constructionParams: new FrameWindowConstructionParams())) {
                window.SetSize(config.HostWidth, config.HostHeight);
                window.CenterToScreen();
                window.Show();
                return(new EventLoop().Run(window));
            }
        }
Ejemplo n.º 5
0
        static int Main(string[] args)
        {
            HostHelpers.SetupDefaultExceptionHandlers();

            var startUrl = $"http://blaster.local/";
            //var startUrl = "http://localhost:8080/index.html";

            ChromelyConfiguration config = ChromelyConfiguration
                                           .Create()
                                           .RegisterSchemeHandler("http", "blaster.local", new BlasterSchemeHandlerFactory("http://blaster.local/", "_dist/"))
                                           .WithAppArgs(args)

                                           .WithHostSize(1000, 600)
                                           //.WithDependencyCheck(true)
                                           // The single process should only be used for debugging purpose.
                                           // For production, this should not be needed when the app is published

                                           // Alternate approach for multi-process, is to add a subprocess application
                                           //.WithCustomSetting(CefSettingKeys.BrowserSubprocessPath, path_to_sunprocess)
                                           .RegisterCustomHandler(CefHandlerKey.LifeSpanHandler, typeof(BlasterLifeSpanHandler))
                                           .WithCustomSetting(CefSettingKeys.SingleProcess, true)
                                           .WithStartUrl(startUrl);

            var factory = WinapiHostFactory.Init();

            using (var window = factory.CreateWindow(() => new CefGlueBrowserHost(config),
                                                     "baster", constructionParams: new FrameWindowConstructionParams()))
            {
                window.RegisterSchemeHandlers();

                //window.RegisterUrlScheme(new UrlScheme("https://github.com/mattkol/Chromely", true));
                //window.RegisterServiceAssembly(Assembly.GetExecutingAssembly());

                window.SetSize(config.HostWidth, config.HostHeight);
                window.CenterToScreen();
                window.Show();
                return(new EventLoop().Run(window));
            }
        }
        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()
                                               .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")

                                               // 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.

                                               // Alternate approach for multi-process, is to add a subprocess application
                                               // .WithCustomSetting(CefSettingKeys.BrowserSubprocessPath, full_path_to_subprocess)
                                               .WithCustomSetting(CefSettingKeys.SingleProcess, true);

                var factory = WinapiHostFactory.Init("chromely.ico");
                using (var window = factory.CreateWindow(
                           () => new CefGlueBrowserHost(config),
                           "chromely",
                           constructionParams: new FrameWindowConstructionParams()))
                {
                    // Register external url schems
                    window.RegisterUrlScheme(new UrlScheme("https://github.com/chromelyapps/Chromely", true));

                    // window.RegisterUrlScheme(new UrlScheme("https://google.com", true));

                    /*
                     * Register service assemblies
                     * Uncomment relevant part to register assemblies
                     */

                    // 1. Register current/local assembly:
                    window.RegisterServiceAssembly(Assembly.GetExecutingAssembly());

                    // 2. Register external assembly with file name:
                    // string serviceAssemblyFile = @"C:\ChromelyDlls\Chromely.Service.Demo.dll";
                    // string serviceAssemblyFile = @"Chromely.Service.Demo.dll";
                    // window.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);
                    // window.RegisterServiceAssemblies(filenames);

                    // 4. Register external assemblies directory:
                    string serviceAssembliesFolder = @"C:\ChromelyDlls";
                    window.RegisterServiceAssemblies(serviceAssembliesFolder);

                    // Scan assemblies for Controller routes
                    window.ScanAssemblies();

                    window.SetSize(config.HostWidth, config.HostHeight);
                    window.CenterToScreen();
                    window.Show();
                    return(new EventLoop().Run(window));
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }

            return(0);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// The main.
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        static int Main(string[] args)
        {
            try
            {
                HostHelpers.SetupDefaultExceptionHandlers();

                string startUrl = "local://dist/index.html";

                ChromelyConfiguration config = ChromelyConfiguration
                                               .Create()
                                               .WithAppArgs(args)
                                               .WithHostSize(1200, 900)
                                               .WithLogFile("logs\\chromely.cef_new.log")
                                               .WithStartUrl(startUrl)
                                               .WithLogSeverity(LogSeverity.Info)
                                               .UseDefaultLogger()
                                               .UseDefaultResourceSchemeHandler("local", string.Empty)
                                               .UseDefaultHttpSchemeHandler("http", "chromely.com")
                                               .UseDefautJsHandler("boundControllerAsync", true);

                var factory = WinapiHostFactory.Init("chromely.ico");
                using (var window = factory.CreateWindow(
                           () => new CefSharpBrowserHost(config),
                           "chromely",
                           constructionParams: new FrameWindowConstructionParams()))
                {
                    // Register external url schems
                    window.RegisterUrlScheme(new UrlScheme("https://github.com/mattkol/Chromely", true));

                    /*
                     * Register service assemblies
                     * Uncomment relevant part to register assemblies
                     */

                    // 1. Register current/local assembly:
                    window.RegisterServiceAssembly(Assembly.GetExecutingAssembly());

                    // 2. Register external assembly with file name:
                    // string serviceAssemblyFile = @"C:\ChromelyDlls\Chromely.Service.Demo.dll";
                    // window.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);
                    // window.RegisterServiceAssemblies(filenames);

                    // 4. Register external assemblies directory:
                    string serviceAssembliesFolder = @"C:\ChromelyDlls";
                    window.RegisterServiceAssemblies(serviceAssembliesFolder);

                    // Scan assemblies for Controller routes
                    window.ScanAssemblies();

                    window.SetSize(config.HostWidth, config.HostHeight);
                    window.CenterToScreen();
                    window.Show();
                    return(new EventLoop().Run(window));
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }

            return(0);
        }
Ejemplo n.º 8
0
        public int Run(CefConfig config)
        {
            this.config = config;
            var res = Instance.GetScreenResolution();

            if (config.FullScreen || config.Kiosk)
            {
                config.Width  = (int)(ScaleFactor * res.Width) - 1;
                config.Height = (int)(ScaleFactor * res.Height);
            }
            else
            {
                config.Width  = (int)(config.Width > 0 ? config.Width * ScaleFactor : res.Width * .75);
                config.Height = (int)(config.Height > 0 ? config.Height * ScaleFactor : res.Height * .75);
            }

            if (config.HideConsoleWindow && !config.Verbose)
            {
                Instance.HideConsoleWindow();
            }

            var factory = WinapiHostFactory.Init(config.Icon);

            using (window = factory.CreateWindow(
                       () => new CefGlueHost(config),
                       config.WindowTitle,
                       constructionParams: new FrameWindowConstructionParams()))
            {
                try
                {
                    DesktopState.BrowserHandle = window.Handle;
                    DesktopState.ConsoleHandle = ConsoleHandle;

                    foreach (var scheme in config.Schemes)
                    {
                        CefRuntime.RegisterSchemeHandlerFactory(scheme.Scheme, scheme.Domain,
                                                                new CefProxySchemeHandlerFactory(scheme));
                        if (scheme.AllowCors && scheme.Domain != null)
                        {
                            CefRuntime.AddCrossOriginWhitelistEntry(config.StartUrl, scheme.TargetScheme ?? scheme.Scheme,
                                                                    scheme.Domain, true);
                        }
                    }

                    foreach (var schemeFactory in config.SchemeFactories)
                    {
                        CefRuntime.RegisterSchemeHandlerFactory(schemeFactory.Scheme, schemeFactory.Domain,
                                                                schemeFactory.Factory);
                        if (schemeFactory.AddCrossOriginWhitelistEntry)
                        {
                            CefRuntime.AddCrossOriginWhitelistEntry(config.StartUrl, schemeFactory.Scheme,
                                                                    schemeFactory.Domain, true);
                        }
                    }

                    // if (config.Verbose)
                    // {
                    //     Console.WriteLine(
                    //         @$"GetScreenResolution: {res.Width}x{res.Height}, scale:{ScaleFactor}, {(int) (ScaleFactor * res.Width)}x{(int) (ScaleFactor * res.Width)}");
                    //     var rect = Instance.GetClientRectangle(window.Handle);
                    //     Console.WriteLine(
                    //         @$"GetClientRectangle:  [{rect.Top},{rect.Left}] [{rect.Bottom},{rect.Right}], scale: [{(int) (rect.Bottom * ScaleFactor)},{(int) (rect.Right * ScaleFactor)}]");
                    // }

                    if (config.CenterToScreen)
                    {
                        window.CenterToScreen();
                    }
                    else if (config.X != null || config.Y != null)
                    {
                        window.SetPosition(config.X.GetValueOrDefault(), config.Y.GetValueOrDefault());
                    }
                    if (config.Kiosk || config.FullScreen)
                    {
                        Instance.SetWindowFullScreen(window.Handle);
                    }
                    else
                    {
                        window.SetSize(config.Width, config.Height - 1); //force redraw in BrowserCreated
                    }

                    window.Browser.BrowserCreated += (sender, args) => {
                        var cef = (CefGlueBrowser)sender;
                        if (!cef.Config.Kiosk)
                        {
                            window.SetSize(config.Width, config.Height); //trigger refresh to sync browser frame with window
                            if (config.CenterToScreen)
                            {
                                window.CenterToScreen();
                            }

                            if (config.FullScreen)
                            {
                                User32.ShowWindow(window.Handle, User32.WindowShowStyle.SW_MAXIMIZE);
                            }
                        }
                        else
                        {
                            EnterKioskMode();
                            cef.BrowserWindowHandle.ShowScrollBar(NativeWin.SB_BOTH, false);
                        }
                    };

                    window.Show();

                    return(new EventLoop().Run(window));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// The main.
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        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 htpp scheme handler - RegisterSchemeHandler("htpp", "test.com",  new CustomHttpHandler())
                string appDirectory = AppDomain.CurrentDomain.BaseDirectory;
                string startUrl     = $"file:///{appDirectory}app/chromely_with_ajax.html";

                ChromelyConfiguration config = ChromelyConfiguration
                                               .Create()
                                               .WithAppArgs(args)
                                               .WithHostSize(1200, 900)
                                               .WithLogFile("logs\\chromely.cef_new.log")
                                               .WithStartUrl(startUrl)
                                               .WithLogSeverity(LogSeverity.Info)
                                               .UseDefaultLogger()
                                               .UseDefaultResourceSchemeHandler("local", string.Empty)
                                               .UseDefaultHttpSchemeHandler("http", "chromely.com")
                                               .UseDefautJsHandler("boundControllerAsync", true);

                var factory = WinapiHostFactory.Init("chromely.ico");
                using (var window = factory.CreateWindow(
                           () => new CefSharpBrowserHost(config),
                           "chromely",
                           constructionParams: new FrameWindowConstructionParams()))
                {
                    // Register external url schems
                    window.RegisterUrlScheme(new UrlScheme("https://github.com/mattkol/Chromely", true));

                    /*
                     * Register service assemblies
                     * Uncomment relevant part to register assemblies
                     */

                    // 1. Register current/local assembly:
                    window.RegisterServiceAssembly(Assembly.GetExecutingAssembly());

                    // 2. Register external assembly with file name:
                    // string serviceAssemblyFile = @"C:\ChromelyDlls\Chromely.Service.Demo.dll";
                    // window.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);
                    // window.RegisterServiceAssemblies(filenames);

                    // 4. Register external assemblies directory:
                    string serviceAssembliesFolder = @"C:\ChromelyDlls";
                    window.RegisterServiceAssemblies(serviceAssembliesFolder);

                    // Scan assemblies for Controller routes
                    window.ScanAssemblies();

                    window.SetSize(config.HostWidth, config.HostHeight);
                    window.CenterToScreen();
                    window.Show();
                    return(new HostEventLoop().Run(window));
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }

            return(0);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// The main.
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        public static int Main(string[] args)
        {
            try {
                HostHelpers.SetupDefaultExceptionHandlers();

                string startUrl = "local://dist/index.html";

                int defaultScreenWidth  = 1480;
                int defaultScreenHeight = 900;

                int screenWidth  = Screen.PrimaryScreen.Bounds.Width - 100;
                int screenHeight = Screen.PrimaryScreen.Bounds.Height - 100;

                if (screenWidth < defaultScreenWidth)
                {
                    defaultScreenWidth = screenWidth;
                }
                if (screenHeight < defaultScreenHeight)
                {
                    defaultScreenHeight = screenHeight;
                }

                ChromelyConfiguration config = ChromelyConfiguration
                                               .Create()
                                               .WithAppArgs(args)
                                               .WithHostSize(defaultScreenWidth, defaultScreenHeight)
                                               .WithLogFile("logs\\conversetek-interface.log")
                                               .WithStartUrl(startUrl)
                                               .WithLogSeverity(LogSeverity.Info)
                                               .UseDefaultLogger("logs\\conversetek-core.log", true)
                                               .UseDefaultResourceSchemeHandler("local", string.Empty)
                                               .UseDefaultHttpSchemeHandler("http", "chromely.com")
                                               .UseDefautJsHandler("boundControllerAsync", true)
                                               .RegisterCustomHandler(CefHandlerKey.ContextMenuHandler, typeof(ConverseTekContextMenuHandler))
                                               .RegisterCustomHandler(CefHandlerKey.KeyboardHandler, typeof(ConverseTekKeyboardHandler));
                // .RegisterJsHandler(new ChromelyJsHandler("boundControllerAsync", new ConverseTekBoundObject(), null, true));

                // Alternate approach for multi-process, is to add a subprocess application
                // .WithCustomSetting(CefSettingKeys.SingleProcess, true);

                var factory = WinapiHostFactory.Init("conversetek.ico");
                using (var window = factory.CreateWindow(
                           () => new CefSharpBrowserHost(config),
                           "ConverseTek",
                           constructionParams: new FrameWindowConstructionParams())
                       ){
                    // Register external url schems
                    window.RegisterUrlScheme(new UrlScheme("https://github.com/mattkol/Chromely", true));

                    /*
                     * Register service assemblies
                     * Uncomment relevant part to register assemblies
                     */

                    // 1. Register current/local assembly:
                    window.RegisterServiceAssembly(Assembly.GetExecutingAssembly());

                    // 2. Register external assembly with file name:
                    // string serviceAssemblyFile = @"C:\ChromelyDlls\Chromely.Service.Demo.dll";
                    // window.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);
                    // window.RegisterServiceAssemblies(filenames);

                    // 4. Register external assemblies directory:
                    string serviceAssembliesFolder = @"C:\ChromelyDlls";
                    window.RegisterServiceAssemblies(serviceAssembliesFolder);

                    // Scan assemblies for Controller routes
                    window.ScanAssemblies();

                    window.SetSize(config.HostWidth, config.HostHeight);
                    window.CenterToScreen();
                    window.Show();
                    return(new EventLoop().Run(window));
                }
            } catch (Exception exception) {
                Log.Error(exception);
            }

            return(0);
        }