src/Misc/EFTools/XmlCore/Core/Context/EditingContext.cs
/// <summary>
///     Calls back on the provided callback when someone has published the requested service.
///     If the service was already available, this method invokes the callback immediately.
///     A generic version of this method is provided for convience, and calls the non-generic
///     method with appropriate casts.
/// </summary>
/// <param name="serviceType"></param>
/// <param name="callback"></param>
Calls back on the provided callback when someone has published the requested service.
If the service was already available, this method invokes the callback immediately.
A generic version of this method is provided for convience, and calls the non-generic
method with appropriate casts.
Calls back on the provided callback when someone has published the requested service . If the service was already available this method invokes the callback immediately . A generic version of this method is provided for convience and calls the non - generic method with appropriate casts .
public override void Subscribe(Type serviceType, SubscribeServiceCallback callback)
            {
                if (serviceType == null)
                {
                    throw new ArgumentNullException("serviceType");
                }
                if (callback == null)
                {
                    throw new ArgumentNullException("callback");
                }
                var service = GetService(serviceType);
                if (service != null)
                {
                    callback(serviceType, service);
                }
                else
                {
                    if (_subscriptions == null)
                    {
                        _subscriptions = new Dictionary<Type, SubscribeServiceCallback>();
                    }
                    SubscribeServiceCallback existing = null;
                    _subscriptions.TryGetValue(serviceType, out existing);
                    existing = (SubscribeServiceCallback)Delegate.Combine(existing, callback);
                    _subscriptions[serviceType] = existing;
                }
            }
public override void Subscribe ( Type serviceType , SubscribeServiceCallback callback ) { if ( serviceType == null ) { throw new ArgumentNullException ( " " ) ; } if ( callback == null ) { throw new ArgumentNullException ( " " ) ; } var service = GetService ( serviceType ) ; if ( service != null ) { callback ( serviceType , service ) ; } else { if ( _subscriptions == null ) { _subscriptions = new Dictionary < Type , SubscribeServiceCallback > ( ) ; } SubscribeServiceCallback existing = null ; _subscriptions . TryGetValue ( serviceType , out existing ) ; existing = ( SubscribeServiceCallback ) Delegate . Combine ( existing , callback ) ; _subscriptions [ serviceType ] = existing ; } }
Calls back on the provided callback when someone has published the requested service.
Calls back on the provided callback when someone has published the requested service .
// If the service is already available, callback immediately // Otherwise, store this for later
serviceType
Type
None
callback
SubscribeServiceCallback
None