Class InteractiveListener<T>
Listener allowing to await next message that matches specified conditions.
Inheritance
System.Object
InteractiveListener<T>
Implements
Namespace: TehGM.Wolfringo.Utilities.Interactive
Assembly: Wolfringo.Utilities.Interactive.dll
Syntax
public class InteractiveListener<T> : IInteractiveListener<T> where T : IWolfMessage
Type Parameters
| Name | Description |
|---|---|
| T | Type of message |
Constructors
| Improve this Doc View SourceInteractiveListener(Func<T, Boolean>)
Creates a new interactive listener.
Declaration
public InteractiveListener(Func<T, bool> conditions)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Func<T, System.Boolean> | conditions | Conditions that received message needs to match. |
Methods
| Improve this Doc View SourceAwaitNextAsync(IWolfClient, CancellationToken)
Awaits next message of given type.
Declaration
public async Task<T> AwaitNextAsync(IWolfClient client, CancellationToken cancellationToken = default(CancellationToken))
Parameters
| Type | Name | Description |
|---|---|---|
| IWolfClient | client | Client to await message from. |
| System.Threading.CancellationToken | cancellationToken | Token that will cancel the awaiting. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<T> | Next message. |