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


C# NativeActivityContext.ScheduleAction方法代码示例

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


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

示例1: Execute

 protected override void Execute(NativeActivityContext context)
 {
     if ((this.Action != null) && (this.Action.Handler != null))
     {
         context.ScheduleAction(this.Action, null, null);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:InvokeAction.cs

示例2: Execute

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:9,代码来源:InvokeAction.cs

示例3: Execute

 protected override void Execute(NativeActivityContext context)
 {
     SendRequestReceiveResponseScopeExecutionProperty executionProperty = context.GetSendRequestReceiveResponseScopeExecutionProperty();
     if (executionProperty.UntypedOnOperationTask != null)
     {
         // We await the task, but we won't execute the task's Func<Task> or Func<Task<TResponseResult>> return value, that is the ReceiveResponse activity's responsibility.
         context.ScheduleAction(responseResultWaiter, executionProperty.UntypedOnOperationTask);
         executionProperty.OnOperationTaskWaiterIsScheduled();
     }       
 }
开发者ID:helmsb,项目名称:Orleans.Activities,代码行数:10,代码来源:SendRequestReceiveResponseScope.cs

示例4: ExecuteBody

        private void ExecuteBody(NativeActivityContext context)
        {
            var vars = ComputationContext.GetVariables(context, this);

            int no;
            if (!vars.TryGet(IterationNoVarName, out no))
            {
                vars.Set(IterationNoVarName, 1);
            }

            context.ScheduleAction(Body, no, OnExecuteBodyCompleted);
        }
开发者ID:nagyistoce,项目名称:Neuroflow,代码行数:12,代码来源:TrainingLoop.cs

示例5: OnExtensionProgress

        private void OnExtensionProgress(NativeActivityContext context, Bookmark bookmark, Object data)
        {
            if (bookmarkProgress.Get(context) != bookmark)
                return;

            if (data is int && !context.IsCancellationRequested)
            {
                Track(context, data);
                if (this.OnProgress != null)
                    context.ScheduleAction<int>(this.OnProgress, (int)data);
            }
            else
            {
                this.noPersistHandle.Get(context).Exit(context);
                context.RemoveBookmark(bookmark);

                if (data is Exception)
                    throw data as Exception;
            }
        }
开发者ID:miguelhasse,项目名称:Workflow-Activities,代码行数:20,代码来源:FileCopy.cs

示例6: ProcessNextVectors

        private void ProcessNextVectors(NativeActivityContext context, NeuralVectors[] result)
        {
            bool reinitialize = false;
            IList<NeuralVectors> finalResult = result;

            if (IsCached(context))
            {
                var vars = ComputationContext.GetVariables(context, this); 
                var cache = vars.Get<SerializableCache>(CacheVarName).Cache;

                // Cache results:
                if (result != null)
                {
                    foreach (var vectors in result)
                    {
                        string key = vectors.ProviderIndex.ToString();
                        cache[key] = vectors;
                    }
                }

                // Combine cached vectors with result:
                var vectorsFromCache = cachedVectors.Get(context);
                cachedVectors.Set(context, null);

                if (result != null)
                {
                    if (vectorsFromCache.Count != 0)
                    {
                        finalResult = result.Concat(vectorsFromCache).ToList();
                    }
                }
                else
                {
                    finalResult = vectorsFromCache.ToList();
                }
            }

            if (ReinitializationFrequency != null && ReinitializeVectorProvider != null)
            {
                var freq = ReinitializationFrequency.Get(context);
                if (freq > 0)
                {
                    var vars = ComputationContext.GetVariables(context, this);
                    int iterations = vars.Get<int>(IterationsVarName);

                    if ((++iterations % freq) == 0)
                    {
                        context.ScheduleAction(ReinitializeVectorProvider, OnReinitializeVectorProviderCompleted);
                        reinitialize = true;
                    }

                    vars.Set(IterationsVarName, iterations);
                }
            }

            GetNextVectorsDone(context, finalResult, reinitialize ? TrainingResetSchedule.AfterExecution : TrainingResetSchedule.None);
        }
开发者ID:nagyistoce,项目名称:Neuroflow,代码行数:57,代码来源:UnorderedBatcher.cs

示例7: OnGetStatusCompleted

        /// <summary>
        /// Respond to the completion callback of the status polling activity.
        /// </summary>
        /// <param name="context">The activity context.</param>
        /// <param name="instance">The current instance of the activity.</param>
        /// <param name="result">The result of the status inquiry.</param>
        private void OnGetStatusCompleted(NativeActivityContext context, ActivityInstance instance, string result)
        {
            // Check to see if the operation faulted
            if (this.AzureActivityExceptionCaught.Get(context))
            {
                context.ScheduleActivity(this.Failure);
                return;
            }

            // Determine what to do based on the status of the Azure operation.
            switch (result)
            {
                case OperationState.Succeeded:
                    context.ScheduleActivity(this.Success);
                    break;

                case OperationState.Failed:
                    context.ScheduleActivity(this.Failure);
                    break;

                case OperationState.InProgress:
                    // Test to see if we are within the timeout
                    if (context.GetValue(this.PollingEndTime).CompareTo(DateTime.UtcNow) <= 0)
                    {
                        context.ScheduleActivity(this.Failure);
                    }

                    // Otherwise delay for the requested interval
                    context.ScheduleAction(
                        this.DelayBody, 
                        this.PollingInterval,
                        this.OnDelayCompleted);
                    break;
            }            
        }
开发者ID:modulexcite,项目名称:CustomActivities,代码行数:41,代码来源:AzureAsyncOperation.cs

示例8: Execute

 protected override void Execute(NativeActivityContext context)
 {
     if (Body != null)
         context.ScheduleAction(Body, context.GetExtension<ITwilioContext>().GetCallContext());
 }
开发者ID:wasabii,项目名称:twilio-net,代码行数:5,代码来源:CallScope.cs

示例9: Execute

        protected override void Execute(NativeActivityContext context)
        {
            IEnumerable values = this.Values.Get(context);
            if (values == null)
            {
                throw new InvalidOperationException("ParallelForEach requires a non-null Values argument.");
            }

            IEnumerator valueEnumerator = values.GetEnumerator();

            CompletionCallback onBodyComplete = new CompletionCallback(OnBodyComplete);
            while (valueEnumerator.MoveNext())
            {
                if (this.Body != null)
                {
                    context.ScheduleAction(this.Body, valueEnumerator.Current, onBodyComplete);
                }
            }
            IDisposable disposable = valueEnumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:24,代码来源:ParallelForEach.cs

示例10: InternalExecute

        void InternalExecute(NativeActivityContext context, IEnumerator valueEnumerator)
        {
            if (!valueEnumerator.MoveNext())
            {
                OnForEachComplete(valueEnumerator);
                return;
            }

            // After making sure there is another value, let's check for cancelation
            if (context.IsCancellationRequested)
            {
                context.MarkCanceled();
                OnForEachComplete(valueEnumerator);
                return;
            }

            context.ScheduleAction(this.Body, valueEnumerator.Current, this.OnChildComplete);
        }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:18,代码来源:ForEach.cs

示例11: ConditionTrue

 private void ConditionTrue(NativeActivityContext context)
 {
     context.ScheduleAction(ConditionTrueActivity);
 }
开发者ID:seanmcalinden,项目名称:restbox,代码行数:4,代码来源:HttpRequestIfElseActivityModel.cs

示例12: OnGetNextVectorsCompleted

        private void OnGetNextVectorsCompleted(NativeActivityContext context, ActivityInstance instance, NeuralVectors[] result)
        {
            if (ReinitializationFrequency != null && ReinitializeVectorProvider != null)
            {
                var freq = ReinitializationFrequency.Get(context);
                if (freq > 0)
                {
                    var vars = ComputationContext.GetVariables(context, this);
                    int iterations = vars.Get<int>(IterationsVarName);

                    if ((++iterations % freq) == 0)
                    {
                        context.ScheduleAction(ReinitializeVectorProvider, OnReinitializeVectorProviderCompleted);
                    }

                    vars.Set(IterationsVarName, iterations);
                }
            }

            GetNextVectorsDone(context, result, TrainingResetSchedule.None);
        }
开发者ID:nagyistoce,项目名称:Neuroflow,代码行数:21,代码来源:UnorderedBatcher.cs

示例13: RunMainActivity

 private void RunMainActivity(NativeActivityContext context)
 {
     context.ScheduleAction(MainActivity, OnMainActivityCompleted);
     timesCalled++;
 }
开发者ID:seanmcalinden,项目名称:restbox,代码行数:5,代码来源:RetryUntilActivityModel.cs

示例14: ConditionTrue

 private void ConditionTrue(NativeActivityContext context)
 {
     timesCalled = 0;
     context.ScheduleAction(ConditionTrueActivity);
 }
开发者ID:seanmcalinden,项目名称:restbox,代码行数:5,代码来源:RetryUntilActivityModel.cs


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