当前位置: 首页>>代码示例>>C#>>正文


C# NativeActivityContext类代码示例

本文整理汇总了C#中NativeActivityContext的典型用法代码示例。如果您正苦于以下问题:C# NativeActivityContext类的具体用法?C# NativeActivityContext怎么用?C# NativeActivityContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NativeActivityContext类属于命名空间,在下文中一共展示了NativeActivityContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InternalExecute

        void InternalExecute(NativeActivityContext context, ActivityInstance completedInstance)
        {
            CompensationExtension compensationExtension = context.GetExtension<CompensationExtension>();
            if (compensationExtension == null)
            {
                throw FxTrace.Exception.AsError(new InvalidOperationException(SR.ConfirmWithoutCompensableActivity(this.DisplayName)));
            }

            CompensationToken token = Target.Get(context);
            CompensationTokenData tokenData = token == null ? null : compensationExtension.Get(token.CompensationId);

            Fx.Assert(tokenData != null, "CompensationTokenData must be valid");

            if (tokenData.ExecutionTracker.Count > 0)
            {
                if (this.onChildConfirmed == null)
                {
                    this.onChildConfirmed = new CompletionCallback(InternalExecute);
                }

                this.toConfirmToken.Set(context, new CompensationToken(tokenData.ExecutionTracker.Get()));

                Fx.Assert(Body != null, "Body must be valid");
                context.ScheduleActivity(Body, this.onChildConfirmed);
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:DefaultConfirmation.cs

示例2: Execute

 /// <summary>
 /// The execute.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 protected override void Execute(NativeActivityContext context)
 {
     context.CreateBookmark(
         this.BookmarkName.Get(context),
         (activityContext, bookmark, value) =>
         activityContext.ResumeBookmark(new Bookmark(this.BookmarkName.Get(activityContext)), null));
 }
开发者ID:IcodeNet,项目名称:cleansolution,代码行数:13,代码来源:WaitForBookmark.cs

示例3: OnExecuteBodyCompleted

        private void OnExecuteBodyCompleted(NativeActivityContext context, ActivityInstance instance)
        {
            var vars = ComputationContext.GetVariables(context, this);
            vars.Set(IterationNoVarName, vars.Get<int>(IterationNoVarName) + 1);

            context.ScheduleActivity(Condition, OnExecuteConditionCompleted);
        }
开发者ID:nagyistoce,项目名称:Neuroflow,代码行数:7,代码来源:TrainingLoop.cs

示例4: GetPowerShell

        // Module defining this command
        

        // Optional custom code for this activity
        

        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments
            
            if(Path.Expression != null)
            {
                targetCommand.AddParameter("Path", Path.Get(context));
            }

            if(LiteralPath.Expression != null)
            {
                targetCommand.AddParameter("LiteralPath", LiteralPath.Get(context));
            }

            if(IncludeTotalCount.Expression != null)
            {
                targetCommand.AddParameter("IncludeTotalCount", IncludeTotalCount.Get(context));
            }

            if(Skip.Expression != null)
            {
                targetCommand.AddParameter("Skip", Skip.Get(context));
            }

            if(First.Expression != null)
            {
                targetCommand.AddParameter("First", First.Get(context));
            }


            return new ActivityImplementationContext() { PowerShellInstance = invoker };
        }
开发者ID:40a,项目名称:PowerShell,代码行数:47,代码来源:ImportClixmlActivity.cs

示例5: Execute

        protected override void Execute(NativeActivityContext context)
        {
            if (this.Activities.Count > 0)
            {

                Bookmark bm = context.Properties.Find(Constants._ContainsChildWizard) as Bookmark;

                if (bm != null)
                {
                    context.ResumeBookmark(bm, true);

                }

                Bookmark parentbm = context.Properties.Find(Constants._ResumeParent) as Bookmark;
                if (parentbm != null)
                {
                    this.ResumeParent.Set(context, parentbm);
                }
                Bookmark ResumeParent = context.CreateBookmark(ResumeParentCallBack, BookmarkOptions.NonBlocking | BookmarkOptions.MultipleResume);
                context.Properties.Update(Constants._ResumeParent, ResumeParent);

                FindStepAndSchedule(context);

            }
        }
开发者ID:jayasankaram1,项目名称:mvc4workflowCheckoutDemo,代码行数:25,代码来源:Wizard.cs

示例6: GetVariables

        public static GenericVariableCollection GetVariables(NativeActivityContext context, Activity activity)
        {
            Contract.Requires(context != null);
            Contract.Requires(activity != null);

            return GetVariables(context, activity.Id);
        }
开发者ID:nagyistoce,项目名称:Neuroflow,代码行数:7,代码来源:ComputationContext.cs

示例7: GetPowerShell

        // Module defining this command
        

        // Optional custom code for this activity
        

        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments
            
            if(Name.Expression != null)
            {
                targetCommand.AddParameter("Name", Name.Get(context));
            }

            if(Force.Expression != null)
            {
                targetCommand.AddParameter("Force", Force.Get(context));
            }

            if(SecurityDescriptorSddl.Expression != null)
            {
                targetCommand.AddParameter("SecurityDescriptorSddl", SecurityDescriptorSddl.Get(context));
            }

            if(SkipNetworkProfileCheck.Expression != null)
            {
                targetCommand.AddParameter("SkipNetworkProfileCheck", SkipNetworkProfileCheck.Get(context));
            }

            if(NoServiceRestart.Expression != null)
            {
                targetCommand.AddParameter("NoServiceRestart", NoServiceRestart.Get(context));
            }


            return new ActivityImplementationContext() { PowerShellInstance = invoker };
        }
开发者ID:dfinke,项目名称:powershell,代码行数:47,代码来源:EnablePSSessionConfigurationActivity.cs

