public CompositionRoot(IDomainEventChannelFactory domainEventChannelFactory, IGameBuilder gameBuilder, IUICommandChannelFactory commandChannelFactory, IGameViewFactory gameViewFactory) { this.GameId = Guid.NewGuid(); this.domainEventChannel = MaybeConvertions.ToMaybe(domainEventChannelFactory.Create()); // Application gameService = new GameService(this.domainEventChannel, new GameInMemoryRepository(), gameBuilder); gameService.GenerateNewGame(this.GameId); // View this.uiCommandChannel = commandChannelFactory.Create(); this.gameView = gameViewFactory.Create(this.uiCommandChannel); // Handlers this.fromUICommandsToDomainHandler = new FromUICommandsToDomainHandler(this.uiCommandChannel, this.gameService, this.GameId); this.fromDomainEventsToViewHandler = new FromDomainEventsToViewHandler(this.domainEventChannel, this.gameView); }
public CompositionRoot(IDomainEventChannelFactory domainEventChannelFactory, IGameBuilder gameBuilder, IUICommandChannelFactory commandChannelFactory, IGameViewFactory gameViewFactory) { // Domain this.domainEventChannel = domainEventChannelFactory.Create(); this.game = gameBuilder.Create(this.domainEventChannel); // View this.uiCommandChannel = commandChannelFactory.Create(); this.gameView = gameViewFactory.Create(this.uiCommandChannel); // Handlers this.fromUICommandsToDomainHandler = new FromUICommandsToDomainHandler(this.uiCommandChannel, this.game); this.fromDomainEventsToViewHandler = new FromDomainEventsToViewHandler(this.domainEventChannel, this.gameView); }
public GameView(IUICommandChannel uiCommandChannel) { this.uiCommandChannel = uiCommandChannel; }
public FromUICommandsToDomainHandler(IUICommandChannel UICommandChannel, IGame game) { this.game = game; UICommandChannel.AddSubscriber(this); }
public IGameView Create(IUICommandChannel uiCommandChannel) { return(new GameView(uiCommandChannel)); }
public FromUICommandsToDomainHandler(IUICommandChannel UICommandChannel, GameService gameService, Guid GameId) { this.GameId = GameId; this.gameService = gameService; UICommandChannel.AddSubscriber(this); }