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
textHandlerITerminalTextHandlercommandDescriptorsIEnumerable<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
idstringThe command id.
commandDescriptorCommandDescriptorThe 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
idstringThe command id.
commandDescriptorCommandDescriptorThe CommandDescriptor if found, otherwise
null
Returns
Remarks
This method should never throw an exception. If the command is not found then return false.