static async Task UILoop(MessageProducer producer) { while (true) { var key = Console.ReadKey(true); switch (key.Key) { case ConsoleKey.Escape: case ConsoleKey.Q: return; case ConsoleKey.UpArrow: producer.Faster(); break; case ConsoleKey.DownArrow: producer.Slower(); break; case ConsoleKey.S: await producer.Spike(25); break; case ConsoleKey.P: await producer.Pause(); break; } } }