Lesson 6 - fase 1

This commit is contained in:
2025-08-08 09:06:18 +02:00
parent 0a819704f3
commit ef4a8202ae

View File

@ -43,11 +43,34 @@
//// .DefaultValue("Yes") //// .DefaultValue("Yes")
////); ////);
////AnsiConsole.MarkupLine($"Happy: {happyText}\nAge: {age}"); ////AnsiConsole.MarkupLine($"Happy: {happyText}\nAge: {age}");
#endregion
// Lesson 5 - Item Selection // Lesson 5 - Item Selection
List<string> names = [ ////List<string> names = [
//// "Tim Corey",
//// "Sue Storm",
//// "Bilbo Baggins",
//// "John Doe",
//// "Princess Donaut",
//// "Steve Rogers"
////];
////string favoriteName = AnsiConsole.Prompt(
//// new SelectionPrompt<string>()
//// .Title("Which is your favorite placeholder name?")
//// .PageSize(4)
//// .MoreChoicesText("[grey](Move up and down to reveal more choices)[/]")
//// .AddChoices(names)
////);
////AnsiConsole.MarkupLine($"Your favorite name is: [bold red]{favoriteName}[/].");
#endregion
// Lesson 6
List<string> usualNames = [
"Tim Corey", "Tim Corey",
"Sue Storm", "Sue Storm",
"Bilbo Baggins", "Bilbo Baggins",
@ -56,15 +79,26 @@ List<string> names = [
"Steve Rogers" "Steve Rogers"
]; ];
string favoriteName = AnsiConsole.Prompt( List<string> familyNames = [
new SelectionPrompt<string>() "Charity",
.Title("Which is your favorite placeholder name?") "Jon",
.PageSize(4) "Chris"
.MoreChoicesText("[grey](Move up and down to reveal more choices)[/]") ];
.AddChoices(names)
List<string> favoriteName = AnsiConsole.Prompt(
new MultiSelectionPrompt<string>()
.Title("Which are your favorite placeholder names?")
.InstructionsText(
"[grey](Press [blue]<space>[/] to toggle selection, " +
"[green]<enter>[/] to accept)[/]")
.AddChoices(usualNames)
); );
AnsiConsole.MarkupLine($"Your favorite name is: [bold red]{favoriteName}[/]."); foreach (string name in favoriteName)
{
AnsiConsole.MarkupLine($"[bold red]{name}[/]");
}
Console.ReadLine(); Console.ReadLine();
AnsiConsole.Clear(); AnsiConsole.Clear();