/// <inheritdoc /> public bool Send <TData>(SignalType <TData> signalType, TData data) { RemovePendingRemovals(); var wrapper = (ListWrapper <TData>)_node.Registry.Find(signalType); if (wrapper == null) { return(false); } using (var options = SignalListenerContext.Push()) { for (int index = 0; options.ShouldContinue && index < wrapper.RegisteredListeners.Count; index++) { var item = wrapper.RegisteredListeners[index]; var instance = _sources[item.InstanceIndex]; item.SignalListener(instance, data); } } return(true); }
/// <summary> Registers this object. </summary> /// <exception cref="ArgumentException"> Thrown when one or more arguments have unsupported or /// illegal values. </exception> /// <typeparam name="TData"> The type of data that the signal sends. </typeparam> /// <param name="signalType"> The type of signal to register a call back for. </param> /// <param name="callback"> The callback to register. </param> /// <param name="priority"> The priority if the callback. </param> /// <returns> /// The TypedBasedRegistery that the method was invoked on, for fluent chaining. /// </returns> public TypedBasedRegistry <T> Register <TData>(SignalType <TData> signalType, Action <T, TData> callback, int priority = AllPriorities.Normal) { if (typeof(TData) == typeof(EmptyArg)) { throw new ArgumentException("Cannot use empty args for registration"); } _registry.Register <TData>(signalType, (obj, data) => callback((T)obj, data), priority); return(this); }
/// <summary> Registers this object. </summary> /// <param name="signalType"> The type of signal to register a call back for. </param> /// <param name="callback"> The callback to register. </param> /// <param name="priority"> The priority if the callback. </param> /// <returns> /// The TypedBasedRegistery that the method was invoked on, for fluent chaining. /// </returns> public TypedBasedRegistry <T> Register(SignalType signalType, Action <T> callback, int priority = AllPriorities.Normal) { _registry.Register <EmptyArg>(signalType, (obj, data) => callback((T)obj), priority); return(this); }
/// <inheritdoc /> public bool Supports <TData>(SignalType <TData> signalType) { RemovePendingRemovals(); return(_node.Registry.Find(signalType) != null); }
/// <inheritdoc /> public bool Send(SignalType signalType) { RemovePendingRemovals(); return(Send <EmptyArg>(signalType, null)); }
bool ISignalSender.Send(SignalType signalType) { return(false); }
bool ISignalSender.Send <TData>(SignalType <TData> signalType, TData data) { return(false); }
public bool Supports <TData>(SignalType <TData> signalType) { return(false); }