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


C# ITask.Update方法代码示例

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


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

示例1: Process

 /// <summary>
 /// Processes the task based on its current state.
 /// </summary>
 /// <remarks>
 /// <para>
 /// Only performs a single action per call.  So it will always take multiple calls for a 
 /// task to be fully processed.
 /// </para>
 /// <para>
 /// The <paramref name="failure"/> flag indicates whether the task is in a failed state.
 /// (Note: It may still need processing.)
 /// </para>
 /// </remarks>
 /// <param name="task">The behaivor to process.</param>
 /// <param name="failure">True if the task is detected in a failed state.</param>
 /// <returns>True if the task needs more processing.</returns>
 public static bool Process(AgentContext context, ITask task, out bool failure)
 {
     failure = false;
     switch (task.State)
     {
         case TaskState.Active:
             task.Update(context);
             return true;
         case TaskState.Complete:
             return !task.Exit(context);
         case TaskState.Exiting:
             return !task.Exit(context);
         case TaskState.Failed:
             failure = true;
             return !task.Exit(context);
         case TaskState.Inactive:
             task.Update(context);
             return true;
     }
     return true;
 }
开发者ID:tsuixl,项目名称:act,代码行数:37,代码来源:TaskUtil.cs

示例2: ProcessImmediate

 /// <summary>
 /// Processes the task based on its current state, optimized to complete the task more 
 /// quickly.
 /// </summary>
 /// <remarks>
 /// <para>
 /// The exit process will be triggered as soon as completion is dectected.  So this 
 /// method may perform two operations (update and exit) in a single call.
 /// </para>
 /// </remarks>
 /// <param name="task">The task to process.</param>
 /// <returns>True if the task needs more processing.</returns>
 public static bool ProcessImmediate(AgentContext context, ITask task)
 {
     switch (task.State)
     {
         case TaskState.Active:
             if (IsFinished(task.Update(context)))
                 return !task.Exit(context);
             return true;
         case TaskState.Complete:
             return !task.Exit(context);
         case TaskState.Exiting:
             return !task.Exit(context);
         case TaskState.Failed:
             return !task.Exit(context);
         case TaskState.Inactive:
             if (IsFinished(task.Update(context)))
                 return !task.Exit(context);
             return true;
     }
     return true;
 }
开发者ID:tsuixl,项目名称:act,代码行数:33,代码来源:TaskUtil.cs


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