Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jordansirwin/consolenav
A C# helper to easily manage navigation and menu's for Console Apps.
https://github.com/jordansirwin/consolenav
Last synced: about 2 months ago
JSON representation
A C# helper to easily manage navigation and menu's for Console Apps.
- Host: GitHub
- URL: https://github.com/jordansirwin/consolenav
- Owner: jordansirwin
- Created: 2014-07-18T21:06:42.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-07-19T00:11:14.000Z (over 10 years ago)
- Last Synced: 2024-03-15T13:34:32.989Z (10 months ago)
- Language: C#
- Size: 145 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ConsoleNav
==========A C# helper to easily manage navigation and menu's for Console Apps.
### Usage Example ###
![Example Menu](demo/Demo_1.PNG)
``` C#
using System;
using JSI;namespace SpecialToolsConsole
{
class Program
{
private static ConsoleNav _console;static void Main(string[] args)
{
_console = new ConsoleNav();_console.DrawHeader("** Special Tools Console **");
_console.RunMenu(CreateMainMenu());
_console.DrawHeader("Exiting! (Press any key to close this window)");Console.ReadLine();
}public static ConsoleMenu CreateMainMenu()
{
return new ConsoleMenu
{
Title = "Main Menu",
MenuItems = new[]{
new ConsoleMenuItem {
Method = DisplayTest,
Label = "Display test text"
},
new ConsoleMenuItem {
Method = Submenu,
Label = "Goto submenu"
}}
};
}public static ConsoleMenu CreateSubMenu(string title)
{
return new ConsoleMenu
{
ExitMenuItem = new ConsoleMenuItem{
Label = "Back"
},
Title = title,
MenuItems = new[]{
new ConsoleMenuItem {
Method = DisplayTest,
Label = "Test"
},
new ConsoleMenuItem {
Method = Submenu,
Label = "Goto submenu"
}}
};
}public static void DisplayTest(ConsoleMenu menu, ConsoleMenuItem selectedItem)
{
Console.WriteLine("TEST!");
}public static void Submenu(ConsoleMenu menu, ConsoleMenuItem selectedItem)
{
_console.RunMenu(CreateSubMenu(menu.Title + ":Submenu"));
}
}
}