Example #1
0
        protected void RaiseConfigurationChangedEvent(ConfigurationEventArgs args)
        {
            var configurationChanged = ConfigurationChanged;

            if (configurationChanged == null)
            {
                return;
            }
            if (m_EventSuspendingLevel != 0)
            {
                return;
            }
            configurationChanged(this, args);
        }
Example #2
0
        private void OnConfigurationChanged(object sender, ConfigurationEventArgs e)
        {
            var eventSource = (IConfiguration)sender;

            switch (e.Type)
            {
            case ConfigurationSourceChanged:
            case ConfigurationEventType.Clear:
                RaiseConfigurationChangedEvent(e);
                break;

            case ConfigurationEventType.AddProperty:
            case ConfigurationEventType.SetProperty:
                if (e.BeforeOperation)
                {
                    RaiseConfigurationChangedEvent(e);
                }
                else
                {
                    var propertySource = GetSource(e.Name);
                    if (propertySource == null || propertySource == eventSource)
                    {
                        RaiseConfigurationChangedEvent(e);
                    }
                }
                break;

            case ConfigurationEventType.ClearProperty:
            {
                var propertySource = GetSource(e.Name);
                var finalValue     = GetProperty(e.Name);
                if (propertySource == eventSource)
                {
                    RaiseConfigurationChangedEvent(e);
                }
                else
                {
                    RaiseConfigurationChangedEvent(new ConfigurationEventArgs(ConfigurationEventType.SetProperty, e.Name, finalValue, e.BeforeOperation));
                }
                break;
            }
            }
        }
 private void OnConfigurationChanged(object sender, ConfigurationEventArgs e)
 {
     var eventSource = (IConfiguration)sender;
     switch (e.Type)
     {
         case ConfigurationSourceChanged:
         case ConfigurationEventType.Clear:
             RaiseConfigurationChangedEvent(e);
             break;
         case ConfigurationEventType.AddProperty:
         case ConfigurationEventType.SetProperty:
             if (e.BeforeOperation)
             {
                 RaiseConfigurationChangedEvent(e);
             }
             else
             {
                 var propertySource = GetSource(e.Name);
                 if (propertySource == null || propertySource == eventSource)
                 {
                     RaiseConfigurationChangedEvent(e);
                 }
             }
             break;
         case ConfigurationEventType.ClearProperty:
         {
             var propertySource = GetSource(e.Name);
             var finalValue = GetProperty(e.Name);
             if (propertySource == eventSource)
             {
                 RaiseConfigurationChangedEvent(e);
             }
             else
             {
                 RaiseConfigurationChangedEvent(new ConfigurationEventArgs(ConfigurationEventType.SetProperty, e.Name, finalValue, e.BeforeOperation));
             }
             break;
         }
     }
 }
 protected void RaiseConfigurationChangedEvent(ConfigurationEventArgs args)
 {
     var configurationChanged = ConfigurationChanged;
     if (configurationChanged == null)
     {
         return;
     }
     if (m_EventSuspendingLevel != 0)
     {
         return;
     }
     configurationChanged(this, args);
 }