Esempio n. 1
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);
        }
Esempio n. 2
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);
        }
Esempio 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()
                                               .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);
        }
Esempio n. 4
0
        public static int Main(string[] args)
        {
            try
            {
                HostHelpers.SetupDefaultExceptionHandlers();

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

                string debuggingMode = ConfigurationValues.DebuggingMode;
                bool.TryParse(debuggingMode, out bool isDebuggingMode);

                ChromelyConfiguration config = ChromelyConfiguration
                                               .Create()
                                               .WithAppArgs(args)
                                               .WithHostSize(1200, 900)
                                               .WithHostMode(WindowState.Maximize, true)
                                               .WithHostTitle("Dr.KHOA Clinic")
                                               .WithHostIconFile("app.ico")
                                               .WithStartUrl(startUrl)
                                               .WithLogFile("logs\\app.log")
                                               .WithLogSeverity(LogSeverity.Info)
                                               .WithDebuggingMode(isDebuggingMode)
                                               .UseDefaultLogger("logs\\app.log")
                                               .UseDefaultResourceSchemeHandler("local", string.Empty)
                                               .UseDefaultHttpSchemeHandler("http", "clinicapp.com")
                                               .UseDefaultJsHandler("boundControllerAsync", true);

                using (var window = ChromelyWindow.Create(config))
                {
                    window.RegisterServiceAssembly(Assembly.GetExecutingAssembly());
                    window.ScanAssemblies();

                    return(window.Run(args));
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }

            return(0);
        }
Esempio n. 5
0
        /// <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();
        }
Esempio n. 6
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));
            }
        }
Esempio n. 7
0
        private void ShowUI(string[] args)
        {
            try
            {
                HostHelpers.SetupDefaultExceptionHandlers();
                var appDirectory = AppDomain.CurrentDomain.BaseDirectory;
                var startUrl     = "file:///app/pages/messagerouterdemo.html";
                var config       = ChromelyConfiguration
                                   .Create()
                                   .WithHostMode(WindowState.Normal)
                                   .WithHostTitle("DBMProject")
                                   .WithHostIconFile("chromely.ico")
                                   .WithHostBounds(1350, 834)
                                   .WithAppArgs(args)
                                   .UseDefaultResourceSchemeHandler("local", string.Empty)
                                   .WithLogSeverity(LogSeverity.Info)
                                   .UseDefaultLogger("logs\\chromely_new.log")
                                   .UseDefaultHttpSchemeHandler("http", "chromely.com")
                                   // .NET Core may not run in debug mode without publishing to exe
                                   // To overcome that, a subprocess need to be set.
                                   //.WithCustomSetting(CefSettingKeys.BrowserSubprocessPath, path_to_subprocess)
                                   .WithStartUrl(startUrl);

                using (var window = ChromelyWindow.Create(config))
                {
                    window.RegisterUrlScheme(new UrlScheme("https://github.com/chromelyapps/Chromely", true));
                    window.RegisterServiceAssembly(Assembly.GetExecutingAssembly());
                    window.ScanAssemblies();
                    window.Run(args);
                }
            }
            catch (Exception exception)
            {
                scriptController.ExitFailureProgram($"\nOverall Status: Unsuccess\n{exception}", 0);
            }
        }
Esempio n. 8
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);
        }
