C# Класс PowerArgs.ContextAssistSearch

A context assist provider that lets a user search for an option. The class is abstract. Implementors just need to define the search implementation and this class will do the rest.
Наследование: IContextAssistProvider
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
parentReaderContext RichCommandLineContext

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

Метод Описание
CanAssist ( RichCommandLineContext parentContext ) : bool

Always returns true. When overrided in a derived class the derived class can provide custom logic to determine whether or not this assist provider can assist.

ClearMenu ( RichCommandLineContext notUsed ) : void

Clears the menu from the console

ContextAssistSearch ( ) : System

Initializes the search assist class

DrawMenu ( RichCommandLineContext parentContext ) : ContextAssistResult

Writes the prompt message and takes over the console until the user makes a selection or cancels via the escape key. This method never returns a NoOp result.

OnKeyboardInput ( RichCommandLineContext parentReaderContext, ConsoleKeyInfo keyPress ) : ContextAssistResult

This is not implemented because this assist provider always takes over the console during the draw menu.

Search ( IConsoleProvider console = null, bool allowCancel = true ) : ContextAssistSearchResult

Performs a standalone search and cleans up the menu at the end.

Защищенные методы

Метод Описание
GetResults ( string searchString ) : List

When implemented in the derived class, gets search results that match the search string. This ONLY gets called if SupportsAsync returns false.

GetResultsAsync ( string searchString ) : Task>

When implemented in the derived class, gets search results that match the search string asynchronously. This ONLY gets called if SupportsAsync returns true.

Приватные методы

Метод Описание
DoSearch ( string searchString ) : void
DoSearchInternal ( RichCommandLineContext parentContext, IConsoleProvider standaloneConsole, bool allowCancel ) : void
RedrawSearchResults ( ) : void
_MoveSelectedIndex ( int amount ) : void
_SearchReader_HandleEnterKey ( RichCommandLineContext searchReaderContext ) : void
_SearchReader_HandleKeyPressed ( RichCommandLineContext searchReaderContext ) : void

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

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

Always returns true. When overrided in a derived class the derived class can provide custom logic to determine whether or not this assist provider can assist.
public CanAssist ( RichCommandLineContext parentContext ) : bool
parentContext RichCommandLineContext context about the parent reader that we may be assisting
Результат bool

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

Clears the menu from the console
public ClearMenu ( RichCommandLineContext notUsed ) : void
notUsed RichCommandLineContext
Результат void

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

Initializes the search assist class
public ContextAssistSearch ( ) : System
Результат System

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

Writes the prompt message and takes over the console until the user makes a selection or cancels via the escape key. This method never returns a NoOp result.
public DrawMenu ( RichCommandLineContext parentContext ) : ContextAssistResult
parentContext RichCommandLineContext context about the parent reader that we are assisting
Результат ContextAssistResult

GetResults() защищенный абстрактный Метод

When implemented in the derived class, gets search results that match the search string. This ONLY gets called if SupportsAsync returns false.
protected abstract GetResults ( string searchString ) : List
searchString string the search string entered by the user
Результат List

GetResultsAsync() защищенный абстрактный Метод

When implemented in the derived class, gets search results that match the search string asynchronously. This ONLY gets called if SupportsAsync returns true.
protected abstract GetResultsAsync ( string searchString ) : Task>
searchString string the search string entered by the user
Результат Task>

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

This is not implemented because this assist provider always takes over the console during the draw menu.
public OnKeyboardInput ( RichCommandLineContext parentReaderContext, ConsoleKeyInfo keyPress ) : ContextAssistResult
parentReaderContext RichCommandLineContext not implemented
keyPress System.ConsoleKeyInfo not implemented
Результат ContextAssistResult

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

Performs a standalone search and cleans up the menu at the end.
public Search ( IConsoleProvider console = null, bool allowCancel = true ) : ContextAssistSearchResult
console IConsoleProvider Optionally choose a custom console target
allowCancel bool if true, users can cancel the search by pressing the escape key. If false, the escape key does nothing.
Результат ContextAssistSearchResult

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

parentReaderContext защищенное свойство

context about the parent reader that is only populated when used by a parent reader.
protected RichCommandLineContext parentReaderContext
Результат RichCommandLineContext