C# Класс 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 ();
Наследование: CMenuItem
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
ImmediateMenuMode bool
PromptCharacter string

Открытые методы

Метод Описание
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.

Описание методов

CMenu() публичный Метод

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
Результат System

Execute() публичный Метод

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. ///
Результат void

Quit() публичный Метод

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

Processing can be restarted by calling Run again.

public Quit ( ) : void
Результат void

Run() публичный Метод

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
Результат void

Описание свойств

ImmediateMenuMode публичное свойство

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
Результат bool

PromptCharacter публичное свойство

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
Результат string