src/Misc/EFTools/XmlCore/Base/Context/EditingContext.cs
/// <summary>
///     This changes a context item to the given value.  It is illegal to pass
///     null here.  If you want to set a context item to its empty value create
///     an instance of the item using a default constructor.
/// </summary>
/// <param name="value"></param>
This changes a context item to the given value.  It is illegal to pass
null here.  If you want to set a context item to its empty value create
an instance of the item using a default constructor.
This changes a context item to the given value . It is illegal to pass null here . If you want to set a context item to its empty value create an instance of the item using a default constructor .
internal override void SetValue(ContextItem value)
            {
                if (value == null)
                {
                    throw new ArgumentNullException("value");
                }
                ContextItem existing, existingRawValue;
                existing = existingRawValue = GetValueNull(value.ItemType);
                if (existing == null)
                {
                    existing = GetValue(value.ItemType);
                }
                var success = false;
                try
                {
                    _currentLayer.Items[value.ItemType] = value;
                    NotifyItemChanged(_context, value, existing);
                    success = true;
                }
                finally
                {
                    if (success)
                    {
                        OnItemChanged(value);
                    }
                    else
                    {
                        _currentLayer.Items.Remove(value.ItemType);
                        if (existingRawValue != null)
                        {
                            SetValue(existingRawValue);
                        }
                    }
                }
            }
internal override void SetValue ( ContextItem value ) { if ( value == null ) { throw new ArgumentNullException ( " " ) ; } ContextItem existing , existingRawValue ; existing = existingRawValue = GetValueNull ( value . ItemType ) ; if ( existing == null ) { existing = GetValue ( value . ItemType ) ; } var success = false ; try { _currentLayer . Items [ value . ItemType ] = value ; NotifyItemChanged ( _context , value , existing ) ; success = true ; } finally { if ( success ) { OnItemChanged ( value ) ; } else { _currentLayer . Items . Remove ( value . ItemType ) ; if ( existingRawValue != null ) { SetValue ( existingRawValue ) ; } } } }
This changes a context item to the given value.
This changes a context item to the given value .
// The rule for change is that we store the new value, // raise a change on the item, and then raise a change // to everyone else.  If changing the item fails, we recover // the previous item. // The item threw during its transition to  // becoming active.  Put the old one back. // We must put the old one back by re-activating // it.  This could throw a second time, so we // cover this case by removing the value first. // Should it throw again, we won't recurse because // the existing raw value would be null.
value
ContextItem
None