scriptsharp
scriptsharp copied to clipboard
MultiCastDelegate InvocationList
Without exposing the invocation list, things like CancelEventArgs or wrapping jQueryEvent or DomEvent is nearly impossible.
public class MultiCastDelegate
{
// Missing from S# implementation
public sealed override Delegate[] GetInvocationList();
}
Needed for 'Cancelable' patterns.
protected internal void OnItemClick(ItemClickEventArgs e)
{
bool cancel = false;
EventHandler<ItemClickEventArgs> handler = this.ItemClick;
if (handler != null)
{
foreach (EventHandler<ItemClickEventArgs> subscriber in handler.GetInvocationList())
{
subscriber(this, args);
if (args.Cancel)
{
cancel = true;
break;
}
}
}
if (!cancel) { /* ... */ }
}