예제 #1
0
 private void AddToTaskList(List <IBotTask> tasks, IBotTask task)
 {
     if (task != null)
     {
         tasks.Add(task);
     }
 }
예제 #2
0
 public static string RenderBotLeafTaskTypeToString(IBotTask leafTask)
 {
     return(new[]
     {
         leafTask.ContainsEffect() ? "Effect" : null,
         leafTask is DiagnosticTask ? "Diagnostic: \"" + (leafTask as DiagnosticTask)?.MessageText + "\"" : null
     }.WhereNotDefault().FirstOrDefault());
 }
예제 #3
0
        public string RefuseTask(IBotTask task)
        {
            HttpRequestMessage request = task.GetTaskRefusalRequest(_user);

            if (request == null)
            {
                return("request is empty");
            }

            HttpResponseMessage response = _httpClient.SendAsync(request).Result;

            return(response.Content.ReadAsStringAsync().GetAwaiter().GetResult());
        }
예제 #4
0
        public Result <bool> CheckTask(IBotTask task)
        {
            HttpRequestMessage  request  = task.GetVerificationRequest(_user);
            HttpResponseMessage response = _httpClient.SendAsync(request).Result;

            string result = response.Content.ReadAsStringAsync().Result;

            if (result != task.SuccessState)
            {
                return(new Result <bool>(result));
            }

            return(new Result <bool>(true));
        }
예제 #5
0
        public static void ExecuteTask(IBotTask task)
        {
            var userId = task.UserApi;
            var type   = task.Type;

            switch (type)
            {
            case BotTask.BotTask.AddSymbol:
                break;

            case BotTask.BotTask.RemoveSymbol:
                break;

            case BotTask.BotTask.GetSymbolInfo:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
예제 #6
0
 static public string RenderBotLeafTaskTypeToString(IBotTask leafTask) =>
 new[]
 {
     leafTask?.Motion == null ? null: "Motion",
     leafTask is DiagnosticTask ? "Diagnostic: \"" + (leafTask as DiagnosticTask)?.MessageText + "\"" : null,
 }.WhereNotDefault().FirstOrDefault();
예제 #7
0
 static public bool ContainsEffect(this IBotTask task) =>
 0 < task?.ApplicableEffects()?.Count();
예제 #8
0
 static public IEnumerable <MotionRecommendation> ApplicableEffects(this IBotTask task) =>
 task?.ClientActions?.WhereNotDefault();
예제 #9
0
 static public bool ShouldBeIncludedInStepOutput(this IBotTask task) =>
 (task?.ContainsEffect() ?? false) || task is DiagnosticTask;
예제 #10
0
 public static IEnumerable <MotionParam> ApplicableEffects(this IBotTask task) =>
 task?.Effects?.WhereNotDefault();
예제 #11
0
 static public bool ShouldBeIncludedInStepOutput(this IBotTask task) =>
 null != task?.Motion || task is DiagnosticTask;
예제 #12
0
 public static void AddTask(IBotTask task)
 {
     TaskQueue.Enqueue(task);
 }
 public static bool ContainsEffect(this IBotTask task)
 {
     return(0 < task?.ApplicableEffects()?.Count());
 }