src/Misc/EFTools/XmlCore/Core/Context/EditingContext.cs
/// <summary>
///     Adds an event callback that will be invoked with a context item of the given item type changes.
/// </summary>
/// <param name="contextItemType"></param>
/// <param name="callback"></param>
Adds an event callback that will be invoked with a context item of the given item type changes.
Adds an event callback that will be invoked with a context item of the given item type changes .
public override void Subscribe(Type contextItemType, SubscribeContextCallback callback)
            {
                if (contextItemType == null)
                {
                    throw new ArgumentNullException("contextItemType");
                }
                if (callback == null)
                {
                    throw new ArgumentNullException("callback");
                }
                if (!typeof(ContextItem).IsAssignableFrom(contextItemType))
                {
                    throw new ArgumentException("Argument Incorrect Type", "contextItemType");
                }
                if (_subscriptions == null)
                {
                    _subscriptions = new Dictionary<Type, SubscribeContextCallback>();
                }
                SubscribeContextCallback existing = null;
                _subscriptions.TryGetValue(contextItemType, out existing);
                existing = (SubscribeContextCallback)Delegate.Combine(existing, callback);
                _subscriptions[contextItemType] = existing;
                var item = GetValueNull(contextItemType);
                if (item != null)
                {
                    callback(item);
                }
            }
public override void Subscribe ( Type contextItemType , SubscribeContextCallback callback ) { if ( contextItemType == null ) { throw new ArgumentNullException ( " " ) ; } if ( callback == null ) { throw new ArgumentNullException ( " " ) ; } if ( ! typeof ( ContextItem ) . IsAssignableFrom ( contextItemType ) ) { throw new ArgumentException ( " " , " " ) ; } if ( _subscriptions == null ) { _subscriptions = new Dictionary < Type , SubscribeContextCallback > ( ) ; } SubscribeContextCallback existing = null ; _subscriptions . TryGetValue ( contextItemType , out existing ) ; existing = ( SubscribeContextCallback ) Delegate . Combine ( existing , callback ) ; _subscriptions [ contextItemType ] = existing ; var item = GetValueNull ( contextItemType ) ; if ( item != null ) { callback ( item ) ; } }
Adds an event callback that will be invoked with a context item of the given item type changes.
Adds an event callback that will be invoked with a context item of the given item type changes .
/*
                    throw new ArgumentException(
                        string.Format(CultureInfo.CurrentCulture,
                        Resources.Error_ArgIncorrectType,
                        "contextItemType", typeof(ContextItem).FullName));
                    */ // If the context is already present, invoke the callback.
contextItemType
Type
None
callback
SubscribeContextCallback
None