Activity Classe

Definição

Cuidado

The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*

Representa o bloco de construção fundamental dos fluxos de trabalho.Represents the fundamental building block of workflows. Activity é a classe base para todas as atividades.Activity is the base class for all activities.

public ref class Activity : System::Workflow::ComponentModel::DependencyObject
[System.Drawing.ToolboxBitmap(typeof(System.Workflow.ComponentModel.Activity), "Design.Resources.Activity.png")]
[System.Workflow.ComponentModel.Compiler.ActivityCodeGenerator(typeof(System.Workflow.ComponentModel.Compiler.ActivityCodeGenerator))]
[System.Workflow.ComponentModel.Compiler.ActivityValidator(typeof(System.Workflow.ComponentModel.Compiler.ActivityValidator))]
[System.Workflow.ComponentModel.Serialization.RuntimeNameProperty("Name")]
public class Activity : System.Workflow.ComponentModel.DependencyObject
[System.Drawing.ToolboxBitmap(typeof(System.Workflow.ComponentModel.Activity), "Design.Resources.Activity.png")]
[System.Workflow.ComponentModel.Compiler.ActivityCodeGenerator(typeof(System.Workflow.ComponentModel.Compiler.ActivityCodeGenerator))]
[System.Workflow.ComponentModel.Compiler.ActivityValidator(typeof(System.Workflow.ComponentModel.Compiler.ActivityValidator))]
[System.Workflow.ComponentModel.Serialization.RuntimeNameProperty("Name")]
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public class Activity : System.Workflow.ComponentModel.DependencyObject
[<System.Drawing.ToolboxBitmap(typeof(System.Workflow.ComponentModel.Activity), "Design.Resources.Activity.png")>]
[<System.Workflow.ComponentModel.Compiler.ActivityCodeGenerator(typeof(System.Workflow.ComponentModel.Compiler.ActivityCodeGenerator))>]
[<System.Workflow.ComponentModel.Compiler.ActivityValidator(typeof(System.Workflow.ComponentModel.Compiler.ActivityValidator))>]
[<System.Workflow.ComponentModel.Serialization.RuntimeNameProperty("Name")>]
type Activity = class
    inherit DependencyObject
[<System.Drawing.ToolboxBitmap(typeof(System.Workflow.ComponentModel.Activity), "Design.Resources.Activity.png")>]
[<System.Workflow.ComponentModel.Compiler.ActivityCodeGenerator(typeof(System.Workflow.ComponentModel.Compiler.ActivityCodeGenerator))>]
[<System.Workflow.ComponentModel.Compiler.ActivityValidator(typeof(System.Workflow.ComponentModel.Compiler.ActivityValidator))>]
[<System.Workflow.ComponentModel.Serialization.RuntimeNameProperty("Name")>]
[<System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")>]
type Activity = class
    inherit DependencyObject
Public Class Activity
Inherits DependencyObject
Herança
Derivado
Atributos

Exemplos

Este exemplo define uma atividade cuja finalidade é enviar um email.This example defines an activity whose purpose is to send an email. A atividade define uma propriedade, Subject , que usa uma propriedade de dependência em sua implementação.The activity defines one property, Subject, that uses a dependency property in its implementation. Outras propriedades podem ser definidas de forma semelhante.Other properties can be defined in a similar way. O Execute método é substituído para fornecer a lógica para enviar o email.The Execute method is overridden to provide the logic for sending the email. Para obter um exemplo completo, consulte o exemplo de atividade enviar email.For a complete example, see the Send Email Activity Sample.

public class SendEmail : Activity  
{  
    public static readonly DependencyProperty SubjectProperty =  
        DependencyProperty.Register("Subject", typeof(string), typeof(SendEmail));  

    public string Subject  
    {  
        get { return base.GetValue(SubjectProperty) as string; }  
        set { base.SetValue(SubjectProperty, value); }  
    }  

    // Define other properties...  

    protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)  
    {  
        // Logic to send the email goes here...  
        return ActivityExecutionStatus.Closed;  
    }  
}  

Comentários

Observação

