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 async void Connect() { if (workplaceService != null) { workplaceService.Dispose(); } workplaceService = new WorkplaceService(Endpoint); if (channelManager != null) { channelManager.Dispose(); } channelManager = workplaceService.CreateChannelManager(); IsConnected = false; Workplaces = await Window.ExecuteLongTask(async () => { using (var channel = channelManager.CreateChannel()) { return await channel.Service.GetWorkplacesLinks(); } }); if (Workplaces == null) { return; } SelectedWorkplace = AppSettings.WorkplaceId != Guid.Empty ? AppSettings.WorkplaceId : Workplaces.First().Id; IsConnected = true; if (isConnected && IsRemember) { Login(); } }