WorkflowInvoker.EndInvoke(IAsyncResult) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
오버로드 중 하나를 사용하여 호출된 워크플로의 BeginInvoke 결과를 반환합니다.
public:
System::Collections::Generic::IDictionary<System::String ^, System::Object ^> ^ EndInvoke(IAsyncResult ^ result);
public System.Collections.Generic.IDictionary<string,object> EndInvoke(IAsyncResult result);
member this.EndInvoke : IAsyncResult -> System.Collections.Generic.IDictionary<string, obj>
Public Function EndInvoke (result As IAsyncResult) As IDictionary(Of String, Object)
매개 변수
- result
- IAsyncResult
IAsyncResult 워크플로를 BeginInvoke 시작한 작업을 참조하는 것입니다.
반품
워크플로의 출력을 나타내는 인수 이름으로 키가 지정된 루트 활동의 OutArgument 사전 및 InOutArgument 값입니다.
예제
다음 예제에서는 활동으로 구성된 워크플로를 LongRunningDiceRoll 호출합니다.
LongRunningDiceRoll 작업에는 주사위 롤 작업의 결과를 나타내는 두 개의 출력 인수가 있습니다. 호출하여 EndInvoke검색됩니다. 호출 EndInvoke 이 반환되면 각 출력 인수가 출력 사전에 반환되고 인수 이름으로 키가 지정됩니다.
public sealed class LongRunningDiceRoll : Activity
{
public OutArgument<int> D1 { get; set; }
public OutArgument<int> D2 { get; set; }
public LongRunningDiceRoll()
{
this.Implementation = () => new Sequence
{
Activities =
{
new WriteLine
{
Text = "Rolling the dice for 5 seconds."
},
new Delay
{
Duration = TimeSpan.FromSeconds(5)
},
new DiceRoll
{
D1 = new OutArgument<int>(env => this.D1.Get(env)),
D2 = new OutArgument<int>(env => this.D2.Get(env))
}
}
};
}
}
static void BeginInvokeExample()
{
WorkflowInvoker invoker = new WorkflowInvoker(new LongRunningDiceRoll());
string userState = "BeginInvoke example";
IAsyncResult result = invoker.BeginInvoke(new AsyncCallback(WorkflowCompletedCallback), userState);
// You can inspect result from the host to determine if the workflow
// is complete.
Console.WriteLine("result.IsCompleted: {0}", result.IsCompleted);
// The results of the workflow are retrieved by calling EndInvoke, which
// can be called from the callback or from the host. If called from the
// host, it blocks until the workflow completes. If a callback is not
// required, pass null for the callback parameter.
Console.WriteLine("Waiting for the workflow to complete.");
IDictionary<string, object> outputs = invoker.EndInvoke(result);
Console.WriteLine("The two dice are {0} and {1}.",
outputs["D1"], outputs["D2"]);
}
static void WorkflowCompletedCallback(IAsyncResult result)
{
Console.WriteLine("Workflow complete.");
}
설명
워크플로가 완료되고 워크플로의 출력 매개 변수를 검색할 때 알림을 받으려면 지정된 메서드BeginInvoke에서 callback 호출 EndInvoke 합니다. 워크플로가 완료되기 전에 호출되면 EndInvoke 워크플로가 완료될 때까지 차단됩니다.
이 메서드는 비동기 디자인 패턴을 사용하여 비동기적으로 호출된 워크플로의 IAsyncResult 결과를 반환합니다. 자세한 내용은 비동기 프로그래밍 개요를 참조하세요.