Поделиться через


ServiceManager Class

Represents the behavior associated with an EditingContext.

Inheritance Hierarchy

System.Object
  Microsoft.Windows.Design.ServiceManager

Namespace:  Microsoft.Windows.Design
Assembly:  Microsoft.Windows.Design.Extensibility (in Microsoft.Windows.Design.Extensibility.dll)

Syntax

'Declaration
Public MustInherit Class ServiceManager _
    Implements IServiceProvider, IEnumerable(Of Type),  _
    IEnumerable
public abstract class ServiceManager : IServiceProvider, 
    IEnumerable<Type>, IEnumerable
public ref class ServiceManager abstract : IServiceProvider, 
    IEnumerable<Type^>, IEnumerable
[<AbstractClass>]
type ServiceManager =  
    class
        interface IServiceProvider
        interface IEnumerable<Type>
        interface IEnumerable
    end
public abstract class ServiceManager implements IServiceProvider, IEnumerable<Type>, IEnumerable

The ServiceManager type exposes the following members.

Constructors

  Name Description
Protected method ServiceManager Initializes a new instance of the ServiceManager class.

Top

Methods

  Name Description
Public method Contains(Type) When overridden in a derived class, determines whether the ServiceManager contains a service of the specified type.
Public method Contains<TServiceType>() Determines if the ServiceManager contains a service of the specified type.
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetEnumerator When overridden in a derived class, retrieves an enumerator of the published services of this ServiceManager.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetRequiredService<TServiceType> Retrieves an instance of a service of the specified type.
Public method GetService(Type) When overridden in a derived class, retrieves an instance of a service of the specified type.
Public method GetService<TServiceType>() Retrieves an instance of a service of the specified generic type.
Protected methodStatic member GetTarget A helper method that gets the target object for a delegate.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Publish(Type, PublishServiceCallback) When overridden in a derived class, publishes a service of the specified type, represented by the specified method.
Public method Publish(Type, Object) When overridden in a derived class, publishes the specified service instance of the specified type.
Public method Publish<TServiceType>(TServiceType) Publishes the specified service instance of the specified type.
Public method Publish<TServiceType>(PublishServiceCallback<TServiceType>) Publishes a service of the specified type, represented by the specified method.
Protected methodStatic member RemoveCallback Removes a callback method from a delegate.
Public method Subscribe(Type, SubscribeServiceCallback) When overridden in a derived class, requests that the specified method is called when a service of the specified type is available.
Public method Subscribe<TServiceType>(SubscribeServiceCallback<TServiceType>) Requests that the specified method is called when a service of the specified type is available.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method Unsubscribe(Type, SubscribeServiceCallback) When overridden in a derived class, requests that the specified method is no longer called when a service of the specified type is available.
Public method Unsubscribe<TServiceType>(SubscribeServiceCallback<TServiceType>) Requests that the specified method is no longer called when a service of the specified type is available.

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IEnumerable.GetEnumerator Infrastructure. For a description of this member, see GetEnumerator.

Top

Remarks

The EditingContext class provides access to two pieces of state:

  • Data (ContextItem)

  • Behavior Services (ServiceManager)

Behavior services are accessed through the Services property which returns an instance of a ServiceManager.

ServiceManager is an abstract class. You can provide your own implementation by deriving from EditingContext and overriding CreateServiceManager.

Once a service is created in an EditingContext it is always present. A service cannot be removed from the EditingContext.

Services have consistent instance values, so it is always acceptable to cache them.

Code can use the ServiceManager to publish new services, and subscribe to a callback when a particular service is available.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Windows.Design Namespace

Other Resources

WPF Designer Extensibility