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