main
 1using gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy;
 2using gorilla.commons.utility;
 3using MoMoney.Modules.Core;
 4using momoney.service.infrastructure.threading;
 5using MoMoney.Service.Infrastructure.Threading;
 6
 7namespace MoMoney.boot
 8{
 9    class start_the_application : Command
10    {
11        readonly IBackgroundThread thread;
12        readonly ILoadPresentationModulesCommand command;
13        readonly CommandProcessor processor;
14
15        public start_the_application(IBackgroundThread thread)
16            : this(thread, Lazy.load<ILoadPresentationModulesCommand>(), Lazy.load<CommandProcessor>()) {}
17
18        public start_the_application(IBackgroundThread thread, ILoadPresentationModulesCommand command,
19                                     CommandProcessor processor)
20        {
21            this.thread = thread;
22            this.command = command;
23            this.processor = processor;
24        }
25
26        public void run()
27        {
28            command.run();
29            processor.add(() => thread.Dispose());
30            processor.run();
31        }
32    }
33}