Esempio n. 9
0
        static int Main(string[] args)
        {
            try
            {
                HostHelpers.SetupDefaultExceptionHandlers();
                var appDirectory = AppDomain.CurrentDomain.BaseDirectory;

                /*
                 * Start url (load html) options:
                 */

                // Options 1 - real standard urls
                // var 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())
                var 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())
                // var startUrl = $"file:///{appDirectory}app/chromely.html";
                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)
                             .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);

                using (var window = new CefGlueBrowserWindow(config))
                {
                    // Register external url schemes
                    window.RegisterUrlScheme(new UrlScheme("https://github.com/chromelyapps/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:
                    var externalAssemblyFile = System.IO.Path.Combine(appDirectory, "Chromely.Service.Demo.dll");
                    window.RegisterServiceAssembly(externalAssemblyFile);

                    // 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:
                    // var serviceAssembliesFolder = @"C:\ChromelyDlls";
                    // window.RegisterServiceAssemblies(serviceAssembliesFolder);

                    // Scan assemblies for Controller routes
                    window.ScanAssemblies();
                    return(window.Run(args));
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }

            return(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)
                                               .WithHostMode(WindowState.Normal, true)
                                               .WithHostTitle("chromely")
                                               .WithHostIconFile("chromely.ico")
                                               .WithStartUrl(startUrl)
                                               .WithLogFile("logs\\chromely.cef_new.log")
                                               .WithLogSeverity(LogSeverity.Info)
                                               .UseDefaultLogger()
                                               .UseDefaultResourceSchemeHandler("local", string.Empty)
                                               .UseDefaultHttpSchemeHandler("http", "chromely.com")
                                               .UseDefautJsHandler("boundControllerAsync", true);

                using (var window = new CefSharpBrowserWindow(config))
                {
                    // 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();

                    return(window.Run(args));
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }

            return(0);
        }
Esempio n. 11
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);
        }
Esempio n. 12
0
        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("logs\\chromely_new.log")
                                               .UseDefaultResourceSchemeHandler("local", string.Empty)
                                               .UseDefaultHttpSchemeHandler("http", "chromely.com");

                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/mattkol/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";
                    // 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);
        }
