- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
Latest commit
64 lines (49 loc) · 2.24 KB
/
Copy pathProgram.cs
File metadata and controls
64 lines (49 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
usingSystem;
usingEasyMenu.Models;
namespaceEasyMenu.Example
{
internalclassProgram
{
staticvoidMain()
{
Console.Title="https://github.com/biitez/EasyMenu";
// BreadCrumbHeader (boolean - default: false) = Enable/disable display of navigation between pages
// UserInputMessage (string - default: "Choose your option") = The message that the user will be prompted to type the option
MenuBuilderMenuSettings=newMenuBuilder(BreadCrumbHeader:true,UserInputMessage:"Choose:")
// You can add lambda expressions
.WithMenu("Page A",()=>{Console.WriteLine("Hi from Page A!");})
// or.. directly call an (a)synchronous method
.WithMenu("Page B",MyMethod)
// or.. make a sub menus
.WithMenu("Page C",new[]
{
// Inside you can do exactly the same as in .WithMenu
newMenu("SubPage A",()=>{Console.WriteLine("Hi from SubPage A!");}),
// Also you can create all the SubMenus you want within others
newMenu("SubPage B",new[]
{
newMenu("SubPage BA",()=>{Console.WriteLine("Hi from SubPage BA!");}),
newMenu("SubPage BB",()=>{Console.WriteLine("Hi from SubPage BB!");}),
// (...)
})
});
// Page > Page2 > Page3
MenuSettings.HeadNavigationSeparator=">";// Optional
// Page > Page2 > Page3
// --- <- this
// [1] (...)
MenuSettings.HeadNavigationMenuSeparator="---";// Optional
// The error message input
MenuSettings.ErrorUserInput="Invalid Input!";// Optional
// Build to MenuConsole
MenuConsoleconsoleMenu=MenuSettings.Build();
// Display menu - UpdateConsole (Optional): Refresh the console after there is an error
consoleMenu.Show(UpdateConsole:true);
Console.ReadLine();
}
staticvoidMyMethod()
{
Console.WriteLine("Hi from MyMethod!");
}
}
}