private void ReceiveWorkerThread_DoWork(object sender, DoWorkEventArgs e) { for (int i = 0; ; i++) { if (!run) { Thread.Sleep(15); continue; } /* if (!run) { //Thread.CurrentThread.Abort(); return; } */ if (needinit && param.reinit) { // scene.init("Demos\\cunami"); scene.SetInstrument(instrument); scene.init("Demos\\" + param.file); needclear = true; } if (needinit) { needinit = false; } if (instrument.changeinstrument) { instrument.changeinstrument = false; scene.SetInstrument(instrument); } if (instrument.step) { instrument.step = false; scene.RunPhysicStep(true); ThreadParam p = new ThreadParam(); p.world = scene.GetScene(); // p.timers = TimeUtil.Instance().GetTimers(); ReceiveWorkerThread.ReportProgress(0, p); } if (instrument.save) { instrument.save = false; instrument.none = true; instrument.changeinstrument = false; } if (instrument.mouseDown) { // scene.ClosePipe(); if (instrument.drop) { //scene.AddFluidToPoint(instrument.mousex,instrument.mousey,10); } } if(!stopped) scene.RunPhysicStep(false); if (ReceiveWorkerThread.CancellationPending == true) { break; } if (i % 10 == 0 && !stopped) { //isdraw = true; // World world2 = scene.GetScene(); // timers ThreadParam p = new ThreadParam(); p.world = scene.GetScene(); // p.timers = TimeUtil.Instance().GetTimers(); ReceiveWorkerThread.ReportProgress(0,p); //while (isdraw) ; Thread.Sleep(125); } // if (i % 3 == 0 && !stopped) // Thread.Sleep(4); //if (i % 7 == 0) // Thread.Sleep(362); } }
private void ReceiveWorkerThread_DoWork(object sender, DoWorkEventArgs e) { for (int i = 0; ; i++) { if (!run) { Thread.Sleep(15); continue; } /* * if (!run) * { * //Thread.CurrentThread.Abort(); * return; * } */ if (needinit && param.reinit) { // scene.init("Demos\\cunami"); scene.SetInstrument(instrument); scene.init("Demos\\" + param.file); needclear = true; } if (needinit) { needinit = false; } if (instrument.changeinstrument) { instrument.changeinstrument = false; scene.SetInstrument(instrument); } if (instrument.step) { instrument.step = false; scene.RunPhysicStep(true); ThreadParam p = new ThreadParam(); p.world = scene.GetScene(); // p.timers = TimeUtil.Instance().GetTimers(); ReceiveWorkerThread.ReportProgress(0, p); } if (instrument.save) { instrument.save = false; instrument.none = true; instrument.changeinstrument = false; } if (instrument.mouseDown) { // scene.ClosePipe(); if (instrument.drop) { //scene.AddFluidToPoint(instrument.mousex,instrument.mousey,10); } } if (!stopped) { scene.RunPhysicStep(false); } if (ReceiveWorkerThread.CancellationPending == true) { break; } if (i % 10 == 0 && !stopped) { //isdraw = true; // World world2 = scene.GetScene(); // timers ThreadParam p = new ThreadParam(); p.world = scene.GetScene(); // p.timers = TimeUtil.Instance().GetTimers(); ReceiveWorkerThread.ReportProgress(0, p); //while (isdraw) ; Thread.Sleep(125); // Thread.Sleep(5); } // if (i % 3 == 0 && !stopped) // Thread.Sleep(4); //if (i % 7 == 0) // Thread.Sleep(362); } }