コード例 #1
0
        public object GetProperty(string name, IdSpace currentIdSpace)
        {
            Fx.Assert(!string.IsNullOrEmpty(name), "The name should be validated by the caller.");

            if (lastPropertyName == name && (this.lastPropertyVisibility == null || this.lastPropertyVisibility == currentIdSpace))
            {
                return(lastProperty);
            }

            ExecutionPropertyManager currentManager = this;

            while (currentManager != null)
            {
                if (currentManager.properties.TryGetValue(name, out ExecutionProperty property))
                {
                    if (!property.IsRemoved && (!property.HasRestrictedVisibility || property.Visibility == currentIdSpace))
                    {
                        this.lastPropertyName       = name;
                        this.lastProperty           = property.Property;
                        this.lastPropertyVisibility = property.Visibility;

                        return(this.lastProperty);
                    }
                }

                currentManager = GetParent(currentManager);
            }

            return(null);
        }
コード例 #2
0
        public void OnDeserialized(ActivityInstance owner, ActivityInstance parent, IdSpace visibility, ActivityExecutor executor)
        {
            this.owningInstance = owner;

            if (parent != null)
            {
                if (parent.PropertyManager != null)
                {
                    this.threadProperties = parent.PropertyManager.threadProperties;
                }
            }
            else
            {
                this.rootPropertyManager = executor.RootPropertyManager;
            }

            foreach (var property in this.properties.Values)
            {
                if (property.Property is IExecutionProperty)
                {
                    AddIExecutionProperty(property, true);
                }

                if (property.HasRestrictedVisibility)
                {
                    property.Visibility = visibility;
                }
            }
        }
コード例 #3
0
        private void ProcessChildrenForExclusiveHandles(HybridCollection <ActivityInstance> children, int amountToUpdate, ref Queue <HybridCollection <ActivityInstance> > toProcess)
        {
            for (int i = 0; i < children.Count; i++)
            {
                ActivityInstance child = children[i];

                ExecutionPropertyManager childManager = child.PropertyManager;

                if (childManager.IsOwner(child))
                {
                    childManager.exclusiveHandleCount += amountToUpdate;
                }

                HybridCollection <ActivityInstance> tempChildren = child.GetRawChildren();

                if (tempChildren != null && tempChildren.Count > 0)
                {
                    if (toProcess == null)
                    {
                        toProcess = new Queue <HybridCollection <ActivityInstance> >();
                    }

                    toProcess.Enqueue(tempChildren);
                }
            }
        }
コード例 #4
0
 public ExecutionPropertyManager(System.Activities.ActivityInstance owningInstance, ExecutionPropertyManager parentPropertyManager) : this(owningInstance)
 {
     this.threadProperties = parentPropertyManager.threadProperties;
     if (owningInstance.Parent == null)
     {
         this.rootPropertyManager = parentPropertyManager.rootPropertyManager;
     }
 }
コード例 #5
0
 internal ExecutionPropertyManager(System.Activities.ActivityInstance owningInstance, Dictionary <string, ExecutionProperty> properties)
 {
     this.owningInstance = owningInstance;
     this.properties     = properties;
     if (owningInstance == null)
     {
         this.rootPropertyManager = this;
     }
 }
コード例 #6
0
        internal ExecutionPropertyManager(ActivityInstance owningInstance, Dictionary <string, ExecutionProperty> properties)
        {
            Fx.Assert(properties != null, "properties should never be null");
            this.owningInstance = owningInstance;
            this.properties     = properties;

            // owningInstance can be null (for host-provided root properties)
            if (owningInstance == null)
            {
                this.rootPropertyManager = this;
            }
        }
コード例 #7
0
        public ExecutionPropertyManager(ActivityInstance owningInstance, ExecutionPropertyManager parentPropertyManager)
            : this(owningInstance)
        {
            Fx.Assert(parentPropertyManager != null, "caller must verify");
            this.threadProperties = parentPropertyManager.threadProperties;

            // if our parent is null, capture any root properties
            if (owningInstance.Parent == null)
            {
                this.rootPropertyManager = parentPropertyManager.rootPropertyManager;
            }
        }
コード例 #8
0
        public IEnumerable <KeyValuePair <string, object> > GetFlattenedProperties(IdSpace currentIdSpace)
        {
            ExecutionPropertyManager    currentManager      = this;
            Dictionary <string, object> flattenedProperties = new Dictionary <string, object>();

            while (currentManager != null)
            {
                AddProperties(currentManager.Properties, flattenedProperties, currentIdSpace);
                currentManager = GetParent(currentManager);
            }
            return(flattenedProperties);
        }
コード例 #9
0
 private static ExecutionPropertyManager GetParent(ExecutionPropertyManager currentManager)
 {
     if (currentManager.owningInstance == null)
     {
         return(null);
     }
     if (currentManager.owningInstance.Parent != null)
     {
         return(currentManager.owningInstance.Parent.PropertyManager);
     }
     return(currentManager.rootPropertyManager);
 }
コード例 #10
0
 public object GetProperty(string name, IdSpace currentIdSpace)
 {
     if ((this.lastPropertyName == name) && ((this.lastPropertyVisibility == null) || (this.lastPropertyVisibility == currentIdSpace)))
     {
         return(this.lastProperty);
     }
     for (ExecutionPropertyManager manager = this; manager != null; manager = GetParent(manager))
     {
         ExecutionProperty property;
         if ((manager.properties.TryGetValue(name, out property) && !property.IsRemoved) && (!property.HasRestrictedVisibility || (property.Visibility == currentIdSpace)))
         {
             this.lastPropertyName       = name;
             this.lastProperty           = property.Property;
             this.lastPropertyVisibility = property.Visibility;
             return(this.lastProperty);
         }
     }
     return(null);
 }
コード例 #11
0
 private void ProcessChildrenForExclusiveHandles(HybridCollection <System.Activities.ActivityInstance> children, int amountToUpdate, ref Queue <HybridCollection <System.Activities.ActivityInstance> > toProcess)
 {
     for (int i = 0; i < children.Count; i++)
     {
         System.Activities.ActivityInstance instance        = children[i];
         ExecutionPropertyManager           propertyManager = instance.PropertyManager;
         if (propertyManager.IsOwner(instance))
         {
             propertyManager.exclusiveHandleCount += amountToUpdate;
         }
         HybridCollection <System.Activities.ActivityInstance> rawChildren = instance.GetRawChildren();
         if ((rawChildren != null) && (rawChildren.Count > 0))
         {
             if (toProcess == null)
             {
                 toProcess = new Queue <HybridCollection <System.Activities.ActivityInstance> >();
             }
             toProcess.Enqueue(rawChildren);
         }
     }
 }
コード例 #12
0
        internal List <T> FindAll <T>() where T : class
        {
            ExecutionPropertyManager currentManager = this;
            List <T> list = null;

            while (currentManager != null)
            {
                foreach (ExecutionProperty property in currentManager.Properties.Values)
                {
                    if (property.Property is T)
                    {
                        if (list == null)
                        {
                            list = new List <T>();
                        }
                        list.Add((T)property.Property);
                    }
                }
                currentManager = GetParent(currentManager);
            }
            return(list);
        }