measurement-studio

Background Worker: Make sure that ProgressChanged method has finished before executing RunWorkerCompleted

帅比萌擦擦* 提交于 2019-12-22 18:14:12
问题 Let's assume I'm using a Background Worker and I've the following methods: private void bw_DoWork(object sender, DoWorkEventArgs e) { finalData = MyWork(sender as BackgroundWorker, e); } private void bw_ProgressChanged(object sender, ProgressChangedEventArgs e) { int i = e.ProgressPercentage; // Missused for i Debug.Print("BW Progress Changed Begin, i: " + i + ", ThreadId: " + Thread.CurrentThread.ManagedThreadId); // I use this to update a table and an XY-Plot, so that the user can see the

Background Worker: Make sure that ProgressChanged method has finished before executing RunWorkerCompleted

喜欢而已 提交于 2019-12-06 14:13:44
Let's assume I'm using a Background Worker and I've the following methods: private void bw_DoWork(object sender, DoWorkEventArgs e) { finalData = MyWork(sender as BackgroundWorker, e); } private void bw_ProgressChanged(object sender, ProgressChangedEventArgs e) { int i = e.ProgressPercentage; // Missused for i Debug.Print("BW Progress Changed Begin, i: " + i + ", ThreadId: " + Thread.CurrentThread.ManagedThreadId); // I use this to update a table and an XY-Plot, so that the user can see the progess. UpdateGUI(e.UserState as MyData); Debug.Print("BW Progress Changed End, i: " + i + ", ThreadId:

Invoke method for multi thread application?

最后都变了- 提交于 2019-12-02 20:19:16
问题 I have a bug in my application which is the same as here which this person was running into the same problem. My application is multi threaded where the worker thread is updating the Waveformgraph on the UI. I believe that is where my problem is and why, periodically, and on occassion I get a big red X in at least one of my waveformgraph objects when running the application. From reading and research, I need to use an Invoke or BeginInvoke method? Can someone please explain better and provide

Invoke method for multi thread application?

柔情痞子 提交于 2019-12-02 11:49:27
I have a bug in my application which is the same as here which this person was running into the same problem. My application is multi threaded where the worker thread is updating the Waveformgraph on the UI. I believe that is where my problem is and why, periodically, and on occassion I get a big red X in at least one of my waveformgraph objects when running the application. From reading and research, I need to use an Invoke or BeginInvoke method? Can someone please explain better and provide a sample code that is relevant to my code? The samples that I've found so far still have me hazy on