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

CancelModifications() private method

Cancels modifications on a particular service if the service is bound or is not bound but can be found in the kernel's configuration, clears it and updates it from the kernel's configuration if the service is not bound, and can't be found in the kernel's configuration, removes it
private CancelModifications ( VMLogServiceConfig vmS ) : void
vmS VMLogServiceConfig
return void
        internal void CancelModifications( VMLogServiceConfig vmS )
        {
            vmS.ClearConfig();

            if( vmS.IsBound )
            {

                foreach( ILogServiceConfig s in _hostConfiguration.LogConfig.Services )
                {
                    if( s.Name == vmS.Name )
                    {
                        vmS.UpdateFrom( s, false );// We update from the kernel, we don't track changes (and therefor set IsDirty to false)
                        break;
                    }
                }
            }
            else
            {
                bool hasBeenFound = false;
                foreach( ILogServiceConfig s in _hostConfiguration.LogConfig.Services )
                {
                    if( s.Name == vmS.Name )
                    {
                        vmS.UpdateFrom( s, false );// We update from the kernel, we don't track changes (and therefor set IsDirty to false)
                        _services.Add( vmS );
                        hasBeenFound = true;
                        break;
                    }
                }
                if( !hasBeenFound )
                    _services.Remove( vmS );
            }
        }