Class TerminalInMemoryCommandStore
The default in-memory ITerminalCommandStore.
public class TerminalInMemoryCommandStore : ITerminalCommandStore
- Inheritance
-
TerminalInMemoryCommandStore
- Implements
- Inherited Members
Constructors
TerminalInMemoryCommandStore(ITerminalTextHandler, IEnumerable<CommandDescriptor>)
Initialize a new instance.
public TerminalInMemoryCommandStore(ITerminalTextHandler textHandler, IEnumerable<CommandDescriptor> commandDescriptors)
Parameters
textHandler
ITerminalTextHandlercommandDescriptors
IEnumerable<CommandDescriptor>The command identities.
Methods
AllAsync()
Returns all command descriptors asynchronously.
public Task<CommandDescriptors> AllAsync()
Returns
- Task<CommandDescriptors>
A ReadOnlyDictionary<TKey, TValue> of command descriptors.
TryAddAsync(string, CommandDescriptor)
Adds a CommandDescriptor to the store.
public Task<bool> TryAddAsync(string id, CommandDescriptor commandDescriptor)
Parameters
id
stringThe command id.
commandDescriptor
CommandDescriptorThe command descriptor to add.
Returns
TryFindByIdAsync(string, out CommandDescriptor?)
Attempts to finds a CommandDescriptor by its id asynchronously.
public Task<bool> TryFindByIdAsync(string id, out CommandDescriptor? commandDescriptor)
Parameters
id
stringThe command id.
commandDescriptor
CommandDescriptorThe CommandDescriptor if found, otherwise
null
Returns
Remarks
This method should never throw an exception. If the command is not found then return false
.