DispatcherTimer is probably preferred (easier to read) in this case. The Dispatcher.BeginInvoke is the usual "invoke on UI thread' code that I use so it came first to mind.
-------
Please mark this post as answer if it answers your question!
Nikola - MSFT
http://blogs.msdn.com/nikola
DispatcherTimer is probably preferred (easier to read) in this case.
I saw your post here and your blog entry. They're a little confusing as you are creating a Timer with the sole purpose of invoking on the ui thread, which is basically the DispatcherTimer's job.
DispatcherTimer is probably preferred (easier to read) in this case.
I saw your post here and your blog entry. They're a little confusing as you are creating a Timer with the sole purpose of invoking on the ui thread, which is basically the DispatcherTimer's job.
Thank you for your comment. I agree that DispatcherTimer is better for ontimer events, and also updated this on my blog. btw, I also referenced back to you and this forum for more clarification, hope you don't mind.
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = new TimeSpan(1000);
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
Thanks,
silverlightTimerwe servicesThreading
-------
Please mark this post as answer if it answers your question!
Nikola - MSFT
http://blogs.msdn.com/nikola
Nokola
Member
66 Points
13 Posts
Microsoft
Re: Call webService in Timer event?
Mar 13, 2008 09:39 PM | LINK
DispatcherTimer is probably preferred (easier to read) in this case. The Dispatcher.BeginInvoke is the usual "invoke on UI thread' code that I use so it came first to mind.
Please mark this post as answer if it answers your question!
Nikola - MSFT
http://blogs.msdn.com/nikola
jackbond
Contributor
5812 Points
1559 Posts
Re: Call webService in Timer event?
Mar 13, 2008 09:50 PM | LINK
I saw your post here and your blog entry. They're a little confusing as you are creating a Timer with the sole purpose of invoking on the ui thread, which is basically the DispatcherTimer's job.
Khet - The first Silverlight multiplayer game
Zork I: The Great Underground Empire
Nokola
Member
66 Points
13 Posts
Microsoft
Re: Call webService in Timer event?
Mar 13, 2008 10:03 PM | LINK
Thank you for your comment. I agree that DispatcherTimer is better for ontimer events, and also updated this on my blog. btw, I also referenced back to you and this forum for more clarification, hope you don't mind.
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = new TimeSpan(1000);
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
Thanks,
silverlight Timer we services Threading
Please mark this post as answer if it answers your question!
Nikola - MSFT
http://blogs.msdn.com/nikola
jackbond
Contributor
5812 Points
1559 Posts
Re: Call webService in Timer event?
Mar 13, 2008 10:19 PM | LINK
Not at all, thanks for clarifying.
Khet - The first Silverlight multiplayer game
Zork I: The Great Underground Empire