ResolveNextArgumentWorkItem.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Runtime / ResolveNextArgumentWorkItem.cs / 1305376 / ResolveNextArgumentWorkItem.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.Activities.Runtime 
{
    using System.Collections.Generic; 
    using System.Runtime.Serialization; 
    using System.Runtime;
 
    [DataContract]
    class ResolveNextArgumentWorkItem : ActivityExecutionWorkItem
    {
        [DataMember(EmitDefaultValue = false)] 
        int nextArgumentIndex;
 
        [DataMember(EmitDefaultValue = false)] 
        IDictionary argumentValueOverrides;
 
        [DataMember(EmitDefaultValue = false)]
        Location resultLocation;

        public ResolveNextArgumentWorkItem() 
        {
            this.IsPooled = true; 
        } 

        public override void TraceScheduled() 
        {
            TraceRuntimeWorkItemScheduled();
        }
 
        public override void TraceStarting()
        { 
            TraceRuntimeWorkItemStarting(); 
        }
 
        public override void TraceCompleted()
        {
            TraceRuntimeWorkItemCompleted();
        } 

        public void Initialize(ActivityInstance activityInstance, int nextArgumentIndex, IDictionary argumentValueOverrides, Location resultLocation) 
        { 
            Fx.Assert(nextArgumentIndex > 0, "The nextArgumentIndex must be greater than 0 otherwise we will incorrectly set the sub-state when ResolveArguments completes");
            base.Reinitialize(activityInstance); 
            this.nextArgumentIndex = nextArgumentIndex;
            this.argumentValueOverrides = argumentValueOverrides;
            this.resultLocation = resultLocation;
        } 

        protected override void ReleaseToPool(ActivityExecutor executor) 
        { 
            base.ClearForReuse();
            this.nextArgumentIndex = 0; 
            this.resultLocation = null;
            this.argumentValueOverrides = null;

            executor.ResolveNextArgumentWorkItemPool.Release(this); 
        }
 
        public override bool Execute(ActivityExecutor executor, BookmarkManager bookmarkManager) 
        {
            this.ActivityInstance.ResolveArguments(executor, argumentValueOverrides, resultLocation, nextArgumentIndex); 

            // Return true always to prevent scheduler from yielding silently.
            return true;
        } 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK