<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.silverlight.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Programming with .NET - General</title><link>http://forums.silverlight.net/forums/17.aspx</link><description>General discussions around authoring Silverlight .NET applications.</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/44742.aspx</link><pubDate>Mon, 07 Apr 2008 22:57:14 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:44742</guid><dc:creator>WilcoB</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/44742.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=44742</wfw:commentRss><description>&lt;p&gt;You&amp;#39;ll have to use &amp;quot;the funky&amp;quot; SetValue methods if you&amp;#39;re using C#:&lt;/p&gt;
&lt;p&gt;[code=C#]&lt;br /&gt;myCanvas.SetValue(Canvas.LeftProperty, value);&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Not sure what your scenario is exactly, but using a different container control (such as StackPanel) might be more appropriate. It&amp;#39;s probably best to start a new thread on this though.&lt;/p&gt;</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/44719.aspx</link><pubDate>Mon, 07 Apr 2008 21:25:44 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:44719</guid><dc:creator>Nullable</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/44719.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=44719</wfw:commentRss><description>&lt;p&gt;That is absolutely beautiful (the Dispatcher.BeginInvoke)! I think there&amp;#39;s going to be an incredible amount of &amp;quot;catching up&amp;quot; that the development community is going to have to get used to with the new names / ways of doing things in Silverlight.&lt;/p&gt;
&lt;p&gt;Speaking of which... is there a way (I realize I&amp;#39;m hijacking this thread, but... I&amp;#39;ll continue anyway).. is there a way to set an &amp;quot;X,Y&amp;quot; location to an element in code (a clean way)?&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll give the scenario:&lt;/p&gt;
&lt;p&gt;There&amp;#39;s a Canvas control that has dynamically loaded ... rectangles... how do I set the r.X and r.Y? I&amp;#39;m currently using the &amp;quot;margin&amp;quot; property to cheat... I realize I should probably be doing some funky &amp;quot;SetValue&amp;quot; thing that taps into the Canvas, etc... but I&amp;#39;m hoping for a clean solution.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/44702.aspx</link><pubDate>Mon, 07 Apr 2008 19:48:37 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:44702</guid><dc:creator>WilcoB</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/44702.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=44702</wfw:commentRss><description>&lt;p&gt;When this thread started, support for threading (specifically handling UI updates from different threads) was poor. There was no first-class mechanism such as &amp;quot;Control.Invoke&amp;quot;. You had to work around this limitation by using other types such as a HTML timer or Silverlight storyboards, which both executed (queued) payloads on the UI thread.&lt;/p&gt;
&lt;p&gt;Things have changed in Silverlight 2 beta 1. All ScriptObjects and DependencyObjects have a Dispatcher property of type Dispatcher. (This property is marked with EditorBrowsable(Advanced) though, which means that unless you have configured VS to show advanced members, you won&amp;#39;t see this property. Could it be that you missed this property because of that, Timothy?) The dispatcher lets you execute a payload on the UI thread, and it is exactly what it was designed for (unlike the HTML timer or Silverlight storyboard). In other words, you should be able to update your UI from a different thread like this:&lt;/p&gt;
&lt;p&gt;[code=C#]&lt;br /&gt;new Thread(()=&amp;gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mySilverlightTextBlock.Dispatcher.BeginInvoke(()=&amp;gt; mySilverlightTextBlock.Text = &amp;quot;Updated from a non-UI thread.&amp;quot;);&lt;br /&gt;}).Start();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Or a slightly less syntactically exotic version:&lt;/p&gt;
&lt;p&gt;[code=C#]&lt;br /&gt;Thread myThread = new Thread(new ThreadStart(StartThread));&lt;br /&gt;myThread.Start();&lt;br /&gt;&lt;br /&gt;void StartThread() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mySilverlightTextBlock.Dispatcher.BeginInvoke(UpdateText);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void UpdateText() {&lt;br /&gt;&amp;nbsp; &amp;nbsp; mySilverlightTextBlock.Text = &amp;quot;Updated from a non-UI thread.&amp;quot;;&lt;br /&gt;}&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;In addition to the dispatcher, don&amp;#39;t forget there&amp;#39;s also the BackgroundWorker. It makes sense to use this type when you have some work you want to do on a background thread, but update the UI as this work progresses or completes.&lt;/p&gt;</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/44317.aspx</link><pubDate>Sun, 06 Apr 2008 03:58:10 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:44317</guid><dc:creator>Nullable</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/44317.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=44317</wfw:commentRss><description>&lt;p&gt;Hey, I feel your pain... I&amp;#39;ve been there&amp;nbsp;and have JUST gotten over it (&lt;a href="http://www.singingeels.com/Blogs/Nullable/2008/04/05/Silverlight_2_Beta_1__Online_Game_and_the_Pain_it_Caused.aspx"&gt;http://www.singingeels.com/Blogs/Nullable/2008/04/05/Silverlight_2_Beta_1__Online_Game_and_the_Pain_it_Caused.aspx&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll be posting an article soon that will show how to do what I mention in that post. Sorry I don&amp;#39;t have a clear answer right now, but I need to get to bed.&lt;/p&gt;</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/26941.aspx</link><pubDate>Fri, 18 Jan 2008 07:43:10 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:26941</guid><dc:creator>hammadmirza</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/26941.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=26941</wfw:commentRss><description>Hi,

I am doing some time consuming work 4-5 seconds, in a Thread

but i also have a Storyboard in Page.xaml.cs (Loading/Working Animation), it starts when i start the Thread

now when the thread completes....it sends an EventHandler(object,e); and in the Handler i am trying to stop the Storyboard....i.e. (Load/Work is complete)

but i get Invalid Cross thread access

so tell me what should i do?

-
Please!</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/5964.aspx</link><pubDate>Mon, 25 Jun 2007 09:25:36 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:5964</guid><dc:creator>luisabreu</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/5964.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=5964</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/silverlight/images/icon-quote.gif"&gt; &lt;strong&gt;xlj1000:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; 
&lt;p&gt;What about the case in calling web service aynschrounously? Is it safe to&amp;nbsp;modify UI in the callback?&lt;/p&gt;
&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;hello.&lt;/p&gt;
&lt;p&gt;according to my tests, it is (ie, there&amp;#39;s already support for making the callback call on the correct thread but it simply isn&amp;#39;t public yet).&lt;/p&gt;</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/5939.aspx</link><pubDate>Mon, 25 Jun 2007 04:13:47 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:5939</guid><dc:creator>Jerod Moemeka</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/5939.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=5939</wfw:commentRss><description>&lt;p&gt;It still wont work.&amp;nbsp; you&amp;#39;ll have to use the same strategy.&lt;/p&gt;</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/4809.aspx</link><pubDate>Mon, 11 Jun 2007 20:41:45 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:4809</guid><dc:creator>xlj1000</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/4809.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=4809</wfw:commentRss><description>&lt;p&gt;What about the case in calling web service aynschrounously? Is it safe to&amp;nbsp;modify UI in the callback?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thanks&lt;/p&gt;</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/3374.aspx</link><pubDate>Tue, 22 May 2007 22:21:26 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:3374</guid><dc:creator>Jerod Moemeka</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/3374.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=3374</wfw:commentRss><description>&lt;p&gt;FYI,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this is NOT an accurate approach but just an example of periodically updating the UI thread.&amp;nbsp; To get an accurate timer you should use the ACTUAL System.Threading.Timer class to change values and only use timelines to update the UI with newer values.&amp;nbsp; For example:&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;font size="2"&gt; Callback(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;object&lt;/font&gt;&lt;font size="2"&gt; obj)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;try&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;i++;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;catch&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;Exception&lt;/font&gt;&lt;font size="2"&gt; ex)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/3368.aspx</link><pubDate>Tue, 22 May 2007 22:11:09 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:3368</guid><dc:creator>Mark Rideout</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/3368.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=3368</wfw:commentRss><description>&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font face="Verdana" size="2"&gt;There isn&amp;#39;t a way to sync an operation with the UI thread currently in 1.1 Alpha and Silverlight is not thread safe so we don&amp;#39;t allow users to modify on the non UI thread.&lt;br /&gt;&lt;br /&gt;Using the HtmlTimer is a good alternative or use the animation/storyboard approach. &lt;br /&gt;&lt;br /&gt;-mark&lt;br /&gt;Program Manager&lt;br /&gt;Microsoft&lt;br /&gt;This post is provided &amp;quot;as-is&amp;quot;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/3365.aspx</link><pubDate>Tue, 22 May 2007 21:37:35 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:3365</guid><dc:creator>Jerod Moemeka</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/3365.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=3365</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; the HTML Timer won&amp;#39;t work.&amp;nbsp; To update the UI thread (or use timers in general) do the following:&lt;/p&gt;
&lt;p&gt;1)&amp;nbsp; Add an empty timeline to your silverlight alpha project&lt;/p&gt;
&lt;p&gt;2) in the page load event handler, give the timeline a 1 second duration (or whatever granularity you desire).Also handle the completed event.&lt;/p&gt;
&lt;p&gt;3)&amp;nbsp; In the completed event do whatever you want then&amp;nbsp;begin the timer again.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;EXAMPLE&lt;/p&gt;
&lt;p&gt;=========================&lt;/p&gt;
&lt;p&gt;&amp;nbsp;void Page_Load(object o, EventArgs args){&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this&lt;/font&gt;&lt;font size="2"&gt;.myTimer.Duration = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;Duration&lt;/font&gt;&lt;font size="2"&gt;(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;TimeSpan&lt;/font&gt;&lt;font size="2"&gt;(0, 0, 1));&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this&lt;/font&gt;&lt;font size="2"&gt;.myTimer.Completed += &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;EventHandler&lt;/font&gt;&lt;font size="2"&gt;(myTimer_Completed);&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this&lt;/font&gt;&lt;font size="2"&gt;.myTimer.Begin();&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&amp;nbsp;}&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;font size="2"&gt; myTimer_Completed(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;object&lt;/font&gt;&lt;font size="2"&gt; sender, &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;EventArgs&lt;/font&gt;&lt;font size="2"&gt; e)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; txtCount.Text = i.ToString();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myTimer.Begin();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;&lt;font size="2"&gt;You can optionaly call begin BEFORE doing stuff.&amp;nbsp; Investigate Critical Sections first.&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/1368.aspx</link><pubDate>Fri, 04 May 2007 21:31:21 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:1368</guid><dc:creator>gstasa</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/1368.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=1368</wfw:commentRss><description>&lt;p&gt;Another option could be to use the System.Windows.Browser.HtmlTimer in System.Silverlight.dll.&lt;/p&gt;
&lt;p&gt;HtmlTimer is not a high resolution timer (and you would get&amp;nbsp;the warning below at compile time), but it might just do for what you need.&lt;/p&gt;
&lt;p&gt;&amp;#39;System.Windows.Browser.HtmlTimer&amp;#39; is obsolete: &amp;#39;This is not a high resolution timer and is not suitable for short-interval animations. A new timer type will be available in a future release.&lt;/p&gt;</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/1297.aspx</link><pubDate>Fri, 04 May 2007 16:17:53 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:1297</guid><dc:creator>toddreifsteck</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/1297.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=1297</wfw:commentRss><description>&lt;p&gt;More functionality to allow this is planned and should be there in releases before RTM, but I believe I can give you an idea of code soemthing to make this work before some more functionality is included.&lt;/p&gt;
&lt;p&gt;In this alpha, try creating a timeline and check the time elapsed each time the callback occurs and do your work there.&lt;/p&gt;
&lt;p&gt;For the final released product, we hope to deliver a more complete and easier way to do this.&lt;/p&gt;
&lt;p&gt;Todd Reifsteck, Microsoft&lt;/p&gt;</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/1185.aspx</link><pubDate>Fri, 04 May 2007 03:18:05 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:1185</guid><dc:creator>Harvey</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/1185.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=1185</wfw:commentRss><description>&lt;p&gt;Hi Guys,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;On the subject of threading, I am trying to create a code driven animation using the System.Threading.Timer class. The problem is Timer callbacks run from another thread, so when I try to move and element I am getting &amp;quot;Invalid Cross-Thread access&amp;quot;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;Is there a way to create a thread safe heartbeat?&lt;/p&gt;&lt;p&gt;&amp;nbsp;Here is some sample code to replicate the issue&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;------- XAML-----------&lt;/p&gt;&lt;p&gt;&amp;lt;Canvas x:Name=&amp;quot;parentCanvas&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns=&amp;quot;http://schemas.microsoft.com/client/2007&amp;quot; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:x=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Loaded=&amp;quot;Page_Loaded&amp;quot; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x:Class=&amp;quot;SilverlightProject1.Page;assembly=ClientBin/SilverlightProject1.dll&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Width=&amp;quot;640&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Height=&amp;quot;480&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Background=&amp;quot;White&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;lt;Ellipse Canvas.Top=&amp;quot;100&amp;quot; Canvas.Left=&amp;quot;100&amp;quot; Fill=&amp;quot;Black&amp;quot; Width=&amp;quot;10&amp;quot; Height=&amp;quot;10&amp;quot; x:Name=&amp;quot;elpBall&amp;quot;&amp;gt;&amp;lt;/Ellipse&amp;gt;&lt;br /&gt;&amp;lt;/Canvas&amp;gt;&lt;/p&gt;&lt;p&gt;-----------------------------&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;------------------- Code------------------&lt;/p&gt;&lt;p&gt;using System;&lt;br /&gt;using System.Windows;&lt;br /&gt;using System.Windows.Controls;&lt;br /&gt;using System.Windows.Documents;&lt;br /&gt;using System.Windows.Ink;&lt;br /&gt;using System.Windows.Input;&lt;br /&gt;using System.Windows.Media;&lt;br /&gt;using System.Windows.Media.Animation;&lt;br /&gt;using System.Windows.Shapes;&lt;br /&gt;&lt;br /&gt;using System.Threading;&lt;br /&gt;&lt;br /&gt;namespace SilverlightProject1&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class Page : Canvas&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ellipse elpBall;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private Timer timer;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Page_Loaded(object o, EventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elpBall = this.FindName(&amp;quot;elpBall&amp;quot;) as Ellipse;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timer = new Timer(Move, null, 1, -1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void Move(Object state)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.elpBall.SetValue(Canvas.LeftProperty, 5);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;-------------------------------------&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Cheers,&lt;/p&gt;&lt;p&gt;Javier&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Threading in Silverlight</title><link>http://forums.silverlight.net/forums/thread/1150.aspx</link><pubDate>Fri, 04 May 2007 01:39:08 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:1150</guid><dc:creator>toddreifsteck</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/1150.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=1150</wfw:commentRss><description>&lt;p&gt;As you noticed, the System.Threading namespace is nearly 100% exposed in the 1.1 Silverlight alpha. As currently exposed, there are no limits on the number of threads that can be created by System.Threading except the normal memory limitations of the OS.&lt;/p&gt;
&lt;p&gt;I am one of the software developers working on the final design of System.Threading and it has been somewhat difficult to filter what will be exposed in System.Threading when we consider that the client applications will be running in the browser and a number of operations (such as drawing the UI) can only reliably occur from a particular thread.&amp;nbsp;This forces a complex code-pattern that neither the System.Threading classes nor the classes that allow browser or UI manipulation do not currently 100% enforce. For now, your best bet is to try to write your code in multiple threads (if it makes sense for your app), but be aware that some operations may need to be called from the original thread or controlled by some type of synchronization primitive to ensure that the engine&amp;#39;s call to the browser does not expose an underlying&amp;nbsp;thread-safety issue.&lt;/p&gt;
&lt;p&gt;I envision some extremely powerful games that could be written in the browser by using Silverlight to implement clever multithreaded processing to track game-state and/or AI.&lt;/p&gt;
&lt;p&gt;Hope that helps!&lt;br /&gt;Todd&lt;/p&gt;</description></item></channel></rss>