private void _invoke(WeakAction listener, object oldValue, object newValue) { if (listener is IWeakActionWithParam2) { (listener as IWeakActionWithParam2).ExecuteWithObject(oldValue, newValue); } else if (listener is IWeakActionWithParam1) { (listener as IWeakActionWithParam1).ExecuteWithObject(newValue); } else { listener.Execute(); } }
public Task Invoke(T arg) { return(ContextRunner.Run(() => WeakAction.Execute(arg))); }
public ContextAction(WeakAction <T> wa) : this(Exec.RunningTaskScheduler, wa) { }
public ContextAction(TaskScheduler scheduler, WeakAction <T> wa) : this(scheduler.ToContextRunner(), wa) { }
public ContextAction(AsyncContextRunner contextRunner, WeakAction <T> wa) { WeakAction = wa; ContextRunner = contextRunner; }
public ContextMulticastAction Add(WeakAction wa, AsyncContextRunner runner) { return(new ContextMulticastAction(_actions.Concat(wa.InContext(runner)))); }
public static ContextAction <T1, T2> InContext <T1, T2>(this WeakAction <T1, T2> wa) { return(new ContextAction <T1, T2>(wa)); }
public Task Invoke(T1 arg1, T2 arg2) { return(ContextRunner.Run(() => WeakAction.Execute(arg1, arg2))); }
public static ContextAction <T1, T2> InContext <T1, T2>(this WeakAction <T1, T2> wa, TaskScheduler scheduler) { return(new ContextAction <T1, T2>(scheduler, wa)); }
public static ContextAction <T1, T2> InContext <T1, T2>(this WeakAction <T1, T2> wa, AsyncContextRunner context) { return(new ContextAction <T1, T2>(context, wa)); }
public static ContextAction InContext(this WeakAction wa) { return(new ContextAction(wa)); }
public static ContextAction InContext(this WeakAction wa, TaskScheduler scheduler) { return(new ContextAction(scheduler, wa)); }
public static ContextAction InContext(this WeakAction wa, AsyncContextRunner context) { return(new ContextAction(context, wa)); }