Este material discute tipos e namespaces obsoletos.This material discusses types and namespaces that are obsolete. Para obter mais informações, consulte Deprecated Types in Windows Workflow Foundation 4.5 (Tipos preteridos no Windows Workflow Foundation 4.5).For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

Um Activity é o bloco de construção fundamental dos fluxos de trabalho.An Activity is the fundamental building block of workflows. Um Activity define um conjunto de propriedades e eventos, como qualquer classe, juntamente com a lógica de execução que define o comportamento de tempo de execução da atividade.An Activity defines a set of properties and events, such as any class, along with execution logic that defines the activity's run-time behavior. Um conjunto de componentes adicionais pode ser associado a um Activity .A set of additional components can be associated with an Activity. Eles incluem, mas não se limitam a um validador, um gerador de código, serializadores personalizados e um designer.These include, but are not limited to a validator, a code generator, custom serializers, and a designer.

Todas as atividades compartilham um conjunto comum de propriedades definidas na Activity classe base.All activities share a common set of properties defined on the Activity base class. Cada um Activity pode declarar suas próprias propriedades adicionais de acordo com seus requisitos, estendendo essa classe.Each Activity can declare its own additional properties according to its requirements by extending this class. Como Activity derivado de DependencyObject , as propriedades podem ser definidas como propriedades CLR padrão e como propriedades de dependência.Because Activity derives from DependencyObject, properties can be defined as standard CLR properties and as dependency properties.

A lógica de execução de um Activity atende a um contrato que existe entre qualquer Activity e o tempo de execução do fluxo de trabalho.The execution logic of an Activity fulfills a contract that exists between any Activity and the workflow runtime. Você deve documentar a lógica de execução de qualquer Activity um em um sentido funcional, para que um desenvolvedor de fluxo de trabalho que usa o Activity saiba como ele se comporta.You must document the execution logic of any Activity in a functional sense, so that a workflow developer who uses the Activity knows how it behaves. A lógica de execução propriamente dita é ocultada do desenvolvedor de fluxo de trabalho que inclui a atividade em um fluxo de trabalho, pois a lógica de execução faz parte de um contrato que existe estritamente entre o tempo de execução do fluxo de trabalho e o Activity .The execution logic itself is hidden from the workflow developer who includes the activity in a workflow, because the execution logic is part of a contract that exists strictly between the workflow runtime and the Activity.

Construtores

Activity()

Inicializa uma nova instância da classe Activity.Initializes a new instance of the Activity class.

Activity(String)

Inicializa uma nova instância da classe Activity, ao inicializar o Name.Initializes a new instance of the Activity class, while initializing the Name.

Campos

ActivityContextGuidProperty

O DependencyProperty que representa o Guid do ActivityExecutionContext que está associado ao Activity.The DependencyProperty that represents the Guid of the ActivityExecutionContext that is associated with the Activity.

CancelingEvent

Representa o DependencyProperty que destina-se ao evento Canceling.Represents the DependencyProperty that targets the Canceling event.

ClosedEvent

Representa o DependencyProperty que destina-se ao evento Closed.Represents the DependencyProperty that targets the Closed event.

CompensatingEvent

Representa o DependencyProperty que destina-se ao evento Compensating.Represents the DependencyProperty that targets the Compensating event.

ExecutingEvent

Representa o DependencyProperty que tem como destino o evento Executing que ocorre quando a atividade é executada.Represents the DependencyProperty that targets the Executing event, which occurs when the activity is executed.

FaultingEvent

O DependencyProperty que representa o evento Faulting.The DependencyProperty that represents the Faulting event.

StatusChangedEvent

Representa o DependencyProperty que destina-se ao evento StatusChanged.Represents the DependencyProperty that targets the StatusChanged event.

Propriedades

Description

Obtém ou define a descrição definida pelo usuário da Activity.Gets or sets the user-defined description of the Activity.

DesignMode

Obtém o valor que indica se esta instância está em modo de design ou de tempo de execução.Gets the value that indicates whether this instance is in design or run-time mode.

(Herdado de DependencyObject)
Enabled

Obtém ou define um valor que indica se esta instância está habilitada para execução e validação.Gets or sets a value that indicates whether this instance is enabled for execution and validation.

ExecutionResult

