-
-
Notifications
You must be signed in to change notification settings - Fork 5
TextMenu
Iuga Alexandru edited this page Sep 2, 2018
·
7 revisions
Displays a list of items and asks the user to select one by typing its id. When an item is selected, if it has an associated command, it is executed.
Please see also the demo application.
private void DisplayMenu()
{
TextMenu textMenu = new TextMenu
{
Title = new TextBlock
{
Text = "Demo Application",
ForegroundColor = ConsoleColor.Cyan,
MarginBottom = 1
},
MarginTop = 1,
MarginBottom = 1,
EraseAfterClose = true,
};
textMenu.AddItems(new List<TextMenuItem>
{
new TextMenuItem
{
Id = "1",
Text = "New Game",
Command = new NewGameCommand()
},
new TextMenuItem
{
Id = "2",
Text = "Save Game",
Command = new SaveGameCommand()
},
new TextMenuItem
{
Id = "3",
Text = "Load Game",
Command = new LoadGameCommand()
}
});
textMenu.Display();
}