public KonsoleApplication Build() { var configBuilder = new ConfigurationBuilder(); var serviceCollection = new ServiceCollection(); var rootCmdBuilder = new CompositeCommandBuilder(); // -- running all actions on the builder allow consumers to manipulate the builder (in order) foreach (var action in _configActions) { action(configBuilder); } // -- build config so we can use it in the config service phase var config = configBuilder.Build(); foreach (var action in _serviceActions) { action(serviceCollection, config); } foreach (var action in _commandActions) { action(rootCmdBuilder, config); } var rootCommand = rootCmdBuilder.Build(); rootCommand.RegisterServices(serviceCollection); return(new KonsoleApplication(serviceCollection, config, rootCommand)); }
/// <summary> /// Allows the presenter to set up the view and model. /// </summary> protected override void Initialize() { var context = m_Container.Resolve <IContextAware>(); View.Model = new WelcomeModel(context) { CloseCommand = CreateCloseCommand(context), NewProjectCommand = CompositeCommandBuilder.CloseWelcomeViewAndInvokeCommand <NewProjectCommand>(m_Container), OpenProjectCommand = CompositeCommandBuilder.CloseWelcomeViewAndInvokeCommand <OpenProjectCommand>(m_Container), }; }
/// <summary> /// Allows the presenter to set up the view and model. /// </summary> protected override void Initialize() { var context = m_Container.Resolve <IContextAware>(); View.Model = new MenuModel(context); View.Model.NewProjectCommand = CompositeCommandBuilder.CloseWelcomeViewAndInvokeCommand <NewProjectCommand>(m_Container); View.Model.OpenProjectCommand = CompositeCommandBuilder.CloseWelcomeViewAndInvokeCommand <OpenProjectCommand>(m_Container); View.Model.SaveProjectCommand = m_Container.Resolve <SaveProjectCommand>(); View.Model.CloseProjectCommand = m_Container.Resolve <CloseProjectCommand>(); View.Model.ExitCommand = m_Container.Resolve <ExitCommand>(); View.Model.UndoCommand = m_Container.Resolve <UndoCommand>(); View.Model.RedoCommand = m_Container.Resolve <RedoCommand>(); View.Model.ShowStartPageCommand = m_Container.Resolve <ShowWelcomeViewTabCommand>(); View.Model.ShowProjectsCommand = m_Container.Resolve <ShowProjectsTabCommand>(); View.Model.ShowScriptsCommand = m_Container.Resolve <ShowScriptsTabCommand>(); View.Model.AboutCommand = m_Container.Resolve <ShowAboutWindowCommand>(); }