Obtém o ActivityExecutionResult da última tentativa de executar essa instância.Gets the ActivityExecutionResult of the last attempt to run this instance.

ExecutionStatus

Obtém o ActivityExecutionStatus atual dessa instância.Gets the current ActivityExecutionStatus of this instance.

IsDynamicActivity

Obtém informações sobre se a atividade está em execução dentro do ActivityExecutionContext padrão da instância de fluxo de trabalho.Gets information about whether the activity is executing within the default ActivityExecutionContext of the workflow instance.

Name

Obtém ou define o nome desta instância.Gets or sets the name of this instance. Este nome deve estar em conformidade com as convenções de nomenclatura de variável da linguagem de programação que está sendo usada no projeto de fluxo de trabalho.This name must conform to the variable naming convention of the programming language that is being used in the Workflow project.

Parent

Obtém o CompositeActivity que contém esse Activity.Gets the CompositeActivity that contains this Activity.

ParentDependencyObject

Obtém o DependencyObject pai no grafo DependencyObject.Gets the parent DependencyObject in the DependencyObject graph.

(Herdado de DependencyObject)
QualifiedName

Obtém o nome qualificado da atividade.Gets the qualified name of the activity. Nomes de atividades qualificados sempre são exclusivos em uma instância de fluxo de trabalho.Qualified activity names are always unique in a workflow instance.

Site

Obtém ou define uma referência ao componente Site do DependencyObject.Gets or sets a reference to the Site component of the DependencyObject.

(Herdado de DependencyObject)
UserData

Obtém um IDictionary que associa dados personalizados a essa instância de classe.Gets an IDictionary that associates custom data with this class instance.

(Herdado de DependencyObject)
WorkflowInstanceId

Obtém o Guid associado à instância.Gets the Guid associated with the instance.

Métodos

AddHandler(DependencyProperty, Object)

Adiciona um manipulador para um evento de um DependencyObject.Adds a handler for an event of a DependencyObject.

(Herdado de DependencyObject)
Cancel(ActivityExecutionContext)

Chamado pelo runtime de fluxo de trabalho para cancelar a execução de uma atividade que está sendo executada no momento.Called by the workflow runtime to cancel execution of an activity that is currently executing.

Clone()

Cria uma cópia profunda do Activity.Creates a deep copy of the Activity.

Dispose()

Libera todos os recursos usados pelo DependencyObject.Releases all the resources used by the DependencyObject.

(Herdado de DependencyObject)
Dispose(Boolean)

Libera os recursos não gerenciados usados e opcionalmente os gerenciados usados pelo DependencyObject.Releases the unmanaged resources and optionally releases the managed resources used by DependencyObject.

(Herdado de DependencyObject)
Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object.

(Herdado de Object)
Execute(ActivityExecutionContext)

Chamado pelo runtime de fluxo de trabalho para executar uma atividade.Called by the workflow runtime to execute an activity.

GetActivityByName(String)

Retorna a instância do Activity cujo nome é solicitado do conjunto de todas as atividades em execução na atividade raiz desta instância, que está dentro do fluxo de trabalho.Returns the instance of the Activity whose name is requested from the set of all activities running under the root activity of this instance, which is within the workflow.

GetActivityByName(String, Boolean)

Retorna a instância do Activity cujo nome é solicitado do conjunto de todas as atividades sob a raiz do Activity desta instância se o segundo parâmetro é false e no Activity atual se o parâmetro é true.Returns the instance of the Activity whose name is requested from the set of all activities under the root the Activity of this instance if the second parameter is false and under the current Activity if the second parameter is true.

GetBinding(DependencyProperty)

Fornece acesso para ao ActivityBind associado ao DependencyProperty específico.Provides access to the ActivityBind associated with the specific DependencyProperty.

(Herdado de DependencyObject)
GetBoundValue(ActivityBind, Type)

Recupera o Object que é a entidade de um ActivityBind.Retrieves the Object that is the subject of an ActivityBind.

(Herdado de DependencyObject)
GetHashCode()

Serve como a função de hash padrão.Serves as the default hash function.

(Herdado de Object)
GetInvocationList<T>(DependencyProperty)

