WorkflowRuntime.WorkflowCreated Olay

Tanım

bir iş akışı örneği oluşturulduğunda gerçekleşir.

C#
public event EventHandler<System.Workflow.Runtime.WorkflowEventArgs> WorkflowCreated;

Olay Türü

Örnekler

Aşağıdaki kod örneği, bir iş akışı konağından işlevselliğin nasıl kullanılacağını WorkflowRuntime gösterir. Kod, adlı bir yöntem OnWorkflowCreatedolan olay işleyicisi ile ilişkilendirirWorkflowCreated.

Bu kod örneği , Özel Kalıcılık Hizmeti Örneği'nin bir parçasıdır.

C#
static void Main()
{
    using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
    {
        try
        {
            // engine will unload workflow instance when it is idle
            workflowRuntime.AddService(new FilePersistenceService(true));

            workflowRuntime.WorkflowCreated += OnWorkflowCreated;
            workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
            workflowRuntime.WorkflowIdled += OnWorkflowIdle;
            workflowRuntime.WorkflowUnloaded += OnWorkflowUnload;
            workflowRuntime.WorkflowLoaded += OnWorkflowLoad;
            workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
            workflowRuntime.ServicesExceptionNotHandled += OnExceptionNotHandled;

            workflowRuntime.CreateWorkflow(typeof(PersistenceServiceWorkflow)).Start();

            waitHandle.WaitOne();
        }
        catch (Exception e)
        {
            Console.WriteLine("Exception \n\t Source: {0} \n\t Message: {1}", e.Source, e.Message);
        }
        finally
        {
            workflowRuntime.StopRuntime();
            Console.WriteLine("Workflow runtime stopped, program exiting... \n");
        }
    }
}

Açıklamalar

İş akışı çalışma zamanı altyapısı, iş akışı örneği tamamen oluşturulduğunda ancak etkinlikler işlenmeden önce olayı tetikler WorkflowCreated . Bu olay için, gönderen öğesini içerir WorkflowRuntime ve WorkflowEventArgs olayla ilişkili öğesini WorkflowInstance içerir.

Olayları işleme hakkında daha fazla bilgi için bkz. Olayları işleme ve oluşturma.

Şunlara uygulanır

Ürün Sürümler
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1