Wolfringo Wolfringo
Wolfringo Wolfringo
Wolfringo (c) 2020 TehGM
DocFX, DiscordFX theme.
Search Results for

    Class TypedMessageCallback<T>

    Event callback for received messages and events.

    Inheritance
    System.Object
    TypedMessageCallback<T>
    CommandMessageCallback<T>
    Implements
    IMessageCallback
    System.IEquatable<TypedMessageCallback<T>>
    Namespace: TehGM.Wolfringo.Utilities.Internal
    Assembly: Wolfringo.Core.dll
    Syntax
    public class 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.

    Constructors

    | Improve this Doc View Source

    TypedMessageCallback(Action<T>)

    Creates callback instance.

    Declaration
    public TypedMessageCallback(Action<T> callback)
    Parameters
    Type Name Description
    System.Action<T> callback

    Method to invoke when this callback invokes.

    Properties

    | Improve this Doc View Source

    CallbackInfo

    Method to invoke.

    Declaration
    public MethodInfo CallbackInfo { get; }
    Property Value
    Type Description
    System.Reflection.MethodInfo

    Methods

    | Improve this Doc View Source

    Equals(Object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    System.Object.Equals(System.Object)
    | Improve this Doc View Source

    Equals(TypedMessageCallback<T>)

    Declaration
    public bool Equals(TypedMessageCallback<T> other)
    Parameters
    Type Name Description
    TypedMessageCallback<T> other
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    System.Object.GetHashCode()
    | Improve this Doc View Source

    TryInvoke(IWolfMessage)

    Attempts to invoke the callback.

    Declaration
    public virtual 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.

    Remarks

    Callback will only invoke if message is of type T.

    Implements

    IMessageCallback
    System.IEquatable<T>