public static void Main(string[] args) { var appName = Assembly.GetEntryAssembly()?.GetName().Name; var firstProcess = ServerAppUtil.IsMainProcess(args); var port = ServerAppUtil.AvailablePort; if (firstProcess) { if (port != -1) { // start the kestrel server in a background thread AppDomain.CurrentDomain.ProcessExit += ProcessExit; BlazorTaskTokenSource = new CancellationTokenSource(); BlazorTask = new Task(() => { CreateHostBuilder(args, port).Build().Run(); }, BlazorTaskTokenSource.Token, TaskCreationOptions.LongRunning); BlazorTask.Start(); // wait till its up while (ServerAppUtil.IsPortAvailable(port)) { Thread.Sleep(1); } } // Save port for later use by chromely processes ServerAppUtil.SavePort(appName, port); } else { // fetch port number port = ServerAppUtil.GetSavedPort(appName); } if (port != -1) { // start up chromely var core = typeof(IChromelyConfiguration).Assembly; var config = DefaultConfiguration.CreateForRuntimePlatform(); config.WindowOptions.Title = "blazor server app demo"; config.StartUrl = $"https://127.0.0.1:{port}"; config.DebuggingMode = true; config.WindowOptions.RelativePathToIconFile = "chromely.ico"; try { var builder = AppBuilder.Create(); builder = builder.UseConfig <DefaultConfiguration>(config); builder = builder.UseApp <DemoChromelyApp>(); builder = builder.Build(); builder.Run(args); } catch (Exception ex) { Console.WriteLine(ex); throw; } } }
static void Main(string[] args) { //Console.WriteLine("Hello World!"); var startUrl = $"https://threejs.org/examples/#webgl_animation_cloth"; var config = DefaultConfiguration.CreateForRuntimePlatform(); config.CefDownloadOptions = new CefDownloadOptions(true, false); config.WindowOptions.Position = new WindowPosition(0, 0); config.WindowOptions.WindowState = WindowState.Fullscreen; config.WindowOptions.Size = new WindowSize(800, 800); config.StartUrl = startUrl; try { var builder = AppBuilder.Create(); builder = builder.UseApp <DemoChromelyApp>(); builder = builder.UseConfiguration <DefaultConfiguration>(config); builder = builder.Build(); builder.Run(args); } catch (Exception ex) { //Console.WriteLine(ex); throw; } }
static void Main(string[] args) { AppBuilder .Create() .UseApp <AudioControllerApp> () .Build() .Run(args); }
static void Main(string[] args) { AppBuilder .Create() .UseApp <DemoChromelyApp>() .Build() .Run(args); }
static void Main(string[] args) { // basic example of the application builder AppBuilder .Create() .UseApp <MyChromelyApp>() .Build() .Run(args); }
public static void Main(string[] args) { var appName = Assembly.GetEntryAssembly()?.GetName().Name; var firstProcess = ServerAppUtil.IsMainProcess(args); var port = ServerAppUtil.AvailablePort; if (firstProcess) { if (port != -1) { var blazorTask = new Task(() => CreateHostBuilder(args, port).Build().Run(), TaskCreationOptions.LongRunning); blazorTask.Start(); while (ServerAppUtil.IsPortAvailable(port)) { Thread.Sleep(1); } } ServerAppUtil.SavePort(appName, port); } else { port = ServerAppUtil.GetSavedPort(appName); } if (port != -1) { var core = typeof(IChromelyConfiguration).Assembly; var config = DefaultConfiguration.CreateForRuntimePlatform(); config.WindowOptions.Title = "Grimoire"; config.StartUrl = $"http://127.0.0.1:{port}"; #if DEBUG config.DebuggingMode = true; #else config.DebuggingMode = false; #endif config.WindowOptions.RelativePathToIconFile = "icon.ico"; try { var builder = AppBuilder.Create(); builder = builder.UseConfiguration <DefaultConfiguration>(config); builder = builder.UseApp <GrimoireChromelyApp>(); builder = builder.Build(); builder.Run(args); } catch (Exception ex) { Console.WriteLine(ex); throw; } } }
private static void Main(string[] args) { Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); var path = ApplicationInfo.ApplicationDirectory; Directory.SetCurrentDirectory(path); var settingsFile = new Profile(Path.Combine(path, "GitState.cfg")); new ProfileClassLoader().LoadClass(Settings, settingsFile); // Starting stonehenge backend var options = new StonehengeHostOptions { Title = "GitState", StartPage = "main", ServerPushMode = ServerPushModes.LongPolling, PollIntervalSec = 10 }; var logger = Logger.DefaultFactory.CreateLogger("GitState"); var provider = StonehengeResourceLoader .CreateDefaultLoader(logger, new VueResourceProvider(logger)); var host = new KestrelHost(provider, options); if (!host.Start("localhost", 8880)) { Console.WriteLine("Failed to start stonehenge server"); } // Starting chromely frontend Console.WriteLine("Starting chromely frontend"); var config = DefaultConfiguration.CreateForRuntimePlatform(); config.CefDownloadOptions = new CefDownloadOptions(true, true); config.StartUrl = host.BaseUrl; config.WindowOptions = new WindowOptions { Title = "GitState", Size = new WindowSize(Settings.WindowWidth, Settings.WindowHeight), RelativePathToIconFile = "GitState.ico" }; config.DebuggingMode = true; AppBuilder .Create() .UseApp <ChromelyBasicApp>() .UseConfig <IChromelyConfiguration>(config) .Build() .Run(args); Console.ReadLine(); Console.WriteLine("GitState done."); }
private static int Main(string[] args) { CiTrace("Application", "Started"); // measure startup time (maybe including CEF download) _startupTimer = new Stopwatch(); _startupTimer.Start(); // Set default JSON serialization properties JsonConvert.DefaultSettings = () => new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() { NamingStrategy = new CamelCaseNamingStrategy() } }; var core = typeof(IChromelyConfiguration).Assembly; CiTrace("Chromely.Core", $"{core.GetName().Version}"); CiTrace("Platform", ChromelyRuntime.Platform.ToString()); var appDirectory = AppDomain.CurrentDomain.BaseDirectory; CiTrace("AppDirectory", appDirectory); var startUrl = $"file:///{appDirectory}/index.html"; var config = DefaultConfiguration.CreateForRuntimePlatform(); config.CefDownloadOptions = new CefDownloadOptions(true, true); config.WindowOptions.Position = new WindowPosition(1, 2); config.WindowOptions.Size = new WindowSize(1000, 600); config.StartUrl = startUrl; config.DebuggingMode = true; config.WindowOptions.RelativePathToIconFile = "chromely.ico"; CiTrace("Configuration", "Created"); try { var builder = AppBuilder.Create(); builder = builder.UseApp <TestApp>(); builder = builder.UseConfiguration <DefaultConfiguration>(config); builder = builder.Build(); builder.Run(args); } catch (Exception ex) { Console.WriteLine(ex); throw; } CiTrace("Application", "Done"); return(0); }
public static async Task Main(string[] args) { AppFunc appFunc = null; //Only setup our AspNet Core host if within the Browser Process //Not needed for the sub processes (render, gpu, etc) //TODO: Move this somewhere internal to Chromely that //doesn't require the extra check and supports async if (!args.Any(x => x.StartsWith("--type"))) { var tcs = new TaskCompletionSource <AppFunc>(); var builder = new WebHostBuilder(); builder.ConfigureServices(services => { var server = new OwinServer(); server.UseOwin(appFunc => { tcs.SetResult(appFunc); }); services.AddSingleton <IServer>(server); }); _host = builder .UseStartup <Startup>() .UseContentRoot(Directory.GetCurrentDirectory()) .Build(); _ = _host.RunAsync(); appFunc = await tcs.Task; } var config = DefaultConfiguration.CreateForRuntimePlatform(); config.WindowOptions.Title = "Title Window"; config.StartUrl = "https://chromely.test"; //config.StartUrl = "chrome://version"; var app = new OwinChromelyBasicApp(appFunc); AppBuilder .Create() .UseConfig <DefaultConfiguration>(config) .UseApp <OwinChromelyBasicApp>(app) .Build() .Run(args); await _host.StopAsync(); }
static void Main(string[] args) { Console.WriteLine("SunSpec Explorer"); var consoleListener = new ConsoleTraceListener(); Trace.Listeners.Add(consoleListener); var options = new StonehengeHostOptions { Title = "SunSpec Explorer", StartPage = "explorer", ServerPushMode = ServerPushModes.LongPolling, PollIntervalMs = 5000 }; var vue = new VueResourceProvider(); var provider = StonehengeResourceLoader.CreateDefaultLoader(vue); //provider.Services.AddService(typeof(InformantEngine), _engine); var host = new KestrelHost(provider, options); if (!host.Start("localhost", 8080)) { Console.WriteLine("Failed to start stonehenge server"); } var config = DefaultConfiguration.CreateForRuntimePlatform(); config.CefDownloadOptions = new CefDownloadOptions { AutoDownloadWhenMissing = true, DownloadSilently = true }; config.WindowOptions = new WindowOptions { Title = " ", //RelativePathToIconFile = "Informant.ico", Size = new WindowSize( (int)(1000 * Display.GetScalingFactor()), (int)(600 * Display.GetScalingFactor())) }; config.DebuggingMode = true; config.StartUrl = host.BaseUrl; AppBuilder .Create() .UseConfiguration <IChromelyConfiguration>(config) .UseApp <ChromelyBasicApp>() .Build() .Run(args); }
static void Main(string[] args) { var config = DefaultConfiguration.CreateForRuntimePlatform(); config.WindowOptions.WindowFrameless = true; AppBuilder .Create() .UseConfiguration <DefaultConfiguration>(config) .UseApp <App>() .Build() .Run(args); }
static void Main(string[] args) { ValidatorOptions.CascadeMode = CascadeMode.StopOnFirstFailure; //setup storages files modules StorageService.SetupStorageFiles(); // Create Chromely app AppBuilder .Create() .UseApp <ChromelyUi>() .Build() .Run(args); }
static void Main(string[] args) { var config = DefaultConfiguration.CreateForRuntimePlatform(); config.StartUrl = "local://dist/index.html"; AppBuilder .Create() .UseConfig <DefaultConfiguration>(config) .UseApp <DemoApp>() .Build() .Run(args); }
static int Main(string[] args) { var config = CreateConfiguration(); var app = AppBuilder.Create() .UseApp <RekoApp>() .UseConfig <IChromelyConfiguration>(config) .UseWindow <RekoBrowserHost>() .Build(); app.Run(args); return(0); }
private static void Main(string[] args) { // Configure logger ConfigureLogger(); // Run application AppBuilder .Create() .UseApp <Application>() .UseConfiguration <IChromelyConfiguration>(Configuration.Create()) .Build() .Run(args); }
/// <summary> Bootstrap the Chromely browser. </summary> public static void ChromelyBootstrap(string[] args, string[] appurls) { var config = DefaultConfiguration.CreateForRuntimePlatform(); config.WindowOptions.Title = "Title Window"; config.StartUrl = appurls.First(); AppBuilder .Create() .UseConfiguration <DefaultConfiguration>(config) .UseApp <ChromelyBasicApp>() .Build() .Run(args); }
static void Main(string[] args) { /* For local and embedded (assembly) resources * var config = DefaultConfiguration.CreateForRuntimePlatform(); * config.StartUrl = "app://app/chromely.html" // local; * config.StartUrl = "assembly://app/chromely.html // assembly"; * config.StartUrl = "mixassembly://app/chromely.html // mixed - local + assembly"; */ AppBuilder .Create() .UseApp <DemoChromelyApp>() .Build() .Run(args); }
static void Main(string[] args) { var config = DefaultConfiguration.CreateForRuntimePlatform(); config.WindowOptions.Title = "chromely controllers demo"; config.UrlSchemes.Add(new UrlScheme(DefaultSchemeName.RESOURCE, "http", "app", string.Empty, UrlSchemeType.Resource, false)); config.StartUrl = "http://app/index.html"; AppBuilder .Create() .UseConfiguration <DefaultConfiguration>(config) .UseApp <DemoChromelyApp>() .Build() .Run(args); }
private async void Application_Startup(object sender, StartupEventArgs e) { var f = new Loading(); Thread thread = new Thread(() => { var assembly = Assembly.GetExecutingAssembly(); AppBuilder .Create() .UseApp <TranslatorApp>() .UseConfiguration <DefaultConfiguration>(new DefaultConfiguration() { CefDownloadOptions = new CefDownloadOptions(true, true), StartUrl = "app://bdo-ui/index.html", DebuggingMode = true, WindowOptions = new WindowOptions() { Title = "Black Desert Translator", RelativePathToIconFile = "./app.ico", DisableResizing = true, StartCentered = true, DisableMinMaximizeControls = true, Size = new WindowSize(1080, 640) }, UrlSchemes = new List <UrlScheme>() { new UrlScheme("app", "app", "bdo-ui", string.Empty, UrlSchemeType.AssemblyResource, assemblyOptions: new AssemblyOptions(assembly, "BDOTranslator_WPF", "UI.bdoapp.dist")), new UrlScheme("Controller", "http", "bdo-command", string.Empty, UrlSchemeType.Custom) } }) .Build() .Run(new string[] { }); if (File.Exists("build")) { File.Delete("build"); } Environment.Exit(0); }); thread.IsBackground = false; thread.Start(); //f.Show(); //while (!File.Exists("build")) //await Task.Delay(500); //f.Close(); }
static void Main(string[] args) { TrySerial(false); using var webBuilder = WebApplication.Program .CreateHostBuilder(args) .Build(); webBuilder .RunAsync(); AppBuilder .Create() .UseApp <DesktopChromelyApp>() .Build() .Run(args); }
static void Main(string[] args) { var config = DefaultConfiguration.CreateForRuntimePlatform(); config.WindowOptions.Title = "Chromely IO"; config.StartUrl = "http://localhost:5000"; config.DebuggingMode = true; //config.ControllerAssemblies = new List<ControllerAssemblyInfo>(); //config.ControllerAssemblies.RegisterServiceAssembly(Assembly.GetExecutingAssembly()); AppBuilder .Create() .UseConfiguration <DefaultConfiguration>(config) .UseApp <ArgumentsChromelyApp>() .Build() .Run(args); }
static void Main(string[] args) { var config = DefaultConfiguration.CreateForRuntimePlatform(); config.CefDownloadOptions = new CefDownloadOptions(true, true); config.WindowOptions.Position = new WindowPosition(1, 2); config.WindowOptions.Size = new WindowSize(1024, 576); config.StartUrl = "https://www.bing.com"; config.DebuggingMode = false; AppBuilder .Create() .UseApp <Chromely.ChromelyBasicApp>() .UseConfig <DefaultConfiguration>(config) .Build() .Run(args); }
private static int Main(string[] args) { CiTrace("Application", "Started"); // measure startup time (maybe including CEF download) _startupTimer = new Stopwatch(); _startupTimer.Start(); var core = typeof(IChromelyConfiguration).Assembly; CiTrace("Chromely.Core", core.GetName().Version?.ToString() ?? ""); CiTrace("Platform", ChromelyRuntime.Platform.ToString()); var appDirectory = AppDomain.CurrentDomain.BaseDirectory; CiTrace("AppDirectory", appDirectory); var startUrl = $"file:///{appDirectory}/index.html"; var config = DefaultConfiguration.CreateForRuntimePlatform(); config.CefDownloadOptions = new CefDownloadOptions(true, true); config.WindowOptions.Position = new WindowPosition(1, 2); config.WindowOptions.Size = new WindowSize(1000, 600); config.StartUrl = startUrl; config.DebuggingMode = true; config.WindowOptions.RelativePathToIconFile = "chromely.ico"; CiTrace("Configuration", "Created"); try { var builder = AppBuilder.Create(args); builder = builder.UseConfig <DefaultConfiguration>(config); builder = builder.UseWindow <TestWindow>(); builder = builder.UseApp <ChromelyBasicApp>(); builder = builder.Build(); builder.Run(); } catch (Exception ex) { Console.WriteLine(ex); throw; } CiTrace("Application", "Done"); return(0); }
private static int Main(string[] args) { CiTrace("Application", "Started"); // measure startup time (maybe including CEF download) _startupTimer = new Stopwatch(); _startupTimer.Start(); var core = typeof(IChromelyConfiguration).Assembly; CiTrace("Chromely.Core", core.GetName().Version.ToString()); CiTrace("Platform", ChromelyRuntime.Platform.ToString()); var appDirectory = AppDomain.CurrentDomain.BaseDirectory; CiTrace("AppDirectory", appDirectory); var startUrl = $"file:///{appDirectory}/index.html"; var config = new DefaultConfiguration { LoadCefBinariesIfNotFound = true, WindowWidth = 1000, WindowHeight = 600, StartUrl = startUrl, DebuggingMode = true }; CiTrace("Configuration", "Created"); try { var builder = AppBuilder.Create(); builder = builder.UseApp <ChromelyTestApp>(); builder = builder.UseConfiguration <DefaultConfiguration>(config); builder = builder.Build(); builder.Run(args); } catch (Exception ex) { Console.WriteLine(ex); throw; } CiTrace("Application", "Done"); return(0); }
static void Main(string[] args) { //var config = DefaultConfiguration.CreateForRuntimePlatform(); //config.StartUrl = "https://google.com"; //config.StartUrl = "local://app/index.html"; // Frameless/draggable //config.StartUrl = "local://app/index_frameless.html"; // config.StartUrl = "local://app/index_draggable.html"; // config.WindowOptions.FramelessOption.UseWebkitAppRegions = true; AppBuilder .Create() //.UseConfig<DefaultConfiguration>(config) //.UseWindow<DemoWindow>() .UseApp <DemoApp>() .Build() .Run(args); }
static void Main(string[] args) { var config = DefaultConfiguration.CreateForRuntimePlatform(); config.WindowOptions = new WindowOptions { Title = "ChromelyMin51", StartCentered = true, Size = new WindowSize(800, 600), RelativePathToIconFile = "chromely.ico", WindowFrameless = true, FramelessOption = new FramelessOption { UseWebkitAppRegions = true } }; AppBuilder .Create() .UseConfig <DefaultConfiguration>(config) .UseApp <App>() .Build() .Run(args); }
public static void Main(string[] args) { bool firstProcess = false; // chromely starts multiple child processes // we only want to start the asp core on the first process // // ideally it would be nice if chromely allowed things to be passed to // the child processes through args Mutex mutex = null; try { // if this succeeds we are not the first process mutex = Mutex.OpenExisting("BlazorTestMutex"); } catch { // must be first process mutex = new Mutex(false, "BlazorTestMutex"); firstProcess = true; } int port = -1; if (firstProcess) { // try to find first available local port to host blazor on for (int i = StartScan; i < EndScan; i++) { if (IsPortAvailable(i)) { port = i; break; } } if (port != -1) { // start the kestrel server in a background thread var blazorTask = new Task(() => CreateHostBuilder(args, port).Build().Run(), TaskCreationOptions.LongRunning); blazorTask.Start(); // wait till its up while (IsPortAvailable(port)) { Thread.Sleep(1); } } // used to pass the port number to chromely child processes MemoryMappedFile mmf = MemoryMappedFile.CreateNew("BlazorTestMap", 4); MemoryMappedViewAccessor accessor = mmf.CreateViewAccessor(); accessor.Write(0, (int)port); } else { // fetch port number MemoryMappedFile mmf = MemoryMappedFile.CreateOrOpen("BlazorTestMap", 4); MemoryMappedViewAccessor accessor = mmf.CreateViewAccessor(); port = accessor.ReadInt32(0); } if (port != -1) { // start up chromely var core = typeof(IChromelyConfiguration).Assembly; var config = DefaultConfiguration.CreateForRuntimePlatform(); config.CefDownloadOptions = new CefDownloadOptions(true, true); config.WindowOptions.Position = new WindowPosition(1, 2); config.WindowOptions.Size = new WindowSize(1000, 600); config.StartUrl = $"https://127.0.0.1:{port}"; config.DebuggingMode = true; config.WindowOptions.RelativePathToIconFile = "chromely.ico"; try { var builder = AppBuilder.Create(); builder = builder.UseApp <TestApp>(); builder = builder.UseConfiguration <DefaultConfiguration>(config); builder = builder.Build(); builder.Run(args); } catch (Exception ex) { Console.WriteLine(ex); throw; } } mutex.ReleaseMutex(); }