public void ShowConsole() { _consoleEnabled = ConsoleAllocator.Alloc(); Colorful.Console.BackgroundColor = BackgroundColor; Colorful.Console.ForegroundColor = TextColor; Colorful.Console.Clear(); }
/* Default constructor */ /// <summary> /// Creates a new console instance, asynchronously initializing the console. /// </summary> /// <param name="enabled">True if console is enabled, else false.</param> /// <param name="logger">The logger associated with the console.</param> /// <param name="proxy">Proxy to the system console behind the scenes.</param> public Console(bool enabled, Logger logger, IConsoleProxy proxy) { IsEnabled = enabled; if (!IsEnabled) { return; } _consoleProxy = proxy; _logger = logger; _logger.WaitForConsoleInitFunc = WaitForConsoleInit; _logger.OnWriteLine += OnWriteLine; _logger.OnWrite += OnWrite; Task.Run(() => { var consoleAllocated = ConsoleAllocator.Alloc(); if (!consoleAllocated) { return; } _consoleCtrlDelegate = NotifyOnConsoleClose; Kernel32.SetConsoleCtrlHandler(_consoleCtrlDelegate, true); _consoleProxy.SetBackColor(_logger.BackgroundColor); _consoleProxy.SetForeColor(_logger.TextColor); _consoleProxy.Clear(); ReloadedBannerLogger.PrintBanner(proxy, logger); IsReady = true; FlushQueuedMessages(); }); }