C# backgroundWorker reports string?

I'm assuming WCF also have the method public void ReportProgress(int percentProgress, Object userState) So just use the userState to report the string private void worker_DoWork(object sender, DoWorkEventArgs e) { //report some progress e. ReportProgress(0,"Initiating countdown"); // initate the countdown. } And you'll get that "Initiating countdown" string back in ProgressChanged event private void worker_ProgressChanged(object sender,ProgressChangedEventArgs e) { statusLabel.

Text = e. UserState as String; }.

I'm assuming WCF also have the method public void ReportProgress(int percentProgress, Object userState); So just use the userState to report the string. Private void worker_DoWork(object sender, DoWorkEventArgs e) { //report some progress e. ReportProgress(0,"Initiating countdown"); // initate the countdown.

} And you'll get that "Initiating countdown" string back in ProgressChanged event private void worker_ProgressChanged(object sender,ProgressChangedEventArgs e) { statusLabel. Text = e. UserState as String; }.

You can use the userState parameter of ReportProgress method to report that strings. Here's an example from MSDN: private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { // This method will run on a thread other than the UI thread. // Be sure not to manipulate any Windows Forms controls created // on the UI thread from this method.

BackgroundWorker. ReportProgress(0, "Working..."); Decimal lastlast = 0; Decimal last = 1; Decimal current; if (requestedCount >= 1) { AppendNumber(0); } if (requestedCount >= 2) { AppendNumber(1); } for (int I = 2; I Sleep(100); AppendNumber(current); backgroundWorker. ReportProgress((100 * i) / requestedCount, "Working..."); // Get ready for the next iteration.

Lastlast = last; last = current; } backgroundWorker. ReportProgress(100, "Complete! "); }.

Read Simple Multi-threading in Windows Forms. It's a 3-part series.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions