static bool FindLocationReferencesFromEnvironment(LocationReferenceEnvironment environment, string targetName)
        {
            LocationReference foundLocationReference = null;            
            LocationReferenceEnvironment currentEnvironment;
            bool foundMultiple = false;

            currentEnvironment = environment;            
            while (currentEnvironment != null)
            {
                foreach (LocationReference reference in currentEnvironment.GetLocationReferences())
                {
                    if (string.Equals(reference.Name, targetName, StringComparison.OrdinalIgnoreCase))
                    {
                        if (foundLocationReference != null)
                        {
                            foundMultiple = true;
                            return foundMultiple;
                        }

                        foundLocationReference = reference;
                    }
                }

                currentEnvironment = currentEnvironment.Parent;
            }

            return foundMultiple;
        }
Exemplo n.º 2
0
        PropertyDescriptorCollection CreateProperties()
        {
            // The name in child Activity will shadow the name in parent.
            Dictionary <string, object> names = new Dictionary <string, object>();

            List <PropertyDescriptorImpl> propertyList = new List <PropertyDescriptorImpl>();

            LocationReferenceEnvironment environment = this.activityInstance.Activity.PublicEnvironment;
            bool isLocalEnvironment = true;

            while (environment != null)
            {
                foreach (LocationReference locRef in environment.GetLocationReferences())
                {
                    if (this.IncludesLocalVariables || !isLocalEnvironment || !(locRef is Variable))
                    {
                        AddProperty(locRef, names, propertyList);
                    }
                }

                environment        = environment.Parent;
                isLocalEnvironment = false;
            }

            return(new PropertyDescriptorCollection(propertyList.ToArray(), true));
        }
        private PropertyDescriptorCollection CreateProperties()
        {
            Dictionary <string, object>   names        = new Dictionary <string, object>();
            List <PropertyDescriptorImpl> propertyList = new List <PropertyDescriptorImpl>();

            for (LocationReferenceEnvironment environment = this.activityInstance.Activity.PublicEnvironment; environment != null; environment = environment.Parent)
            {
                foreach (LocationReference reference in environment.GetLocationReferences())
                {
                    this.AddProperty(reference, names, propertyList);
                }
            }
            return(new PropertyDescriptorCollection(propertyList.ToArray(), true));
        }