Files
dotnet-bot 332534dede Adding reference source for part of Workflow Foundation
Adding reference source for
System.Activities
System.Activities.DurableInstancing
System.Activities.Presentation
System.Runtime.DurableInstancing
System.Workflow.Activities
System.Workflow.ComponentModel
System.Workflow.Runtime
System.WorkflowServices
System.Xaml.Hosting
XamlBuildTask
2016-05-03 00:07:54 +02:00

34 lines
1.5 KiB
C#

//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.Activities.Runtime
{
using System;
using System.Runtime;
using System.Runtime.Serialization;
using System.Security;
[DataContract]
class ActivityCompletionCallbackWrapper : CompletionCallbackWrapper
{
static readonly Type completionCallbackType = typeof(CompletionCallback);
static readonly Type[] completionCallbackParameters = new Type[] { typeof(NativeActivityContext), typeof(ActivityInstance) };
public ActivityCompletionCallbackWrapper(CompletionCallback callback, ActivityInstance owningInstance)
: base(callback, owningInstance)
{
}
[Fx.Tag.SecurityNote(Critical = "Because we are calling EnsureCallback",
Safe = "Safe because the method needs to be part of an Activity and we are casting to the callback type and it has a very specific signature. The author of the callback is buying into being invoked from PT.")]
[SecuritySafeCritical]
protected internal override void Invoke(NativeActivityContext context, ActivityInstance completedInstance)
{
EnsureCallback(completionCallbackType, completionCallbackParameters);
CompletionCallback completionCallback = (CompletionCallback)this.Callback;
completionCallback(context, completedInstance);
}
}
}