Esempio n. 13
0
        static int Main(string[] args)
        {
            try
            {
                HostHelpers.SetupDefaultExceptionHandlers();
                var appDirectory = AppDomain.CurrentDomain.BaseDirectory;

                /*
                 * Start url (load html) options:
                 */

                // Options 1 - real standard urls
                // var 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())
                var 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())
                // var startUrl = $"file:///{appDirectory}app/chromely.html";
                var config = ChromelyConfiguration
                             .Create()
                             .WithHostMode(WindowState.Normal)
                             .WithHostTitle("chromely")
                             .WithHostIconFile("chromely.ico")
                             .WithAppArgs(args)
                             .WithHostSize(1200, 700)
                             .WithAppArgs(args)
                             .WithHostSize(1200, 700)
                             //  .WithFramelessHost()
                             .WithStartUrl(startUrl)
                             .WithLogSeverity(LogSeverity.Info)
                             .UseDefaultSubprocess()
                             .UseDefaultResourceSchemeHandler("local", string.Empty)
                             .UseDefaultHttpSchemeHandler("http", "chromely.com");
                //.UseDefaultWebsocketHandler(string.Empty, 8181, true);

                using (var window = CefGlue.ChromelyWindow.Create(config))
                {
                    // Register external url schemes
                    window.RegisterUrlScheme(new UrlScheme("https://github.com/chromelyapps/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:
                    var externalAssemblyFile = System.IO.Path.Combine(appDirectory, "Chromely.Service.Demo.dll");
                    window.RegisterServiceAssembly(externalAssemblyFile);

                    // 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:
                    // var serviceAssembliesFolder = @"C:\ChromelyDlls";
                    // window.RegisterServiceAssemblies(serviceAssembliesFolder);

                    // Scan assemblies for Controller routes
                    window.ScanAssemblies();
                    return(window.Run(args));
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }

            return(0);
        }
Esempio n. 14
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();
                var appDirectory = AppDomain.CurrentDomain.BaseDirectory;

                /*
                 * 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())
                var startUrl = "local://app/chromely_frameless.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())
                // var startUrl = $"file:///{appDirectory}app/chromely_frameless.html";
                var config = ChromelyConfiguration
                             .Create()
                             .WithHostMode(WindowState.Normal)
                             .WithHostFlag(HostFlagKey.Frameless, true)
                             //.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)
                             .WithHostBounds(1200, 700)
                             .WithHostTitle("chromely")
                             .WithHostIconFile("chromely.ico")
                             .WithAppArgs(args)
                             .WithStartUrl(startUrl)
                             .WithLogSeverity(LogSeverity.Info)
                             .UseDefaultLogger()
                             .UseDefaultResourceSchemeHandler("local", string.Empty)
                             .UseDefaultHttpSchemeHandler("http", "chromely.com")
                             .UseDefaultJsHandler("boundControllerAsync", true);

                //var process = Process.GetCurrentProcess(); // Or whatever method you are using
                //string fullPath = process.MainModule.FileName;
                //Log.Error($"Path:{fullPath}");

                //string module = process.MainModule.ModuleName;
                //Log.Error($"Module:{module}");

                //Log.Error($"AppDir:{appDirectory}");
                //Log.Error($"WorkingDirectory:{System.Environment.CurrentDirectory}");
                //string wdir = @"C:\Projects\ProjectDurbar\ChromelySolution\src\Demos\Chromely.CefSharp.Winapi.Demo\bin\x64\Debug\net461";
                //Directory.SetCurrentDirectory(wdir);

                using (var window = ChromelyWindow.Create(config))
                {
                    // Register command url scheme
                    window.RegisterUrlScheme(new UrlScheme("https://github.com/chromelyapps/Chromely", UrlSchemeType.External));

                    // Register external url schemes
                    window.RegisterUrlScheme(new UrlScheme("http://command.com", UrlSchemeType.Command));

                    /*
                     * 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:
                    var externalAssemblyFile = System.IO.Path.Combine(appDirectory, "Chromely.Service.Demo.dll");
                    window.RegisterServiceAssembly(externalAssemblyFile);

                    // 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:
                    // var serviceAssembliesFolder = @"C:\ChromelyDlls";
                    // window.RegisterServiceAssemblies(serviceAssembliesFolder);

                    // Scan assemblies for Controller routes
                    window.ScanAssemblies();
                    return(window.Run(args));
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }

            return(0);
        }
Esempio n. 15
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_with_ajax.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");

                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/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);
        }
Esempio n. 16
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()
                                               .WithAppArgs(args)
                                               .WithHostSize(1200, 900)
                                               .WithLogFile("logs\\chromely.cef_new.log")
                                               .WithStartUrl(startUrl)
                                               .WithLogSeverity(LogSeverity.Info)
                                               .UseDefaultLogger("logs\\chromely_new.log", 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_sunprocess)
                                               .WithCustomSetting(CefSettingKeys.SingleProcess, true)
                                               .RegisterSchemeHandler("http", "chromely.com", new CefGlueSchemeHandlerFactory());

                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/mattkol/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 HostEventLoop().Run(window));
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }

            return(0);
        }
Esempio n. 17
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();
                var appDirectory = AppDomain.CurrentDomain.BaseDirectory;

                /*
                 * 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())
                var 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())
                // var startUrl = $"file:///{appDirectory}app/chromely.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()
                             .WithHostMode(WindowState.Normal)
                             .WithHostTitle("chromely")
                             .WithHostIconFile("chromely.ico")
                             .WithAppArgs(args)
                             .WithHostBounds(1200, 700)
                             //.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 | false - default false)
                             //.WithHostFlag(HostFlagKey.NoMinMaxBoxes, true | false - default false)
                             .WithStartUrl(startUrl)
                             .WithLogSeverity(LogSeverity.Info)
                             .UseDefaultLogger()
                             .UseDefaultResourceSchemeHandler("local", string.Empty)
                             .UseDefaultHttpSchemeHandler("http", "chromely.com")
                             .UseDefaultJsHandler("boundControllerAsync", true);

                using (var window = ChromelyWindow.Create(config))
                {
                    // Register external url schemes
                    window.RegisterUrlScheme(new UrlScheme("https://github.com/chromelyapps/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:
                    var externalAssemblyFile = System.IO.Path.Combine(appDirectory, "Chromely.Service.Demo.dll");
                    window.RegisterServiceAssembly(externalAssemblyFile);

                    // 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:
                    // var serviceAssembliesFolder = @"C:\ChromelyDlls";
                    // window.RegisterServiceAssemblies(serviceAssembliesFolder);

                    // Scan assemblies for Controller routes
                    window.ScanAssemblies();
                    return(window.Run(args));
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }

            return(0);
        }
Esempio n. 18
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);
        }