main
1using System;
2using gorilla.commons.utility;
3using momoney.service.infrastructure.threading;
4
5namespace MoMoney.Presentation.Presenters
6{
7 public interface IProcessQueryCommand<T> : ParameterizedCommand<Callback<T>> {}
8
9 public class ProcessQueryCommand<T> : IProcessQueryCommand<T>
10 {
11 readonly Query<T> query;
12 readonly ISynchronizationContextFactory factory;
13
14 public ProcessQueryCommand(Query<T> query, ISynchronizationContextFactory factory)
15 {
16 this.query = query;
17 this.factory = factory;
18 }
19
20 public void run(Callback<T> callback)
21 {
22 var dto = query.fetch();
23 factory.create().run(new AnonymousCommand((Action) (() => callback.run(dto))));
24 }
25 }
26}