Open charga opened 1 month ago
Hi,
Display
method to be executed inside a while (true)
loop
Here is an example:internal static class Program
{
public static bool ExitWasRequested { get; set; }
private static void Main(string[] args)
{
ScrollMenu scrollMenu = new();
scrollMenu.AddItems(new[]
{
new LabelMenuItem
{
Text = "Item 1",
Command = new Item1Command()
},
new LabelMenuItem
{
Text = "Item 2",
Command = new Item2Command()
},
new LabelMenuItem
{
Text = "Item 3",
Command = new Item3Command()
},
new LabelMenuItem
{
Text = "Exit",
Command = new ExitCommand()
}
}
);
while (!ExitWasRequested)
scrollMenu.Display();
}
}
internal class Item1Command : ICommand
{
public bool IsActive => true;
public void Execute()
{
CustomConsole.WriteLine("Item 1 was selected.");
}
}
internal class Item2Command : ICommand
{
public bool IsActive => true;
public void Execute()
{
CustomConsole.WriteLine("Item 2 was selected.");
}
}
internal class Item3Command : ICommand
{
public bool IsActive => true;
public void Execute()
{
CustomConsole.WriteLine("Item 3 was selected.");
}
}
internal class ExitCommand : ICommand
{
public bool IsActive => true;
public void Execute()
{
CustomConsole.WriteLine("Exit was selected.");
Program.ExitWasRequested = true;
}
}
Attached ticket: #107
I made a quick fix and released the version 1.2.1 Check if it is working for you now.
I'm starting using this tools , but have some questions
It's the a sample like that? How can I do?
Regards