本文整理汇总了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);
}
}
示例2: Execute
protected override void Execute(NativeActivityContext context)
{
if (Action == null || Action.Handler == null)
{
return;
}
context.ScheduleAction(Action);
}
示例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();
}
}
示例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);
}
示例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;
}
}
示例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);
}
示例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;
}
}
示例8: Execute
protected override void Execute(NativeActivityContext context)
{
if (Body != null)
context.ScheduleAction(Body, context.GetExtension<ITwilioContext>().GetCallContext());
}
示例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();
}
}
示例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);
}
示例11: ConditionTrue
private void ConditionTrue(NativeActivityContext context)
{
context.ScheduleAction(ConditionTrueActivity);
}
示例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);
}
示例13: RunMainActivity
private void RunMainActivity(NativeActivityContext context)
{
context.ScheduleAction(MainActivity, OnMainActivityCompleted);
timesCalled++;
}
示例14: ConditionTrue
private void ConditionTrue(NativeActivityContext context)
{
timesCalled = 0;
context.ScheduleAction(ConditionTrueActivity);
}