Class CommandMessageCallback<T>
Event callback for received messages and events.
Inherited Members
Namespace: TehGM.Wolfringo.Utilities.Internal
Assembly: Wolfringo.Core.dll
Syntax
public class CommandMessageCallback<T> : TypedMessageCallback<T>, IMessageCallback, IEquatable<TypedMessageCallback<T>> where T : IWolfMessage
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
This interface is designed to allow invoking callback conditionally. If TryInvoke(IWolfMessage) returns false, it doesn't meant invoking failed - it means that callback determined it should not invoke for the provided message.
This callback will only invoke if message is of type T,
and message's EventName is the same as the one provided in class constructor.
Constructors
| Improve this Doc View SourceCommandMessageCallback(String, Action<T>)
Creates callback instance.
Declaration
public CommandMessageCallback(string command, Action<T> callback)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | command | Command that must be matched for message to execute the callback. |
| System.Action<T> | callback | Method to invoke when this callback invokes. |
Properties
| Improve this Doc View SourceCommand
Callback will be invoked for messages with command matching this value.
Declaration
public string Command { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Methods
| Improve this Doc View SourceTryInvoke(IWolfMessage)
Attempts to invoke the callback.
Declaration
public override bool TryInvoke(IWolfMessage message)
Parameters
| Type | Name | Description |
|---|---|---|
| IWolfMessage | message | Message to attempt invoking the callback for. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if callback was invoked; otherwise false. |
Overrides
Remarks
This callback will only invoke if message is of type T,
and message's EventName is the same as the one provided in class constructor.