Esempio n. 1
0
 internal void SetTemporaryResolutionData(LocationEnvironment resolutionEnvironment, bool bufferGetsOnCollapse)
 {
     this.temporaryResolutionData = new TemporaryResolutionData
     {
         TemporaryResolutionEnvironment = resolutionEnvironment,
         BufferGetsOnCollapse = bufferGetsOnCollapse
     };
 }
 internal Location InternalGetLocation(LocationEnvironment environment)
 {
     Location location;
     if (!environment.TryGetLocation(base.Id, this.Owner, out location))
     {
         throw FxTrace.Exception.AsError(new InvalidOperationException(System.Activities.SR.DelegateArgumentDoesNotExist(this.runtimeArgument.Name)));
     }
     return location;
 }
Esempio n. 3
0
        // This method exists for debugger use
        internal Location InternalGetLocation(LocationEnvironment environment)
        {
            Fx.Assert(this.IsInTree, "Variable must be opened");

            Location location;

            if (!environment.TryGetLocation(this.Id, this.Owner, out location))
            {
                throw Microsoft.CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.VariableDoesNotExist(this.Name)));
            }
            return(location);
        }
Esempio n. 4
0
        // Only used by the debugger
        internal Location InternalGetLocation(LocationEnvironment environment)
        {
            Fx.Assert(this.IsInTree, "DelegateArgument must be opened");

            Location location;

            if (!environment.TryGetLocation(this.Id, this.Owner, out location))
            {
                throw FxTrace.Exception.AsError(new InvalidOperationException(SR.DelegateArgumentDoesNotExist(this.runtimeArgument.Name)));
            }
            return(location);
        }
Esempio n. 5
0
        internal override bool TryPopulateValue(LocationEnvironment targetEnvironment, System.Activities.ActivityInstance targetActivityInstance, ActivityContext resolutionContext)
        {
            Location <T> location;

            if (this.Expression.TryGetValue(resolutionContext, out location))
            {
                targetEnvironment.Declare(base.RuntimeArgument, location.CreateReference(false), targetActivityInstance);
                return(true);
            }
            targetEnvironment.DeclareTemporaryLocation <Location <T> >(base.RuntimeArgument, targetActivityInstance, false);
            return(false);
        }
Esempio n. 6
0
        internal override bool TryPopulateValue(LocationEnvironment targetEnvironment, System.Activities.ActivityInstance activityInstance, ActivityContext resolutionContext)
        {
            T            local;
            Location <T> location = Argument.CreateLocation <T>();

            targetEnvironment.Declare(base.RuntimeArgument, location, activityInstance);
            if (this.Expression.TryGetValue(resolutionContext, out local))
            {
                location.Value = local;
                return(true);
            }
            return(false);
        }
Esempio n. 7
0
        /// <summary>
        /// Tries the populate value.
        /// </summary>
        /// <param name="targetEnvironment">The target environment.</param>
        /// <param name="targetActivityInstance">The target activity instance.</param>
        /// <param name="executor">The executor.</param>
        /// <param name="argumentValueOverride">The argument value override.</param>
        /// <param name="resultLocation">The result location.</param>
        /// <param name="skipFastPath">if set to <c>true</c> [skip fast path].</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        internal bool TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor, object argumentValueOverride, Location resultLocation, bool skipFastPath)
        {
            // We populate values in the following order:
            //   Override
            //   Binding
            //   Default

            Fx.Assert(this.IsBound, "We should ALWAYS be bound at runtime.");
            if (argumentValueOverride != null)
            {
                Fx.Assert(
                    resultLocation == null,
                    "We should never have both an override and a result location unless some day " +
                    "we decide to allow overrides for argument expressions.  If that day comes, we " +
                    "need to deal with potential issues around someone providing and override for " +
                    "a result - with the current code it wouldn't end up in the resultLocation.");

                var location = this.BoundArgument?.CreateDefaultLocation();
                targetEnvironment.Declare(this, location, targetActivityInstance);
                if (location == null)
                {
                    return(false);
                }

                location.Value = argumentValueOverride;
                return(true);
            }
            else if (!(this.BoundArgument?.IsEmpty ?? true))
            {
                if (skipFastPath)
                {
                    this.BoundArgument?.Declare(targetEnvironment, targetActivityInstance);
                    return(false);
                }
                else
                {
                    return(this.BoundArgument?.TryPopulateValue(targetEnvironment, targetActivityInstance, executor) ?? false);
                }
            }
            else if (resultLocation != null && this.IsResult)
            {
                targetEnvironment.Declare(this, resultLocation, targetActivityInstance);
                return(true);
            }
            else
            {
                var location = this.BoundArgument?.CreateDefaultLocation();
                targetEnvironment.Declare(this, location, targetActivityInstance);
                return(true);
            }
        }
        private void PerformDefaultRegistration()
        {
            if (this.bookmarkScopes == null)
            {
                this.bookmarkScopes = new List <BookmarkScopeHandle>();
            }
            this.bookmarkScopes.Add(BookmarkScopeHandle.Default);
            LocationEnvironment environment = this.owningInstance.Environment;

            if (environment != null)
            {
                for (environment = environment.Parent; environment != null; environment = environment.Parent)
                {
                    if (environment.HasHandles)
                    {
                        List <Handle> list = environment.Handles;
                        if (list != null)
                        {
                            int count = list.Count;
                            for (int i = 0; i < count; i++)
                            {
                                BookmarkScopeHandle item = list[i] as BookmarkScopeHandle;
                                if (item != null)
                                {
                                    this.bookmarkScopes.Add(item);
                                }
                            }
                        }
                    }
                }
            }
            List <Handle> handles = this.executor.Handles;

            if (handles != null)
            {
                int num3 = handles.Count;
                for (int j = 0; j < num3; j++)
                {
                    BookmarkScopeHandle handle2 = handles[j] as BookmarkScopeHandle;
                    if (handle2 != null)
                    {
                        this.bookmarkScopes.Add(handle2);
                    }
                }
            }
            this.bookmarkScopesListIsDefault = true;
        }
