예제 #1
0
        private static async Task GetInput(TeleprompterConfig config)
        {
            Action work = () =>
            {
                do
                {
                    var key = Console.ReadKey(true);

                    if (key.KeyChar == '>')
                    {
                        config.UpdateDelay(-10);
                    }
                    else if (key.KeyChar == '<')
                    {
                        config.UpdateDelay(10);
                    }
                    else if (key.KeyChar == 'X' || key.KeyChar == 'x')
                    {
                        config.SetDone();
                    }
                } while (!config.Done);
            };

            await Task.Run(work);
        }
예제 #2
0
        public void SetDone_SetsDoneToTrue()
        {
            var config = new TeleprompterConfig();

            config.SetDone();

            Assert.True(config.Done);
        }
예제 #3
0
        static async Task ShowTeleprompter(TeleprompterConfig config)
        {
            var lines = ReadFile(fileNameConst);

            foreach (var line in lines)
            {
                Console.Write(line);
                if (!string.IsNullOrWhiteSpace(line))
                {
                    await Task.Delay(config.DelayInMiliseconds);
                }
            }
            config.SetDone();
        }
예제 #4
0
        private static async Task ShowTeleprompter(TeleprompterConfig config)
        {
            var words = ReadFrom("/Users/kernel_panic/sampleQuotes.txt");

            foreach (var word in words)
            {
                Console.Write(word);

                if (!string.IsNullOrWhiteSpace(word))
                {
                    await Task.Delay(config.DelayInMilliseconds);
                }
            }

            config.SetDone();
        }