main
1using Castle.Core.Interceptor;
2using gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy;
3using gorilla.commons.utility;
4
5namespace momoney.service.infrastructure.threading
6{
7 public class RunOnUIThread : IInterceptor
8 {
9 readonly ISynchronizationContextFactory factory;
10
11 public RunOnUIThread() : this(Lazy.load<ISynchronizationContextFactory>()) {}
12
13 public RunOnUIThread(ISynchronizationContextFactory factory)
14 {
15 this.factory = factory;
16 }
17
18 public void Intercept(IInvocation invocation)
19 {
20 factory.create().run(new AnonymousCommand(invocation.Proceed));
21 }
22 }
23}