示例#1
0
        private async Task ProcessTasks(List <TaskSch> tobeRunGroup)
        {
            List <Task> taskList = new List <Task>();


            if (tobeRunGroup != null)
            {
                foreach (var task in tobeRunGroup)
                {
                    ProcessUtils.AdbOpenApps(task.MobileIndex, "com.facebook.katana");
                    taskList.Add(TasksSchedule.ProcessSingleTask(task));
                }

                await Task.Delay(8000);

                try
                {
                    LogUtils.Information($"count of tobeRunGroup:{taskList.Count}");
                    await Task.WhenAll(taskList);
                }
                catch (Exception ex)
                {
                    _previousGlobalTaskByGroupFinished = true;

                    LogUtils.Error($"{ex}");
                }
            }

            _previousGlobalTaskByGroupFinished = true;
        }
示例#2
0
        private async Task ProcessTasks(List <TaskSch> tasks)
        {
            List <Task> taskList = new List <Task>();


            if (tasks != null)
            {
                foreach (var task in tasks)
                {
                    ProcessUtils.AdbOpenApps(task.MobileIndex, "com.facebook.katana");
                    taskList.Add(TasksSchedule.ProcessSingleTask(task));
                }

                await Task.Delay(5000);

                try
                {
                    await Task.WhenAll(taskList);

                    foreach (var task in tasks)
                    {
                        TasksBLL.UpdateTimedTaskExecuteTime(task.Id);
                    }
                }
                catch (Exception ex)
                {
                    LogUtils.Error($"{ex}");

                    foreach (var task in tasks)
                    {
                        TasksBLL.UpdateTimedTaskExecuteTime(task.Id);
                    }

                    _previousTimedTaskByGroupFinished = true;
                }
            }

            _previousTimedTaskByGroupFinished = true;
        }