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(". ")); } } }
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"; }