thirdmotion/strangeioc — pull request #28 by WillzZz (2013-09-04 21:17:14+00:00)
Title: SIgnals, SignalCommandMap, CrossContext, ContextRemoval

We've been in constant communication for this, so I'll keep it brief.

Signals: Modeled after AS3 Signals. Lightweight Delegate callback objects which are excellent communication layer for an IoC framework.

Sample:
Signal mySignal = new Signal();
int myValue = 3;
mySignal.AddListener(MyHandler); //add listener
mySignal.Dispatch(myValue); //call all listeners
mySignal.RemoveListener(MyHandler); //remove listener
mySignal.AddOnce(MyHandler); //Call once, and auto remove
private void MyHandler(int passedValue)
{
//Do stuff with your passed value(s)!
}
Signals can have up to 4 arguments.

SignalCommands: Signals can be mapped to Commands, and will automatically inject (with minor restrictions) these values in to their command.
CrossContext: Mapping an injection as CrossContext is now possible, which shares it across every injectionBinder. Any context extending CrossContext (this includes MVCSContext) will now have crosscontext functionality.

Sample:
injectionBinder.Bind().ToSingleton().CrossContext();

Any cross context injection binder will now have access to this injection, with no further work required.

ContextRemoval:
With the addition of Cross Context functionality, removal was necessary. All contexts will be removed during the OnDestroy state. Contexts should override void OnRemove() and call base.OnRemove() if necessary. Cleanup of binders is also introduced, every binder has a base method void OnRemove(). For an example implementation, see SignalCommandBinder.OnRemove()