예제 #1
0
        public void AddImplementationDelegate(ActivityDelegate implementationDelegate)
        {
            ThrowIfDisposed();

            if (implementationDelegate != null)
            {
                _activity.AddImplementationDelegate(implementationDelegate);
            }
        }
예제 #2
0
        public void AddImportedDelegate(ActivityDelegate importedDelegate, object origin)
        {
            ThrowIfDisposed();
            ActivityUtilities.ValidateOrigin(origin, _activity);

            if (importedDelegate != null)
            {
                _activity.AddImportedDelegate(importedDelegate);
                if (importedDelegate.Handler != null && importedDelegate.Handler.CacheId != _activity.CacheId)
                {
                    importedDelegate.Handler.Origin = origin;
                }
                // We don't currently have ActivityDelegate.Origin. If we ever add it, or if we ever
                // expose Origin publicly, we need to also set it here.
            }
        }
예제 #3
0
 public void AddImportedDelegate(ActivityDelegate importedDelegate)
 {
     AddImportedDelegate(importedDelegate, null);
 }
예제 #4
0
 public void AddDelegate(ActivityDelegate activityDelegate)
 {
     AddDelegate(activityDelegate, null);
 }
예제 #5
0
        public static IEnumerable <Activity> GetActivities(Activity activity)
        {
            if (activity == null)
            {
                throw Microsoft.CoreWf.Internals.FxTrace.Exception.ArgumentNull("activity");
            }

            if (!activity.IsMetadataCached)
            {
                IList <ValidationError> validationErrors = null;

                ActivityUtilities.CacheRootMetadata(activity, new ActivityLocationReferenceEnvironment(), ProcessActivityTreeOptions.FullCachingOptions, null, ref validationErrors);

                ActivityValidationServices.ThrowIfViolationsExist(validationErrors);
            }

            int i = 0;

            for (; i < activity.RuntimeArguments.Count; i++)
            {
                RuntimeArgument argument = activity.RuntimeArguments[i];

                if (argument.BoundArgument != null && argument.BoundArgument.Expression != null)
                {
                    yield return(argument.BoundArgument.Expression);
                }
            }

            for (i = 0; i < activity.RuntimeVariables.Count; i++)
            {
                Variable variable = activity.RuntimeVariables[i];

                if (variable.Default != null)
                {
                    yield return(variable.Default);
                }
            }

            for (i = 0; i < activity.ImplementationVariables.Count; i++)
            {
                Variable variable = activity.ImplementationVariables[i];

                if (variable.Default != null)
                {
                    yield return(variable.Default);
                }
            }

            for (i = 0; i < activity.Children.Count; i++)
            {
                yield return(activity.Children[i]);
            }

            for (i = 0; i < activity.ImportedChildren.Count; i++)
            {
                yield return(activity.ImportedChildren[i]);
            }

            for (i = 0; i < activity.ImplementationChildren.Count; i++)
            {
                yield return(activity.ImplementationChildren[i]);
            }

            for (i = 0; i < activity.Delegates.Count; i++)
            {
                ActivityDelegate activityDelegate = activity.Delegates[i];

                if (activityDelegate.Handler != null)
                {
                    yield return(activityDelegate.Handler);
                }
            }

            for (i = 0; i < activity.ImportedDelegates.Count; i++)
            {
                ActivityDelegate activityDelegate = activity.ImportedDelegates[i];

                if (activityDelegate.Handler != null)
                {
                    yield return(activityDelegate.Handler);
                }
            }

            for (i = 0; i < activity.ImplementationDelegates.Count; i++)
            {
                ActivityDelegate activityDelegate = activity.ImplementationDelegates[i];

                if (activityDelegate.Handler != null)
                {
                    yield return(activityDelegate.Handler);
                }
            }
        }