Esempio n. 1
0
        static void Main(string[] args)
        {
            Echo.Left("Left").Center("Center").Right("Right").Line();
            Echo.CoverLeft("Left").CoverCenter("Center").CoverRight("Right").Line();

            Echo.Ask("What's your name?", out string name, answer =>
            {
                if (answer.Value.IsNullOrWhiteSpace())
                {
                    answer.Action = AskAction.Retry;
                }
                else
                {
                    answer.Action = AskAction.Accept;
                    answer.Value  = answer.Value.CapitalizeFirst();
                }
            });
            Echo.Ask("What's your nickname?", out string nickname, "jj");
            Echo.Ask("How old are you?", out int age, 22);
            Echo.Ask($"Mottos:{Environment.NewLine}", out var mottos, endsWith: Environment.NewLine, -Environment.NewLine.Length);

            Echo.Line("Press ENTER to continue...")
            .PressContinue(ConsoleKey.Enter)
            .Line()
            .Line($"Hello, {name}!")
            .Line($"Your mottos are: {mottos.Replace(Environment.NewLine, " | ")}")
            .Line($"You can manage the following categories:")
            .Table(Categories);

            while (true)
            {
                Echo.AskYN("Exit? (Y/N) ", out var exit);
                if (exit)
                {
                    break;
                }
            }
        }