CK.Plugins.ObjectExplorer.ViewModels.LogViewModels.VMLogConfig.UpdateFrom C# (CSharp) Method

UpdateFrom() private method

Updates all VMLogServiceConfig to reflect the Log configuration set as parameter If this method if called in response to a ConfigCanged from the interceptor, we don't track changes If this method is called in response to a LoadXMLConfig, we do track changes
private UpdateFrom ( ILogConfig l, bool trackChanges ) : void
l ILogConfig
trackChanges bool
return void
        internal void UpdateFrom( ILogConfig l, bool trackChanges )
        {
            bool hasChanged = false;

            foreach( ILogServiceConfig s in l.Services )
            {
                VMLogServiceConfig vmS;

                vmS = Find( s.Name );
                if( vmS != null ) //The vm already exists
                {
                    vmS.UpdateFrom( s, trackChanges );
                }
                else
                {
                    vmS = VMLogServiceConfig.CreateFrom( this, s );
                    EventRegistration( vmS );
                    vmS.UpdateFrom( s, trackChanges );
                    if( trackChanges ) vmS.IsDirty = true; //If we create a new service from another source than the kernel, it must be set to dirty
                    _services.Add( vmS );
                }
            }
            if( l.DoLog != DoLog )
            {
                DoLog = l.DoLog;
                hasChanged = true;
            }

            if( !trackChanges ) IsDirty = false; // If we update from the kernel, conf is no longer dirty
            else if( hasChanged ) IsDirty = true; // If we update from an other source and changes have been made in the logConfig's cocnf, conf is dirty. But if no changes have been made, conf stays the way it was before updating

            if( !trackChanges )
                Debug.Assert( IsDirty == false );
        }

Same methods

VMLogConfig::UpdateFrom ( IPluginConfigAccessor config ) : void