private void CompositionTargetRendering(object sender, EventArgs e) { if (!viewModel.isConnectSet() || viewModel.vm_Stop) { stopwatch.Stop(); } else { if (!stopwatch.IsRunning) { stopwatch.Start(); } // update graphs info viewModel.UpdateDateLine(viewModel.PlotModel, viewModel.ChosenChunk, ref viewModel.lastUpdate); viewModel.UpdateDateLine(viewModel.PlotModel_corr, viewModel.CorrelatedChunk, ref viewModel.lastUpdateCorr); viewModel.updateRegLine(); // if 800 milliseconds passed - refresh graphs graphic. if (stopwatch.ElapsedMilliseconds > 800) { Plot1.RefreshPlot(true); Plot_corr.RefreshPlot(true); Plot_reg.RefreshPlot(true); stopwatch.Restart(); } } }
private void CompositionTargetRendering(object sender, EventArgs e) { if (stopwatch.ElapsedMilliseconds > lastUpdateMilliSeconds + 5000) { viewModel.UpdateModel(); Plot1.RefreshPlot(true); lastUpdateMilliSeconds = stopwatch.ElapsedMilliseconds; } }