private void RegisterServices() { var endpoint = loginSettings.Endpoint; var serverUserService = new UserService(endpoint); Guid sessionId; using (var channelManager = serverUserService.CreateChannelManager()) using (var channel = channelManager.CreateChannel()) { var currentUser = channel.Service.UserLogin(loginSettings.User, loginSettings.Password).Result as Administrator; sessionId = currentUser.SessionId; Container.RegisterInstance(currentUser); } Container.RegisterInstance(serverUserService); Container.RegisterType<ChannelManager<IServerTcpService>> (new InjectionFactory(c => serverUserService.CreateChannelManager(sessionId))); var serverService = new ServerService(endpoint); Container.RegisterInstance(serverService); Container.RegisterType<ChannelManager<IServerTcpService>> (new InjectionFactory(c => serverService.CreateChannelManager(sessionId))); var queuePlanService = new QueuePlanService(endpoint); Container.RegisterInstance(queuePlanService); Container.RegisterType<DuplexChannelManager<IQueuePlanTcpService>> (new InjectionFactory(c => queuePlanService.CreateChannelManager(sessionId))); var templateService = new TemplateService(endpoint); Container.RegisterInstance(templateService); Container.RegisterType<ChannelManager<ITemplateTcpService>> (new InjectionFactory(c => templateService.CreateChannelManager(sessionId))); var theme = string.IsNullOrEmpty(portalSettings.Theme) ? Templates.Themes.Default : portalSettings.Theme; var templateManager = new TemplateManager(Templates.Apps.Common, theme); Container.RegisterInstance<ITemplateManager>(templateManager); }
private static void RegisterServices() { serverService = new ServerService(endpoint); container.RegisterInstance(serverService); container.RegisterType<ChannelManager<IServerTcpService>> (new InjectionFactory(c => serverService.CreateChannelManager(sessionId))); userService = new UserService(endpoint); container.RegisterInstance(userService); container.RegisterType<ChannelManager<IUserTcpService>> (new InjectionFactory(c => userService.CreateChannelManager(sessionId))); templateService = new TemplateService(endpoint); container.RegisterInstance(templateService); container.RegisterType<ChannelManager<ITemplateTcpService>> (new InjectionFactory(c => templateService.CreateChannelManager(sessionId))); workplaceService = new WorkplaceService(endpoint); container.RegisterInstance(workplaceService); container.RegisterType<ChannelManager<IWorkplaceTcpService>> (new InjectionFactory(c => workplaceService.CreateChannelManager(sessionId))); queuePlanService = new QueuePlanService(endpoint); container.RegisterInstance(queuePlanService); container.RegisterType<DuplexChannelManager<IQueuePlanTcpService>> (new InjectionFactory(c => queuePlanService.CreateChannelManager(sessionId))); lifeSituationService = new LifeSituationService(endpoint); container.RegisterInstance(lifeSituationService); container.RegisterType<ChannelManager<ILifeSituationTcpService>> (new InjectionFactory(c => lifeSituationService.CreateChannelManager(sessionId))); var theme = string.IsNullOrEmpty(administratorSettings.Theme) ? Templates.Themes.Default : administratorSettings.Theme; templateManager = new TemplateManager(Templates.Apps.Common, theme); container.RegisterInstance<ITemplateManager>(templateManager); }
private void RegisterTemplateManagers() { templateManager = new TemplateManager(Templates.Apps.Terminal, AppSettings.Theme); commonTemplateManager = new CommonTemplateManager(AppSettings.Theme); UnityContainer.RegisterInstance<ITemplateManager>(templateManager) .RegisterInstance<ICommonTemplateManager>(commonTemplateManager); }
private void RegisterTemplateManagers() { templateManager = new TemplateManager(Templates.Apps.Notification, AppSettings.Theme); UnityContainer.RegisterInstance<ITemplateManager>(templateManager); }