共用方式為


ActionContext.AddService Method

Definition

Adds the specified service to the service container.

Overloads

AddService(Type, ServiceCreatorCallback)

Adds the specified service to the service container. This class cannot be inherited.

AddService(Type, Object)

Adds the specified service to the service container. This class cannot be inherited.

AddService(Type, ServiceCreatorCallback, Boolean)

Adds the specified service to the service container, and optionally promotes the service to parent service containers. This class cannot be inherited.

AddService(Type, Object, Boolean)

Adds the specified service to the service container, and optionally promotes the service to any parent service containers. This class cannot be inherited.

AddService(Type, ServiceCreatorCallback)

Adds the specified service to the service container. This class cannot be inherited.

public:
 virtual void AddService(Type ^ serviceType, System::ComponentModel::Design::ServiceCreatorCallback ^ callback);
public void AddService (Type serviceType, System.ComponentModel.Design.ServiceCreatorCallback callback);
abstract member AddService : Type * System.ComponentModel.Design.ServiceCreatorCallback -> unit
override this.AddService : Type * System.ComponentModel.Design.ServiceCreatorCallback -> unit
Public Sub AddService (serviceType As Type, callback As ServiceCreatorCallback)

Parameters

serviceType
Type

The type of service to add.

callback
ServiceCreatorCallback

A callback object that is used to create the service. This allows a service to be declared as available, but delays the creation of the object until the service is requested.

Implements

Applies to

AddService(Type, Object)

Adds the specified service to the service container. This class cannot be inherited.

public:
 virtual void AddService(Type ^ serviceType, System::Object ^ serviceInstance);
public void AddService (Type serviceType, object serviceInstance);
abstract member AddService : Type * obj -> unit
override this.AddService : Type * obj -> unit
Public Sub AddService (serviceType As Type, serviceInstance As Object)

Parameters

serviceType
Type

The type of service to add.

serviceInstance
Object

An instance of the service type to add. This object must implement or inherit from the type indicated by the serviceType parameter.

Implements

Applies to

AddService(Type, ServiceCreatorCallback, Boolean)

Adds the specified service to the service container, and optionally promotes the service to parent service containers. This class cannot be inherited.

public:
 virtual void AddService(Type ^ serviceType, System::ComponentModel::Design::ServiceCreatorCallback ^ callback, bool promote);
public void AddService (Type serviceType, System.ComponentModel.Design.ServiceCreatorCallback callback, bool promote);
abstract member AddService : Type * System.ComponentModel.Design.ServiceCreatorCallback * bool -> unit
override this.AddService : Type * System.ComponentModel.Design.ServiceCreatorCallback * bool -> unit
Public Sub AddService (serviceType As Type, callback As ServiceCreatorCallback, promote As Boolean)

Parameters

serviceType
Type

The type of service to add.

callback
ServiceCreatorCallback

A callback object that is used to create the service. This allows a service to be declared as available, but delays the creation of the object until the service is requested.

promote
Boolean

True to promote this request to any parent service containers; otherwise, false.

Implements

Applies to

AddService(Type, Object, Boolean)

Adds the specified service to the service container, and optionally promotes the service to any parent service containers. This class cannot be inherited.

public:
 virtual void AddService(Type ^ serviceType, System::Object ^ serviceInstance, bool promote);
public void AddService (Type serviceType, object serviceInstance, bool promote);
abstract member AddService : Type * obj * bool -> unit
override this.AddService : Type * obj * bool -> unit
Public Sub AddService (serviceType As Type, serviceInstance As Object, promote As Boolean)

Parameters

serviceType
Type

The type of service to add.

serviceInstance
Object

An instance of the service type to add. This object must implement or inherit from the type indicated by the serviceType parameter.

promote
Boolean

True to promote this request to any parent service containers; otherwise, false.

Implements

Applies to