Exemplo n.º 1
0
 internal static IList <string> GetTextExpressionNamespaces(object root, out IList <AssemblyReference> references)
 {
     if (NamespaceHelper.ShouldUsePropertiesForImplementation(root))
     {
         references = TextExpression.GetReferencesForImplementation(root);
         return(TextExpression.GetNamespacesForImplementation(root));
     }
     else
     {
         references = TextExpression.GetReferences(root);
         return(TextExpression.GetNamespaces(root));
     }
 }
Exemplo n.º 2
0
        static DynamicActivity GetDynamicActivity(ActivityBuilder activityDefinition)
        {
            DynamicActivity result = new DynamicActivity
            {
                Name = activityDefinition.Name
            };

            foreach (DynamicActivityProperty property in activityDefinition.Properties)
            {
                result.Properties.Add(property);
            }
            foreach (Attribute attrib in activityDefinition.Attributes)
            {
                result.Attributes.Add(attrib);
            }
            foreach (Constraint constraint in activityDefinition.Constraints)
            {
                result.Constraints.Add(constraint);
            }
            result.Implementation = () => activityDefinition.Implementation;

            VisualBasicSettings vbsettings = VisualBasic.GetSettings(activityDefinition);

            if (vbsettings != null)
            {
                VisualBasic.SetSettings(result, vbsettings);
            }

            IList <string> namespacesForImplementation = TextExpression.GetNamespacesForImplementation(activityDefinition);

            if (namespacesForImplementation.Count > 0)
            {
                TextExpression.SetNamespacesForImplementation(result, namespacesForImplementation);
            }

            IList <AssemblyReference> referencesForImplementation = TextExpression.GetReferencesForImplementation(activityDefinition);

            if (referencesForImplementation.Count > 0)
            {
                TextExpression.SetReferencesForImplementation(result, referencesForImplementation);
            }

            return(result);
        }
Exemplo n.º 3
0
        private static DynamicActivity GetDynamicActivity(ActivityBuilder activityDefinition)
        {
            var result = new DynamicActivity
            {
                Name = activityDefinition.Name
            };

            foreach (var property in activityDefinition.Properties)
            {
                result.Properties.Add(property);
            }
            foreach (var attrib in activityDefinition.Attributes)
            {
                result.Attributes.Add(attrib);
            }
            foreach (var constraint in activityDefinition.Constraints)
            {
                result.Constraints.Add(constraint);
            }
            result.Implementation = () => activityDefinition.Implementation;

            var vbsettings = VisualBasic.GetSettings(activityDefinition);

            if (vbsettings != null)
            {
                VisualBasic.SetSettings(result, vbsettings);
            }

            var namespacesForImplementation = TextExpression.GetNamespacesForImplementation(activityDefinition);

            if (namespacesForImplementation.Count > 0)
            {
                TextExpression.SetNamespacesForImplementation(result, namespacesForImplementation);
            }

            var referencesForImplementation = TextExpression.GetReferencesForImplementation(activityDefinition);

            if (referencesForImplementation.Count > 0)
            {
                TextExpression.SetReferencesForImplementation(result, referencesForImplementation);
            }

            return(result);
        }
        public static IEnumerable <string> EnumerateImports(EditingContext context, ModelItem modelItem)
        {
            IEnumerable <string> enumerable = context?.Services.GetService(typeof(HashSet <string>)) as HashSet <string>;
            IEnumerable <string> first      = enumerable ?? Enumerable.Empty <string>();
            object obj = modelItem?.Root?.GetCurrentValue();
            object enumerable2;

            if (obj == null)
            {
                enumerable2 = Enumerable.Empty <string>();
            }
            else
            {
                enumerable  = TextExpression.GetNamespacesForImplementation(obj);
                enumerable2 = enumerable;
            }
            IEnumerable <string> second = (IEnumerable <string>)enumerable2;

            return(first.Union(second).Distinct());
        }
Exemplo n.º 5
0
 private IList <string> GetImports(Activity workflow)
 {
     return(TextExpression.GetNamespacesForImplementation(workflow) ?? new string[0]);
 }