示例8: GetPowerShell

        // Module defining this command
        

        // Optional custom code for this activity
        

        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments
            
            if(HotFixId.Expression != null)
            {
                targetCommand.AddParameter("Id", HotFixId.Get(context));
            }

            if(Description.Expression != null)
            {
                targetCommand.AddParameter("Description", Description.Get(context));
            }

            if(Credential.Expression != null)
            {
                targetCommand.AddParameter("Credential", Credential.Get(context));
            }

            if(GetIsComputerNameSpecified(context) && (PSRemotingBehavior.Get(context) == RemotingBehavior.Custom))
            {
                targetCommand.AddParameter("ComputerName", PSComputerName.Get(context));
            }


            return new ActivityImplementationContext() { PowerShellInstance = invoker };
        }
开发者ID:dfinke,项目名称:powershell,代码行数:42,代码来源:GetHotFixActivity.cs

示例9: GetPowerShell

        // Module defining this command
        

        // Optional custom code for this activity
        

        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments
            
            if(Date.Expression != null)
            {
                targetCommand.AddParameter("Date", Date.Get(context));
            }

            if(Adjust.Expression != null)
            {
                targetCommand.AddParameter("Adjust", Adjust.Get(context));
            }

            if(DisplayHint.Expression != null)
            {
                targetCommand.AddParameter("DisplayHint", DisplayHint.Get(context));
            }


            return new ActivityImplementationContext() { PowerShellInstance = invoker };
        }
开发者ID:dfinke,项目名称:powershell,代码行数:37,代码来源:SetDateActivity.cs

示例10: GetPowerShell

        // Module defining this command
        

        // Optional custom code for this activity
        

        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments
            
            if(SourceIdentifier.Expression != null)
            {
                targetCommand.AddParameter("SourceIdentifier", SourceIdentifier.Get(context));
            }

            if(Sender.Expression != null)
            {
                targetCommand.AddParameter("Sender", Sender.Get(context));
            }

            if(EventArguments.Expression != null)
            {
                targetCommand.AddParameter("EventArguments", EventArguments.Get(context));
            }

            if(MessageData.Expression != null)
            {
                targetCommand.AddParameter("MessageData", MessageData.Get(context));
            }


            return new ActivityImplementationContext() { PowerShellInstance = invoker };
        }
开发者ID:40a,项目名称:PowerShell,代码行数:42,代码来源:NewEventActivity.cs

示例11: GetPowerShell

        // Module defining this command
        

        // Optional custom code for this activity
        

        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments
            
            if(PSProvider.Expression != null)
            {
                targetCommand.AddParameter("PSProvider", PSProvider.Get(context));
            }

            if(PSDrive.Expression != null)
            {
                targetCommand.AddParameter("PSDrive", PSDrive.Get(context));
            }

            if(Stack.Expression != null)
            {
                targetCommand.AddParameter("Stack", Stack.Get(context));
            }

            if(StackName.Expression != null)
            {
                targetCommand.AddParameter("StackName", StackName.Get(context));
            }


            return new ActivityImplementationContext() { PowerShellInstance = invoker };
        }
开发者ID:40a,项目名称:PowerShell,代码行数:42,代码来源:GetLocationActivity.cs

示例12: Cancel

 protected override void Cancel(NativeActivityContext context)
 {
     Bookmark bookmark = this.timerBookmark.Get(context);
     this.GetTimerExtension(context).CancelTimer(bookmark);
     context.RemoveBookmark(bookmark);
     context.MarkCanceled();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:Delay.cs

示例13: GetPowerShell

        // Module defining this command
        

        // Optional custom code for this activity
        

        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments
            
            if(Path.Expression != null)
            {
                targetCommand.AddParameter("Path", Path.Get(context));
            }

            if(ChildPath.Expression != null)
            {
                targetCommand.AddParameter("ChildPath", ChildPath.Get(context));
            }

            if(Resolve.Expression != null)
            {
                targetCommand.AddParameter("Resolve", Resolve.Get(context));
            }

            if(Credential.Expression != null)
            {
                targetCommand.AddParameter("Credential", Credential.Get(context));
            }


            return new ActivityImplementationContext() { PowerShellInstance = invoker };
        }
开发者ID:40a,项目名称:PowerShell,代码行数:42,代码来源:JoinPathActivity.cs

示例14: Execute

 protected override void Execute(NativeActivityContext context)
 {
     if (this.Body != null)
     {
         context.ScheduleActivity(this.Body, new CompletionCallback(OnBodyComplete));
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:CancellationScope.cs

示例15: OnExecute

        protected override void OnExecute(NativeActivityContext context, object objectToValidate, ValidationContext objectToValidateContext)
        {
            bool foundMultiple;
            ActivityWithResult boundExpression;
            LocationReference locationReference;
            ActivityWithResult activity = (ActivityWithResult)objectToValidate;

            foreach (RuntimeArgument runtimeArgument in activity.RuntimeArguments)
            {
                boundExpression = runtimeArgument.BoundArgument.Expression;

                if (boundExpression != null && boundExpression is ILocationReferenceWrapper)
                {
                    locationReference = ((ILocationReferenceWrapper)boundExpression).LocationReference;

                    if (locationReference != null)
                    {
                        foundMultiple = FindLocationReferencesFromEnvironment(objectToValidateContext.Environment, locationReference.Name);
                        if (foundMultiple)
                        {
                            Constraint.AddValidationError(context, new ValidationError(SR.AmbiguousVBVariableReference(locationReference.Name)));
                        }
                    }
                }               
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:26,代码来源:VisualBasicNameShadowingConstraint.cs


注:本文中的NativeActivityContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。