示例#1
0
        public async Task OnExecute(IConsole console)
        {
            console.WriteLine("Starting Boost UI...");
            var port = NetworkExtensions.GetAvailablePort(Port);

            if (port != Port)
            {
                console.WriteLine($"Port {Port} is allready in use.", ConsoleColor.Yellow);
                var useOther = Prompt.GetYesNo($"Start UI on port: {port}", true);

                if (useOther)
                {
                    Port = port;
                }
                else
                {
                    return;
                }
            }
            _webServer.LogLevel = LogLevel;

            var url = await _webServer.StartAsync(Port);

            if (!Debugger.IsAttached)
            {
                if (Path is { })
        async Task IBackgroundService.Execute(CancellationToken cancellationToken)
        {
            await _WebServer.StartAsync();

            await cancellationToken.AsTask();

            await _WebServer.StopAsync();
        }
示例#3
0
 public Task StartAsync() => _server.StartAsync(_handler);