/// <summary> /// Called when taskTimer elapsed. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.Timers.ElapsedEventArgs"/> instance containing the event data.</param> private static void OnTaskTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) { // get them out of the tasksInfos lists if (taskResultInfos.Count > 0) { TaskResultInfo t = (TaskResultInfo)taskResultInfos.Dequeue(); //DispatchInvocationToGuiThread(new MethodInvocation(t.Task.ProgressHandler, new object[]{t.Task, t.Args})); GuiInvoker.Invoke(null, () => t.Task.ProgressHandler(t.Task, t.Args)); //t.Task.ProgressHandler(t.Task, t.Args); } // we do not start all waiting task thread at once: if (!waitForGlobalThreadResource && taskStartInfos.Count > 0) { TaskStartInfo tInfo = (TaskStartInfo)taskStartInfos.Dequeue(); if (TaskStartInfo.StartMethod.ThreadStart == tInfo.ThreadStartMethod) { StartTask(tInfo.Task, tInfo.Action); } else if (TaskStartInfo.StartMethod.ThreadPool == tInfo.ThreadStartMethod) { QueueTask(tInfo.Task, tInfo.Action); } } }
private void AddData2(TaskResultInfo _info) { if (_info.TaskRunResult != null) { string _jsCheckData = _info.TaskRunResult.ResultMsg; var jser = new JavaScriptSerializer(); List <CheckInfoResult> _results = jser.Deserialize(_jsCheckData, typeof(List <CheckInfoResult>)) as List <CheckInfoResult>; foreach (CheckInfoResult _r in _results) { RefreshResultShow2(_r); } } }