BlueCollar.Console.Program.WaitForInput C# (CSharp) Method

WaitForInput() private method

private WaitForInput ( ) : void
return void
        private static void WaitForInput()
        {
            while (isRunning)
            {
                string input = (Console.ReadLine() ?? string.Empty).Trim().ToUpperInvariant();

                if (input == "EXIT")
                {
                    Console.WriteLine();
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("Waiting for all workers to stop...");
                    Console.ResetColor();
                    Console.WriteLine();

                    isRunning = false;

                    lock (Locker)
                    {
                        if (bootstraps != null)
                        {
                            bootstraps.Pushdown(false);
                            bootstraps.Dispose();
                            bootstraps = null;
                        }
                    }
                }
                else if (input == "FORCE")
                {
                    isRunning = false;

                    lock (Locker)
                    {
                        if (bootstraps != null)
                        {
                            bootstraps.Dispose();
                            bootstraps = null;
                        }
                    }
                }
                else if (!string.IsNullOrEmpty(input))
                {
                    Console.WriteLine();
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Unrecognized command.");
                    Console.WriteLine();
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("Type 'exit' to shutdown gracefully, or Ctl+C to exit immediately.");
                    Console.ResetColor();
                    Console.WriteLine();
                }
            }
        }