/// <summary> /// 获取List<CaseRunner>中的更新信息 /// </summary> /// <param name="runnerList">CaseRunner 列表</param> /// <param name="isUpdataAll">T表示全部更新,F标识局部更新</param> /// <returns>更新信息</returns> private RemoteRunnerInfo GetRunnerInfo(List <CaseRunner> runnerList, bool isUpdataAll) { RemoteRunnerInfo remoteRunnerInfo = new RemoteRunnerInfo(); if (runnerList == null) { return(null); } foreach (CaseRunner tempRunner in runnerList) { if (tempRunner.IsNeedUpdata || isUpdataAll) { tempRunner.IsNeedUpdata = false; RunnerState tempRunnerState = new RunnerState(); if (tempRunner.RunerActuator.NowExecutionResultList != null) { if (tempRunner.RunerActuator.NowExecutionResultList.Count > 0) { MyExecutionDeviceResult tempResult = tempRunner.RunerActuator.NowExecutionResultList[tempRunner.RunerActuator.NowExecutionResultList.Count - 1]; tempRunnerState.RunnerID = runnerList.IndexOf(tempRunner); tempRunnerState.RunnerName = tempRunner.RunnerName; tempRunnerState.NowCell = tempResult.caseId.ToString(); tempRunnerState.CellResult = tempResult.result.ToString(); tempRunnerState.State = tempRunner.RunnerState.ToString(); tempRunnerState.Time = tempResult.spanTime; tempRunnerState.RunDetails = tempResult.backContent; tempRunnerState.RunnerProgress = tempRunner.RunerActuator.RunProgress; remoteRunnerInfo.AddRunnerState(tempRunnerState); } else if (isUpdataAll)//对于空NowExecutionResultList来说,如果要求全部更新则要求构造一个初始的数据体 { tempRunnerState.RunnerID = runnerList.IndexOf(tempRunner); tempRunnerState.RunnerName = tempRunner.RunnerName; tempRunnerState.NowCell = ""; tempRunnerState.CellResult = ""; tempRunnerState.State = tempRunner.RunnerState.ToString(); tempRunnerState.Time = ""; tempRunnerState.RunDetails = ""; tempRunnerState.RunnerProgress = tempRunner.RunerActuator.RunProgress; remoteRunnerInfo.AddRunnerState(tempRunnerState); } else { tempRunnerState.RunnerID = runnerList.IndexOf(tempRunner); tempRunnerState.RunnerName = tempRunner.RunnerName; tempRunnerState.State = tempRunner.RunnerState.ToString(); tempRunnerState.RunnerProgress = tempRunner.RunerActuator.RunProgress; remoteRunnerInfo.AddRunnerState(tempRunnerState); } } } } return(remoteRunnerInfo); }
public void AddRunnerState(RunnerState runnerState) { if (runnerState == null) { return; } if (runnerStateList == null) { runnerStateList = new List <RunnerState>(); } runnerStateList.Add(runnerState); }