Beispiel #1
0
 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();
     }
 }
Beispiel #2
0
 public Task Invoke(T arg)
 {
     return(ContextRunner.Run(() => WeakAction.Execute(arg)));
 }
Beispiel #3
0
 public ContextAction(WeakAction <T> wa)
     : this(Exec.RunningTaskScheduler, wa)
 {
 }
Beispiel #4
0
 public ContextAction(TaskScheduler scheduler, WeakAction <T> wa)
     : this(scheduler.ToContextRunner(), wa)
 {
 }
Beispiel #5
0
 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))));
 }
Beispiel #7
0
 public static ContextAction <T1, T2> InContext <T1, T2>(this WeakAction <T1, T2> wa)
 {
     return(new ContextAction <T1, T2>(wa));
 }
Beispiel #8
0
 public Task Invoke(T1 arg1, T2 arg2)
 {
     return(ContextRunner.Run(() => WeakAction.Execute(arg1, arg2)));
 }
Beispiel #9
0
 public static ContextAction <T1, T2> InContext <T1, T2>(this WeakAction <T1, T2> wa, TaskScheduler scheduler)
 {
     return(new ContextAction <T1, T2>(scheduler, wa));
 }
Beispiel #10
0
 public static ContextAction <T1, T2> InContext <T1, T2>(this WeakAction <T1, T2> wa, AsyncContextRunner context)
 {
     return(new ContextAction <T1, T2>(context, wa));
 }
Beispiel #11
0
 public static ContextAction InContext(this WeakAction wa)
 {
     return(new ContextAction(wa));
 }
Beispiel #12
0
 public static ContextAction InContext(this WeakAction wa, TaskScheduler scheduler)
 {
     return(new ContextAction(scheduler, wa));
 }
Beispiel #13
0
 public static ContextAction InContext(this WeakAction wa, AsyncContextRunner context)
 {
     return(new ContextAction(context, wa));
 }