WPF interface, by calling the DLL to control data acquisition of hardware, every time to collect 8192 points, the need for loop sampling, used to debug some parameters are appropriate (fixed sampling points to 8192), I use a bool set to determine whether the machine is sampling,
The logic is: ToggleButton Check & gt;
Submit parameters - & gt; Sampling - & gt; After the (sample) shows data - & gt; Submit parameters - & gt; Sampling - & gt; According to the data - & gt; .
Unless ToggleButton UnCheck, otherwise has been cycle, the whole process, the user can freely change any parameters,
The beginning, I Check in ToggleButton event callback function directly from inside the while loop to ensure that after the sampling to get data and display
While (Iface. Set () {};//then GetData (hardware DLL)
Do so after found that interface can feign death, baidu is to use a background thread to collect data and update the drawing, but take in data required DLL, GetData and GetData was put in a background thread to "external components occur error" (don't know why ~)
So, I again to
TimerGS=new DispatcherTimer (DispatcherPriority. Render);
TimerGS. Tick +=new EventHandler (TimerGS_Tick);
TimerGS. Interval=new System. TimeSpan (0, 0, 0, 0, 10);
Private void TimerGS_Tick (object sender, EventArgs e)
{
If (vm) Interrupt)
{
TopScan ();
Set the=false;
TimerGS. Stop ();
return;
}
If (set ())
{
Set the=true;
return;
}
Set the=false;//set is attribute and function, don't know why, but did not report errors ~
CommitParameter ();
StartScan ();
While (set ()) {};
Data=https://bbs.csdn.net/topics/new TComplex (len);
GetData (data, len);
The UpdateData ();
SamplingPlot. InvalidatePlot (true);
System. Diagnostics. Debug. WriteLine (" Tick Tick Tick... ");
}
Do down function is realized, the interface is not feign death, but the interface become very caton, fill inside the TextBox with a number to the along while,
I don't know the problem how to solve?
CodePudding user response:
How are you, warrior! I also made a curve control, solve the problem of the high-speed real-time curve caton, you can baidu 'shaanxi, embellish fe mi software technology co., LTD.' my web site, download the demo sample, later can be applied to the business development,