Esempio n. 9
0
        internal bool Initialize(System.Activities.ActivityInstance parent, ActivityInstanceMap instanceMap, LocationEnvironment parentEnvironment, long instanceId, ActivityExecutor executor, int delegateParameterCount)
        {
            this.parent      = parent;
            this.instanceMap = instanceMap;
            this.id          = instanceId;
            if (this.instanceMap != null)
            {
                this.instanceMap.AddEntry(this);
            }
            if (this.parent != null)
            {
                if (this.parent.PropertyManager != null)
                {
                    this.PropertyManager = this.parent.PropertyManager;
                }
                if (parentEnvironment == null)
                {
                    parentEnvironment = this.parent.Environment;
                }
            }
            int capacity = this.Activity.SymbolCount + delegateParameterCount;

            if (capacity == 0)
            {
                if (parentEnvironment == null)
                {
                    this.environment = new LocationEnvironment(executor, this.Activity);
                }
                else
                {
                    this.noSymbols   = true;
                    this.environment = parentEnvironment;
                }
                return(false);
            }
            this.environment = new LocationEnvironment(executor, this.Activity, parentEnvironment, capacity);
            this.substate    = Substate.ResolvingArguments;
            return(true);
        }
Esempio n. 10
0
 internal override void Declare(LocationEnvironment targetEnvironment, System.Activities.ActivityInstance targetActivityInstance)
 {
     targetEnvironment.Declare(base.RuntimeArgument, this.CreateDefaultLocation(), targetActivityInstance);
 }
Esempio n. 11
0
 public void OnEnterState(Activity expression, ActivityInstance instance, LocationEnvironment environment)
 {
     if (this.EnsureInstrumented(expression))
     {
         this.EnterState(GetOrCreateThreadId(expression, instance), expression, GenerateLocals(instance));
     }
 }
Esempio n. 12
0
 internal abstract void Declare(LocationEnvironment targetEnvironment, System.Activities.ActivityInstance activityInstance);
Esempio n. 13
0
 internal abstract bool TryPopulateValue(LocationEnvironment targetEnvironment, System.Activities.ActivityInstance targetActivityInstance, ActivityContext resolutionContext);
        // Only used by the debugger
        internal Location InternalGetLocation(LocationEnvironment environment)
        {
            Fx.Assert(this.IsInTree, "DelegateArgument must be opened");

            Location location;
            if (!environment.TryGetLocation(this.Id, this.Owner, out location))
            {
                throw FxTrace.Exception.AsError(new InvalidOperationException(SR.DelegateArgumentDoesNotExist(this.runtimeArgument.Name)));
            }
            return location;
        }
 internal override void Declare(LocationEnvironment targetEnvironment, System.Activities.ActivityInstance activityInstance)
 {
     targetEnvironment.DeclareTemporaryLocation <Location <T> >(base.RuntimeArgument, activityInstance, true);
 }
Esempio n. 16
0
 internal bool Initialize(System.Activities.ActivityInstance parent, ActivityInstanceMap instanceMap, LocationEnvironment parentEnvironment, long instanceId, ActivityExecutor executor)
 {
     return(this.Initialize(parent, instanceMap, parentEnvironment, instanceId, executor, 0));
 }
Esempio n. 17
0
 // optional "fast-path" for arguments that can be resolved synchronously
 internal abstract bool TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor);
Esempio n. 18
0
 public void OnEnterState(Activity expression, System.Activities.ActivityInstance instance, LocationEnvironment environment)
 {
     if (this.EnsureInstrumented(expression))
     {
         this.EnterState(this.GetOrCreateThreadId(expression, instance), expression, GenerateLocals(instance));
     }
 }