<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : AsyncParallelTask</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : AsyncParallelTask</description>
  <pubDate>Tue, 14 Apr 2026 19:17:09 -700</pubDate>
  <lastBuildDate>Mon, 27 Sep 2010 11:47:47 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=2195</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>AsyncParallelTask : I think that populating the observable...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2195&amp;PID=8646#8646</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=662" rel="nofollow">dpollot44</a><br /><strong>Subject:</strong> 2195<br /><strong>Posted:</strong> 27-Sep-2010 at 11:47am<br /><br />I think that populating the observable collections after each parallel async task is what's blocking the UI thread.<br>I guess there's really nothing you can do about that...<br><br>If I want to use the completion map, what should the args be casted to?&nbsp; At least that way, I can keep the UI thread free until everything has been retrieved.<br>]]>
   </description>
   <pubDate>Mon, 27 Sep 2010 11:47:47 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2195&amp;PID=8646#8646</guid>
  </item> 
  <item>
   <title>AsyncParallelTask : I&amp;#039;m running DevForce 6.0.4.I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2195&amp;PID=8645#8645</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=662" rel="nofollow">dpollot44</a><br /><strong>Subject:</strong> 2195<br /><strong>Posted:</strong> 27-Sep-2010 at 8:29am<br /><br />I'm running DevForce 6.0.4.<br>I have a WPF Browser app that needs a bunch of data loaded... I want the user to be able to navigate around the app a bit before all of this data has finished loading (or at least give them some visual cues as to what's going on and why the app isn't responding).&nbsp; Naturally the AsyncParallelTask seemed like the best avenue.<br><br>I've got a simple progress wheel with a status message on the page, and an application context class with a property notifying the application of a busy/non busy state.&nbsp; I'm familiar with Microsoft's parallel task library and I've tested the app out with to be sure there's nothing wrong with the UI/ViewModel...<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font size="1">AppContext.Current().Status.Message = "Loading...";<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AppContext.Current().IsBusy = true;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.Threading.Tasks.Task.Factory.StartNew(() =&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int j = 0;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; 1000000000; i++)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; j = i;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Dispatcher.BeginInvoke(new Action(() =&gt; { AppContext.Current().IsBusy = false; }));<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; });</font><br><br>That works fine, UI is responsive, progress wheel spins, everyone is happy, except that applications rarely need only count <br>to a billion - there are no cross thread problems there.<br><br>Enter async queries using the AsyncParallelTask object:<br><br><font size="1">Context.Status.Message = "Loading...";<br>Context.IsBusy = true;<br>AsyncParallelTask.Create()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; .AddAsyncQuery("ClientIds", x =&gt; somequery, (completed) =&gt;{<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; completed.Results.ToList().ForEach(id =&gt; Context.ClientIds.Add(id));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; })<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; .AddAsyncQuery("AccountManagers", x =&gt; somequery, (completed) =&gt; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; completed.Results.ToList().ForEach(am =&gt; Context.AccountManagers.Add(am));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; })<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; .AddAsyncQuery("Reconcilers", x =&gt; somequery, (completed) =&gt; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; completed.Results.ToList().ForEach(r =&gt; Context.Reconcilers.Add(r));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }) .... and so on ....<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Execute(args =&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Context.IsBusy = false;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; });<br></font><br><br>Running this causes the UI to hang until everything is done.<br>What am I doing wrong??&nbsp; What's the point of having parallel async queries that still lock up my UI?<br><br><br>]]>
   </description>
   <pubDate>Mon, 27 Sep 2010 08:29:59 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2195&amp;PID=8645#8645</guid>
  </item> 
 </channel>
</rss>