C# Class ConsoleMenu.CMenu

A console menu structure, comprised of various menu items. To create a menu which displays the current time: var menu = new CMenu (); menu.Add ("time", s => Console.WriteLine (DateTime.UtcNow)); menu.Run ();
Inheritance: CMenuItem
Afficher le fichier Open project: nerai/CMenu Class Usage Examples

Méthodes publiques

Свойство Type Description
ImmediateMenuMode bool
PromptCharacter string

Méthodes publiques

Méthode Description
CMenu ( string selector = null, bool addDefaultItems = true ) : System

Create a new CMenu.

Iff no selector was specified, the menu will initially contain the following commands: help quit

Execute ( string arg ) : void

If this item gets selected in its parent menu, run it as a menu itself.

Quit ( ) : void

Stops menu processing. Control will return to the parent menu.

Processing can be restarted by calling Run again.

Run ( ) : void

Start console prompting and processing.

Immediately before processing begins, the event OnRun is called. Immediately after processing has ended, the event OnQuit called.

Method Details

CMenu() public méthode

Create a new CMenu.

Iff no selector was specified, the menu will initially contain the following commands: help quit

public CMenu ( string selector = null, bool addDefaultItems = true ) : System
selector string
addDefaultItems bool
Résultat System

Execute() public méthode

If this item gets selected in its parent menu, run it as a menu itself.
public Execute ( string arg ) : void
arg string /// If an additional nonnull, nonwhitespace argument is given, it will be executed /// in the local menu context immediately. ///
Résultat void

Quit() public méthode

Stops menu processing. Control will return to the parent menu.

Processing can be restarted by calling Run again.

public Quit ( ) : void
Résultat void

Run() public méthode

Start console prompting and processing.

Immediately before processing begins, the event OnRun is called. Immediately after processing has ended, the event OnQuit called.

public Run ( ) : void
Résultat void

Property Details

ImmediateMenuMode public_oe property

In immediate mode, instead of typing the name of a command, only a number associated with each command is entered. All available commands and their numbers will be displayed at any opportunity.
public bool ImmediateMenuMode
Résultat bool

PromptCharacter public_oe property

The string which is displayed in front of every prompt (i.e. query for user input).

Set to null if no prompt should be displayed.

public string PromptCharacter
Résultat string