Obtém uma matriz que contém os delegados para o DependencyProperty especificado.Gets an array that contains the delegates for the specified DependencyProperty.

(Herdado de DependencyObject)
GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Herdado de Object)
GetValue(DependencyProperty)

Fornece acesso ao valor do DependencyProperty designado.Provides access to the value of the designated DependencyProperty.

(Herdado de DependencyObject)
GetValueBase(DependencyProperty)

Fornece acesso ao objeto associado de um DependencyProperty e ignora a substituição de GetValue(DependencyProperty).Provides access to the bound object of a DependencyProperty and bypasses the GetValue(DependencyProperty) override.

(Herdado de DependencyObject)
HandleFault(ActivityExecutionContext, Exception)

Chamado quando uma exceção é gerada dentro do contexto da execução desta instância.Called when an exception is raised within the context of the execution of this instance.

Initialize(IServiceProvider)

Chamado pelo runtime de fluxo de trabalho para inicializar uma atividade durante a construção de uma nova instância de fluxo de trabalho.Called by the workflow runtime to initialize an activity during the construction of a new workflow instance. Este método é chamado durante a construção de um ActivityExecutionContext dinâmico.This method is called during the construction of a dynamic ActivityExecutionContext.

InitializeProperties()

Executa a inicialização nas propriedades de dependência quando substituído em uma classe derivada.Performs initialization on dependency properties when overridden in a derived class.

(Herdado de DependencyObject)
Invoke<T>(EventHandler<T>, T)

Assina um EventHandler e invoca esse delegado.Subscribes an EventHandler and invokes that delegate.

Invoke<T>(IActivityEventListener<T>, T)

Assina um IActivityEventListener<T> e invoca esse delegado.Subscribes an IActivityEventListener<T> and invokes that delegate.

IsBindingSet(DependencyProperty)

Indica se o valor de um DependencyProperty é definido como uma associação.Indicates whether the value of a DependencyProperty is set as a binding. Consulte SetBinding(DependencyProperty, ActivityBind).See SetBinding(DependencyProperty, ActivityBind).

(Herdado de DependencyObject)
Load(Stream, Activity)

Carrega uma instância de um Activity de um Stream.Loads an instance of an Activity from a Stream.

Load(Stream, Activity, IFormatter)

Carrega uma instância de um Activity em um Stream usando o IFormatter personalizado para a desserialização.Loads an instance of an Activity from a Stream using the custom IFormatter for deserialization.

MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
MetaEquals(DependencyObject)

Determina se o metaproperties deste DependencyObject é igual a metaproperties do DependencyObject com parâmetros.Determines whether the metaproperties of this DependencyObject equals the metaproperties of the parameterized DependencyObject.

(Herdado de DependencyObject)
OnActivityExecutionContextLoad(IServiceProvider)

Chamado pelo runtime de fluxo de trabalho sempre que um ActivityExecutionContext é carregado.Called by the workflow runtime whenever an ActivityExecutionContext is loaded. Por exemplo, este método é chamado durante a criação de um ActivityExecutionContext, bem como toda vez que o ActivityExecutionContext é reencarnado quando uma instância de fluxo de trabalho é carregada do armazenamento persistente.For example, this method is called during the creation of an ActivityExecutionContext as well as every time the ActivityExecutionContext is reincarnated when a workflow instance is loaded from persistent storage.

OnActivityExecutionContextUnload(IServiceProvider)

Chamado pelo runtime de fluxo de trabalho sempre que um ActivityExecutionContext é descarregado.Called by the workflow runtime whenever an ActivityExecutionContext is unloaded. Por exemplo, este método é chamado durante a conclusão de um ActivityExecutionContext, bem como toda vez que ActivityExecutionContext é descarregado quando uma instância de fluxo de trabalho é persistida.For example, this method is called during completion of an ActivityExecutionContext as well as every time the ActivityExecutionContext is unloaded when a workflow instance is persisted.

OnClosed(IServiceProvider)

Chamado pelo runtime de fluxo de trabalho como parte da transição da atividade para o estado fechado.Called by the workflow runtime as part of the activity's transition to the closed state.

RaiseEvent(DependencyProperty, Object, EventArgs)

