Xamarin Public Jenkins (auto-signing) e79aa3c0ed Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
2016-08-03 10:59:49 +00:00

40 lines
1.5 KiB
C#

using System;
using System.Diagnostics;
using System.Reflection;
using System.Collections;
using System.Workflow.ComponentModel;
using System.Workflow.Runtime;
using System.Xml;
using System.Workflow.Activities.Common;
namespace System.Workflow.Activities
{
internal static class ActivityHelpers
{
internal static void InitializeCorrelationTokenCollection(Activity activity, CorrelationToken correlator)
{
if (correlator != null && !String.IsNullOrEmpty(correlator.OwnerActivityName))
{
string ownerActivityId = correlator.OwnerActivityName;
Activity owner = activity.GetActivityByName(ownerActivityId);
if (owner == null)
owner = System.Workflow.Activities.Common.Helpers.ParseActivityForBind(activity, ownerActivityId);
if (owner == null)
throw new ArgumentException("ownerActivity");
CorrelationTokenCollection collection = owner.GetValue(CorrelationTokenCollection.CorrelationTokenCollectionProperty) as CorrelationTokenCollection;
if (collection == null)
{
collection = new CorrelationTokenCollection();
owner.SetValue(CorrelationTokenCollection.CorrelationTokenCollectionProperty, collection);
}
if (!collection.Contains(correlator.Name))
{
collection.Add(correlator);
}
}
}
}
}