public void GetConfigurations([CanBeNull] out T localConfiguration, [CanBeNull] out T centralConfiguration, bool suppressXmlSchemaWarning = false) { centralConfiguration = null; var issueNotifications = new NotificationCollection(); if (ConfigurationExists(CentralConfigDirectory, ConfigFileName)) { _centralConfiguration = GetConfiguration( CentralConfigDirectory, ConfigFileName, issueText => issueNotifications.Add(issueText)); if (issueNotifications.Count > 0 && !suppressXmlSchemaWarning) { // This could happen if the schema changes other than just adding new nodes: _msg.WarnFormat( "The central configuration file {0} in {1} could not be read completely ({2}). Please review its structure and ensure it conforms to the current schema.", ConfigFileName, CentralConfigDirectory, issueNotifications.Concatenate(". ")); } centralConfiguration = _centralConfiguration; } else if (_hardCodedDefaults != null) { centralConfiguration = _hardCodedDefaults; } localConfiguration = null; issueNotifications.Clear(); if (ConfigurationExists(LocalConfigDirectory, ConfigFileName)) { localConfiguration = GetConfiguration( LocalConfigDirectory, ConfigFileName, issueText => issueNotifications.Add(issueText)); if (issueNotifications.Count > 0 && !suppressXmlSchemaWarning) { // Could happen if the schema changes other than just adding new nodes: _msg.WarnFormat( "The local configuration file {0} in {1} could not be read completely ({2}). Please review and accept the current settings in the options dialog.", ConfigFileName, CentralConfigDirectory, issueNotifications.Concatenate(". ")); } } }
private static IDatasetMatchCriterion TryCreate( [NotNull] NamedValues namedValues, [NotNull] NotificationCollection notifications) { switch (namedValues.Name.ToLower(CultureInfo.InvariantCulture)) { case _criterionNameNames: return(new DatasetNameMatchCriterion(namedValues.Values)); case _criterionNameFeatureDatasets: return(new DatasetFeatureDatasetMatchCriterion(namedValues.Values)); default: notifications.Add("Unknown criterion name: {0}; supported criterion names: {1}", namedValues.Name, StringUtils.Concatenate( new[] { _criterionNameNames, _criterionNameFeatureDatasets }, ",")); return(null); } }
private void ValidateHost(HostDto host) { if (host.FilledSlots > host.FilledSlots) { Logger.Error(ErrorMessages.ErrorsummarizingHosts); Notifications.Add(ErrorMessages.ErrorsummarizingHosts); } }
public void AddNotification(Notification notification) { notification.Id = _count++; if (Notifications.Count + 1 > _MAX_NOTIFICATIONS) { _buffer.Add(notification); } else { Notifications.Add(notification); } //Show window if there're notifications if (Notifications.Count > 0 && !IsActive) { Show(); } }
static void WriteToXmlCore <T, U>(NotificationCollection <U> sourceCollection, string fileName, MapperHandler <T, U> map) { using (FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.Write)) { NotificationCollection <T> result = new NotificationCollection <T>(); foreach (U item in sourceCollection) { result.Add(map(item)); } XmlSerializer s = new XmlSerializer(typeof(NotificationCollection <T>)); s.Serialize(stream, result); stream.Close(); } }
public void RenderMyNotifications(object sender, OpenReadCompletedEventArgs e) { DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(NotificationType[])); NotificationType[] notifications = serializer.ReadObject(e.Result) as NotificationType[]; EnumMapper mapper = new EnumMapper("NotificationMappings.map"); NotificationCollection.Clear(); foreach (NotificationType type in notifications) { NotificationMapper.SetNotificationMessageForNotification(type, (NotificationEnum.Notifications)mapper.GetMappedValue(type.RawType)); NotificationCollection.Add(type); } IsLoading = false; Visible = "Collapsed"; }
protected override void Load(ContainerBuilder builder) { _ = builder.RegisterInstance(new RootFolder(_rootFolder)).AsSelf(); _ = builder.Register(context => { return(new FeatureManager( context.Resolve <TenantIdentifier>(), context.Resolve <IFeatureSettingsProvider>())); }).As <IFeatureManager>().InstancePerLifetimeScope(); _ = builder.RegisterType <KPIResolver>().As <IKPIResolver>().InstancePerLifetimeScope(); _ = builder.RegisterType <KPICalculationManager>().As <IKPICalculationManager>().InstancePerLifetimeScope(); _ = builder.RegisterType <KPICalculationScopeFactory>().As <IKPICalculationScopeFactory>(); _ = builder.RegisterType <ScenarioCampaignMetricsProcessor>().As <IScenarioCampaignMetricsProcessor>(); _ = builder.RegisterType <AnalysisGroupKPIsCalculator>().As <IAnalysisGroupKPIsCalculator>(); builder.RegisterKPICalculators(); // Synchronization service _ = builder.RegisterType <SynchronizationService>().AsSelf().InstancePerLifetimeScope(); _ = builder .Register(x => x.Resolve <IFeatureManager>().IsEnabled(nameof(ProductFeature.IntegrationSynchronization)) ? (ISynchronizationService)x.Resolve <SynchronizationService>() : new EmptySynchronizationService()) .As <ISynchronizationService>() .InstancePerLifetimeScope(); _ = builder.RegisterInstance(new SynchronizationServicesConfiguration() .Add(SynchronizedServiceType.RunExecution) .Add(SynchronizedServiceType.DataSynchronization, maxConcurrencyLevel: 1)); _ = builder.Register(context => EmailUtilities.GetEmailConnection(context.Resolve <IConfiguration>())) .As <IEmailConnection>().InstancePerLifetimeScope(); _ = builder.Register( x => { var tenantSettingsRepository = x.Resolve <ITenantSettingsRepository>(); if (tenantSettingsRepository is null) { return(ClashExposureCountService.Create()); } TenantSettings tenantSettings = tenantSettingsRepository.Get(); if (tenantSettings is null) { return(ClashExposureCountService.Create()); } var peakStartAndEnd = (tenantSettings.PeakStartTime, tenantSettings.PeakEndTime); return(ClashExposureCountService.Create(peakStartAndEnd)); }) .As <IClashExposureCountService>() .InstancePerLifetimeScope(); _ = builder.RegisterType <DataChangeValidator>().As <IDataChangeValidator>().InstancePerLifetimeScope(); _ = builder.RegisterType <RepositoryFactory>().As <IRepositoryFactory>().InstancePerLifetimeScope(); _ = builder.Register(context => { var nc = new NotificationCollection(); nc.Add(new HTTPTNotification()); return(nc); }) .As <INotificationCollection>() .InstancePerLifetimeScope(); _ = builder.RegisterType <OptimiserInputFiles>().InstancePerLifetimeScope(); _ = builder.RegisterType <DataManipulator>().As <IDataManipulator>().InstancePerLifetimeScope(); _ = builder.RegisterType <ModelLoaders>().As <IModelLoaders>().InstancePerLifetimeScope(); // Register Smooth processor _ = builder.RegisterType <SmoothEngine>().AsSelf(); _ = builder.RegisterType <SmoothProcessor>().As <ISmoothProcessor>(); // Register FeatureManager _ = builder.RegisterType <TenantSettingsFeatureManager>().As <ITenantSettingsFeatureManager>(); _ = builder.RegisterType <AutoBookInputHandler>().As <IAutoBookInputHandler>(); _ = builder.RegisterType <AutoBookOutputHandler>().As <IAutoBookOutputHandler>(); _ = builder.RegisterType <BRSIndicatorManager>().As <IBRSIndicatorManager>().InstancePerDependency(); _ = builder.RegisterType <BRSCalculator>().As <IBRSCalculator>().InstancePerDependency(); // Register RunCleaner _ = builder.RegisterType <RunCleaner>().As <IRunCleaner>().InstancePerLifetimeScope(); // Register RunManager _ = builder.RegisterType <RunManager>().As <IRunManager>().InstancePerDependency(); //Register RecalculateBreakAvailabilityService _ = builder.RegisterType <RecalculateBreakAvailabilityService>().As <IRecalculateBreakAvailabilityService>().InstancePerDependency(); _ = builder.RegisterType <SystemLogicalDateService>().As <ISystemLogicalDateService>(); _ = builder.Register(context => LoggerFactory.Create(config => config.AddDebug())) .Named <ILoggerFactory>("Debug") .SingleInstance(); _ = builder.Register(context => context.ResolveNamed <ILoggerFactory>("Debug").CreateLogger <IRecalculateBreakAvailabilityService>()) .As <ILogger <IRecalculateBreakAvailabilityService> >() .InstancePerDependency(); _ = builder.RegisterType <ScenarioSnapshotGenerator>().AsSelf(); _ = builder.RegisterType <RunCompletionNotifier>().AsSelf().InstancePerLifetimeScope(); _ = builder.RegisterType <RunInstanceCreator>().AsSelf().InstancePerLifetimeScope(); _ = builder.RegisterType <RunScenarioTask>().AsSelf().InstancePerLifetimeScope(); _ = builder.RegisterType <RunScenarioTaskExecutor>().AsSelf().InstancePerLifetimeScope(); _ = builder.Register <ISystemMessageRepository>(x => new SystemMessageRepository()); _ = builder.RegisterType <IdentityGeneratorResolver>() .As <IIdentityGeneratorResolver>() .InstancePerLifetimeScope(); _ = builder.RegisterType <ProductAdvertiserValidator>().As <IProductAdvertiserValidator>() .InstancePerLifetimeScope(); _ = builder.RegisterType <ClashExceptionSerializer>().As <IClashExceptionSerializer>().InstancePerLifetimeScope(); _ = builder.RegisterType <CampaignSerializer>().As <ICampaignSerializer>().InstancePerLifetimeScope(); _ = builder.RegisterType <BreakSerializer>().As <IBreakSerializer>().InstancePerLifetimeScope(); _ = builder.RegisterType <CampaignFlattener>().As <ICampaignFlattener>().InstancePerLifetimeScope(); _ = builder.RegisterType <CampaignPassPrioritiesService>().As <ICampaignPassPrioritiesService>().InstancePerLifetimeScope(); _ = builder.RegisterType <PassInspectorService>().As <IPassInspectorService>().InstancePerLifetimeScope(); _ = builder.RegisterType <AnalysisGroupCampaignQuery>().As <IAnalysisGroupCampaignQuery>().InstancePerLifetimeScope(); _ = builder.RegisterType <RecommendationAggregator>().As <IRecommendationAggregator>().InstancePerLifetimeScope(); _ = builder.RegisterType <ScenarioCampaignResultReportCreator>().As <IScenarioCampaignResultReportCreator>() .InstancePerLifetimeScope(); _ = builder.RegisterType <RecommendationsResultReportCreator>().As <IRecommendationsResultReportCreator>() .InstancePerLifetimeScope(); _ = builder.RegisterType <SpotModelCreator>().As <ISpotModelCreator>() .InstancePerLifetimeScope(); _ = builder.RegisterType <ProgTxDetailSerializer>().As <IProgTxDetailSerializer>().InstancePerLifetimeScope(); _ = builder.Register(x => MemoryCache.Default).As <MemoryCache>().SingleInstance(); _ = builder.RegisterType <CampaignCleaner>().As <ICampaignCleaner>().InstancePerLifetimeScope(); }