void appdata_CmdIndexStatusEvent(object sender, TcpClientAppData.CmdIndexStatusEventArgs e) { if (e.CmdIndex == 0) { chart.run(); } Console.WriteLine("index:{0}", e.CmdIndex); Thread thread = new Thread(new ThreadStart(() => { var steps = CurrentCommandTable.GetStepList(); int stepcount = CurrentCommandTable.Sources.Sum(it => it.Steps.Count); if (e.CmdIndex < steps.Count) { int index = e.CmdIndex % stepcount; var step = steps[index]; if (index == 0) { chart.setProgress(step.Time); } else { chart.Progress = step.Time; } } CurrentTree.SetCycleStep(e.CmdIndex / stepcount + 1); if (e.CmdIndex + 1 >= steps.Count) { var step = steps[e.CmdIndex]; if (step.HodeTime > 0) { Thread.Sleep(step.HodeTime * 1000); } // 完事了 CurrentTree.RunState = 0; CurrentTree.forTnv = null; } })); thread.Start(); }