public void DoDispStateMainForm(object sender, EventArgs e) { if (this.InvokeRequired == true) { EventHandler func = new EventHandler(DoDispStateMainForm); this.BeginInvoke(func, new object[] { sender, e }); } else { TestDescriptionArgs args = e as TestDescriptionArgs; ToolStripStatusLabel[] stateLabels = { line1StateLabel, line2StateLabel, line3StateLabel, line4StateLabel }; ToolStripProgressBar[] stateProgress = { line1Progress, line2Progress, line3Progress, line4Progress }; ETestStep step = args.Step; int line = args.Index; int preMax = (int)args.PrepareMaxTime; int preCur = (int)args.PrepareCurTime; int judgeMax = (int)args.JudgeMaxTime; int judgeCur = (int)args.JudgeCurTime; int integMax = (int)args.IntegMaxTime; int integCur = (int)args.IntegCurTime; try { stateLabels[line].Text = step.ToString(); switch (step) { case ETestStep.None: stateProgress[line].Maximum = 100; stateProgress[line].Value = 0; break; case ETestStep.Preparation: stateProgress[line].Maximum = preMax; stateProgress[line].Value = preCur; break; case ETestStep.Judgement: stateProgress[line].Maximum = judgeMax; stateProgress[line].Value = judgeCur; break; case ETestStep.Integration: stateProgress[line].Maximum = integMax; stateProgress[line].Value = integCur; break; } } catch { } } }
public void DoDispState(object sender, EventArgs e) { if (this.InvokeRequired == true) { EventHandler func = new EventHandler(DoDispState); this.BeginInvoke(func, new object[] { sender, e }); } else { TestDescriptionArgs desc = e as TestDescriptionArgs; List <MeasureRow> runStates = context.Measure.RunStates; runStates[(int)EMeasRunState.Condition].Value = desc.Name; runStates[(int)EMeasRunState.RunningStep].Value = desc.Step.ToString(); runStates[(int)EMeasRunState.ElapsedTime].Value = ToDateTimeString(desc.ElapsedTime); runStates[(int)EMeasRunState.TotalElapsed].Value = ToDateTimeString(desc.TotalElapsedTime); runStates[(int)EMeasRunState.Preparation].Value = $"{ToDateTimeString(desc.PrepareCurTime)} / { ToDateTimeString(desc.PrepareMaxTime)}"; runStates[(int)EMeasRunState.Judgement].Value = $"{ToDateTimeString(desc.JudgeCurTime)} / {ToDateTimeString(desc.JudgeMaxTime)}"; runStates[(int)EMeasRunState.Integration].Value = $"{ToDateTimeString(desc.IntegCurTime)} / {ToDateTimeString(desc.IntegMaxTime)}"; runStates[(int)EMeasRunState.NoOfSteady].Value = $"{desc.JudgeCount} / {desc.JudgeMax}"; runStates[(int)EMeasRunState.Repeat].Value = $"{desc.RepeatCount} / {desc.RepeatMax}"; runStates[(int)EMeasRunState.Schedule].Value = $"{desc.ScheduleCount} / {desc.ScheduleMax}"; switch (desc.Step) { case ETestStep.None: runStates[(int)EMeasRunState.Preparation].State = EValueState.None; runStates[(int)EMeasRunState.Judgement].State = EValueState.None; runStates[(int)EMeasRunState.Integration].State = EValueState.None; break; case ETestStep.Preparation: runStates[(int)EMeasRunState.Preparation].State = EValueState.Ok; runStates[(int)EMeasRunState.Judgement].State = EValueState.None; runStates[(int)EMeasRunState.Integration].State = EValueState.None; break; case ETestStep.Judgement: runStates[(int)EMeasRunState.Preparation].State = EValueState.None; runStates[(int)EMeasRunState.Judgement].State = EValueState.Ok; runStates[(int)EMeasRunState.Integration].State = EValueState.None; break; case ETestStep.Integration: runStates[(int)EMeasRunState.Preparation].State = EValueState.None; runStates[(int)EMeasRunState.Judgement].State = EValueState.None; runStates[(int)EMeasRunState.Integration].State = EValueState.Ok; break; } preparationProgress.Properties.Maximum = (int)desc.PrepareMaxTime; preparationProgress.Position = (int)desc.PrepareCurTime; judgementProgress.Properties.Maximum = (int)desc.JudgeMaxTime; judgementProgress.Position = (int)desc.JudgeCurTime; integrationProgress.Properties.Maximum = (int)desc.IntegMaxTime; integrationProgress.Position = (int)desc.IntegCurTime; noOfSteadyProgress.Properties.Maximum = (int)desc.JudgeMax; noOfSteadyProgress.Position = (int)desc.JudgeCount; repeatProgress.Properties.Maximum = (int)desc.RepeatMax; repeatProgress.Position = (int)desc.RepeatCount; scheduleProgress.Properties.Maximum = (int)desc.ScheduleMax; scheduleProgress.Position = (int)desc.ScheduleCount; } }