Gera um Event associado à propriedade de dependência especificada.Raises an Event associated with the specified dependency property.

RaiseGenericEvent<T>(DependencyProperty, Object, T)

Gera o evento associado com o DependencyProperty referenciado.Raises the event associated with the referenced DependencyProperty.

RegisterForStatusChange(DependencyProperty, IActivityEventListener<ActivityExecutionStatusChangedEventArgs>)

Registra o DependencyProperty especificado para o evento de alteração de status.Registers the specified DependencyProperty for the status change event.

RemoveHandler(DependencyProperty, Object)

Remove um EventHandler de um DependencyProperty associado.Removes an EventHandler from an associated DependencyProperty.

(Herdado de DependencyObject)
RemoveProperty(DependencyProperty)

Remove um DependencyProperty do DependencyObject.Removes a DependencyProperty from the DependencyObject.

(Herdado de DependencyObject)
Save(Stream)

Grava o Activity para um Stream para persistência.Writes the Activity to a Stream for persistence.

Save(Stream, IFormatter)

Grava o Activity para um Stream para persistência usando o IFormatter personalizado fornecido para a serialização.Writes the Activity to a Stream for persistence using the custom IFormatter provided for serialization.

SetBinding(DependencyProperty, ActivityBind)

Define o ActivityBind para o DependencyProperty especificado.Sets the ActivityBind for the specified DependencyProperty.

(Herdado de DependencyObject)
SetBoundValue(ActivityBind, Object)

Define o valor do ActivityBind de destino.Sets the value of the target ActivityBind.

(Herdado de DependencyObject)
SetReadOnlyPropertyValue(DependencyProperty, Object)

Define o valor de um DependencyProperty, que é somente leitura.Sets the value of a DependencyProperty, which is read-only.

(Herdado de DependencyObject)
SetValue(DependencyProperty, Object)

Define o valor do DependencyProperty para o objeto.Sets the value of the DependencyProperty to the object.

(Herdado de DependencyObject)
SetValueBase(DependencyProperty, Object)

Define o valor da DependencyProperty usando o Object especificado, ignorando o SetValue(DependencyProperty, Object).Sets the value of the DependencyProperty to the specified Object, bypassing the SetValue(DependencyProperty, Object).

(Herdado de DependencyObject)
ToString()

Fornece uma cadeia de caracteres que representa essa instância.Provides a string that represents this instance.

TrackData(Object)

Informa a infraestrutura de acompanhamento de tempo de execução das informações de acompanhamento pendentes.Informs the run-time tracking infrastructure of pending tracking information.

TrackData(String, Object)

Informa a infraestrutura de acompanhamento de tempo de execução das informações de acompanhamento pendentes.Informs the run-time tracking infrastructure of pending tracking information.

Uninitialize(IServiceProvider)

Quando substituído em uma classe derivada, fornece o cancelamento de inicialização por um provedor de serviço para a atividade.When overridden in a derived class, provides un-initialization by a service provider for the activity.

UnregisterForStatusChange(DependencyProperty, IActivityEventListener<ActivityExecutionStatusChangedEventArgs>)

Cancela o registro do DependencyProperty especificado para o evento de alteração de status.Un-registers the specified DependencyProperty for the status change event.

Eventos

Canceling

Ocorre quando a execução da atividade é cancelada.Occurs when the activity execution is canceled.

Closed

Ocorre quando um Activity concluiu a execução.Occurs when an Activity has completed execution.

Compensating

Ocorre durante a execução de um método de compensação no Activity.Occurs when running a compensation method on the Activity.

Executing

Ocorre quando o Activity é executado.Occurs when the Activity is run.

Faulting

Ocorre quando uma exceção é gerada durante a execução da instância.Occurs when an exception is raised during the running of the instance.

StatusChanged

Ocorre quando o ActivityExecutionStatus de um Activity em execução muda.Occurs when the ActivityExecutionStatus of a running Activity changes.

Implantações explícitas de interface

IComponent.Disposed

Representa o método que manipula o evento Disposed de um componente.Represents the method that handles the Disposed event of a component.

(Herdado de DependencyObject)

Aplica-se a