Inheritance: ITemplateManager, IDisposable
コード例 #1
0
ファイル: PortalInstance.cs プロジェクト: breslavsky/queue
        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);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: breslavsky/queue
        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);
        }
コード例 #3
0
 private void RegisterTemplateManagers()
 {
     templateManager = new TemplateManager(Templates.Apps.Terminal, AppSettings.Theme);
     commonTemplateManager = new CommonTemplateManager(AppSettings.Theme);
     UnityContainer.RegisterInstance<ITemplateManager>(templateManager)
                     .RegisterInstance<ICommonTemplateManager>(commonTemplateManager);
 }
コード例 #4
0
 private void RegisterTemplateManagers()
 {
     templateManager = new TemplateManager(Templates.Apps.Notification, AppSettings.Theme);
     UnityContainer.RegisterInstance<ITemplateManager>(templateManager);
 }