<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: WPF Multithreading: Using the BackgroundWorker and Reporting the Progress to the UI.</title>
	<atom:link href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/</link>
	<description></description>
	<lastBuildDate>Tue, 16 Mar 2010 00:33:33 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Denis</title>
		<link>http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/comment-page-2/#comment-49216</link>
		<dc:creator>Denis</dc:creator>
		<pubDate>Tue, 15 Sep 2009 02:44:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/#comment-49216</guid>
		<description>Fantastic article. It was exactly what I was looking for. Nice and concise. Thanks!</description>
		<content:encoded><![CDATA[<p>Fantastic article. It was exactly what I was looking for. Nice and concise. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Lagunas</title>
		<link>http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/comment-page-2/#comment-49069</link>
		<dc:creator>Brian Lagunas</dc:creator>
		<pubDate>Thu, 03 Sep 2009 22:20:21 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/#comment-49069</guid>
		<description>&lt;a href=&quot;#comment-49020&quot; rel=&quot;nofollow&quot;&gt;@Nigama &lt;/a&gt; 

Well one thing you will definitely have to watch out for is your files being locked by one thread while a different thread is trying to access it too.  What I am trying to say is that if you have three I/O tasks to perform on a file, you can only do one I/O operation at a time.  You cannot write to a file at the same time you try to read from a file.  So I would recommend three seperate background workers. When the first I/O operation completes, in the worker.RunWorkerCompleted start your next operation and so forth.</description>
		<content:encoded><![CDATA[<p><a href="#comment-49020" rel="nofollow">@Nigama </a> </p>
<p>Well one thing you will definitely have to watch out for is your files being locked by one thread while a different thread is trying to access it too.  What I am trying to say is that if you have three I/O tasks to perform on a file, you can only do one I/O operation at a time.  You cannot write to a file at the same time you try to read from a file.  So I would recommend three seperate background workers. When the first I/O operation completes, in the worker.RunWorkerCompleted start your next operation and so forth.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nigama</title>
		<link>http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/comment-page-2/#comment-49020</link>
		<dc:creator>Nigama</dc:creator>
		<pubDate>Tue, 01 Sep 2009 16:37:32 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/#comment-49020</guid>
		<description>Hi Brian,

I need your ideas to proceed with BackGroundWorker threads for my requirement.

I have a C# Windows Application that processes a directory/sub-directories containing huge number of .xml files, say 100,000 files and perfoms time-consuming I/O operation such as parsing xml files(I am currently querying those files using Linq) while updating the user of every file being processed. In fact, I have 3 such I/O operations to be performed on the same set of files(so all the 3 tasks will basically share the same resources/directory/files for their own independent requirements). 

Also, I currently have a Windows Form associated with 3 different class files, one for each I/O task. I need to implement multithreading so that I can run all the 3 tasks at the same time, while updating the UI controls such as Label- one per task/thread to keep the user informed about the background process.

What is the best way of proceeding about such kind of task in a single application?(if possible..). Kindly suggest me.

Thanks in advance</description>
		<content:encoded><![CDATA[<p>Hi Brian,</p>
<p>I need your ideas to proceed with BackGroundWorker threads for my requirement.</p>
<p>I have a C# Windows Application that processes a directory/sub-directories containing huge number of .xml files, say 100,000 files and perfoms time-consuming I/O operation such as parsing xml files(I am currently querying those files using Linq) while updating the user of every file being processed. In fact, I have 3 such I/O operations to be performed on the same set of files(so all the 3 tasks will basically share the same resources/directory/files for their own independent requirements). </p>
<p>Also, I currently have a Windows Form associated with 3 different class files, one for each I/O task. I need to implement multithreading so that I can run all the 3 tasks at the same time, while updating the UI controls such as Label- one per task/thread to keep the user informed about the background process.</p>
<p>What is the best way of proceeding about such kind of task in a single application?(if possible..). Kindly suggest me.</p>
<p>Thanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nigama</title>
		<link>http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/comment-page-2/#comment-49019</link>
		<dc:creator>Nigama</dc:creator>
		<pubDate>Tue, 01 Sep 2009 16:11:28 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/#comment-49019</guid>
		<description>Hi Brian,

Very Nice article, very clearly explained!!!</description>
		<content:encoded><![CDATA[<p>Hi Brian,</p>
<p>Very Nice article, very clearly explained!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Blake</title>
		<link>http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/comment-page-2/#comment-48341</link>
		<dc:creator>Blake</dc:creator>
		<pubDate>Wed, 12 Aug 2009 10:38:05 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/#comment-48341</guid>
		<description>Brian,
      I guessed that was the case but wasn&#039;t 100% sure. So thanks for confirming that, I had a play with it last night and got it working.

I declared a withevents private variable at page level and used the regular event handlers as you mentioned.

Thanks for your reply.</description>
		<content:encoded><![CDATA[<p>Brian,<br />
      I guessed that was the case but wasn&#8217;t 100% sure. So thanks for confirming that, I had a play with it last night and got it working.</p>
<p>I declared a withevents private variable at page level and used the regular event handlers as you mentioned.</p>
<p>Thanks for your reply.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Lagunas</title>
		<link>http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/comment-page-2/#comment-48321</link>
		<dc:creator>Brian Lagunas</dc:creator>
		<pubDate>Tue, 11 Aug 2009 16:11:36 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/#comment-48321</guid>
		<description>&lt;a href=&quot;#comment-48319&quot; rel=&quot;nofollow&quot;&gt;@Blake &lt;/a&gt; 

Since VB doesn&#039;t have anonymous delegates just use regular event handlers</description>
		<content:encoded><![CDATA[<p><a href="#comment-48319" rel="nofollow">@Blake </a> </p>
<p>Since VB doesn&#8217;t have anonymous delegates just use regular event handlers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Blake</title>
		<link>http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/comment-page-2/#comment-48319</link>
		<dc:creator>Blake</dc:creator>
		<pubDate>Tue, 11 Aug 2009 15:51:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/#comment-48319</guid>
		<description>Great article, this is exactly what I need for a bulk reporting tool i am creating. However I&#039;ve having trouble converting this anonymous methods to vb.

Any help on converting the below and relating function to vb would be much appreciated.

    worker.DoWork  = delegate(object s, DoWorkEventArgs args){

}</description>
		<content:encoded><![CDATA[<p>Great article, this is exactly what I need for a bulk reporting tool i am creating. However I&#8217;ve having trouble converting this anonymous methods to vb.</p>
<p>Any help on converting the below and relating function to vb would be much appreciated.</p>
<p>    worker.DoWork  = delegate(object s, DoWorkEventArgs args){</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tracy</title>
		<link>http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/comment-page-2/#comment-47644</link>
		<dc:creator>Tracy</dc:creator>
		<pubDate>Mon, 13 Jul 2009 18:50:22 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/#comment-47644</guid>
		<description>The download does not appear to be available?</description>
		<content:encoded><![CDATA[<p>The download does not appear to be available?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Lagunas</title>
		<link>http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/comment-page-1/#comment-47517</link>
		<dc:creator>Brian Lagunas</dc:creator>
		<pubDate>Wed, 08 Jul 2009 14:09:47 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/#comment-47517</guid>
		<description>Funny, I haven&#039;t had that problem. Any state I pass from ReportProgress always comes through to the ProgressChanged event handler. 

This is an example of how I would use it with &quot;Processing&quot; being the UserState.

worker.ReportProgress(percentage, &quot;Processing&quot;);

Then get the UserState in the ProgressChanged event handler

text = string.Format(&quot;{0} {1}%&quot;, args.UserState.ToString(), args.ProgressPercentage.ToString());</description>
		<content:encoded><![CDATA[<p>Funny, I haven&#8217;t had that problem. Any state I pass from ReportProgress always comes through to the ProgressChanged event handler. </p>
<p>This is an example of how I would use it with &#8220;Processing&#8221; being the UserState.</p>
<p>worker.ReportProgress(percentage, &#8220;Processing&#8221;);</p>
<p>Then get the UserState in the ProgressChanged event handler</p>
<p>text = string.Format(&#8221;{0} {1}%&#8221;, args.UserState.ToString(), args.ProgressPercentage.ToString());</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ?ukasz Sowa</title>
		<link>http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/comment-page-1/#comment-47508</link>
		<dc:creator>?ukasz Sowa</dc:creator>
		<pubDate>Wed, 08 Jul 2009 00:54:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/#comment-47508</guid>
		<description>&lt;a href=&quot;#comment-47494&quot; rel=&quot;nofollow&quot;&gt;@Bruce Wallwin&lt;/a&gt; 

That&#039;s good question. One problem with BackgroundWorker is the fact that you cannot pass anything through userState in ReportProgress, because it will be always null - it&#039;s a bug in .NET IMO.</description>
		<content:encoded><![CDATA[<p><a href="#comment-47494" rel="nofollow">@Bruce Wallwin</a> </p>
<p>That&#8217;s good question. One problem with BackgroundWorker is the fact that you cannot pass anything through userState in ReportProgress, because it will be always null &#8211; it&#8217;s a bug in .NET IMO.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
