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