summaryrefslogtreecommitdiff
path: root/product/client/client.ui/presenters/WpfCommandBuilder.cs
blob: 47b1350e64da8e1b2f3cd9b2a1c098f4f2d84f5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using Autofac;

namespace presentation.windows.presenters
{
    public class WpfCommandBuilder : UICommandBuilder
    {
        IContainer container;

        public WpfCommandBuilder(IContainer container)
        {
            this.container = container;
        }

        public IObservableCommand build<T>(Presenter presenter) where T : UICommand
        {
            var command = container.Resolve<T>();
            return new SimpleCommand(() =>
            {
                command.run(presenter);
            });
        }
    }
}