delay the code execution in wpf application

Posted by Sudhakar_A under C# on 10/3/2013 | Points: 10 | Views : 7152 | Status : [Member] | Replies : 5
How to delay the code execution without freezing the UI.

i m using System.threading.thread.sleep(10000),
which hangs or freezes ma user interface??


Pls help me to sort




Responses

Posted by: Bandi on: 10/3/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
The await keyword, in conjunction with Task.Delay
http://stackoverflow.com/questions/16003090/wait-for-n-seconds-then-next-line-of-code-without-freezing-form
http://stackoverflow.com/questions/1419363/pause-execution-of-a-method-without-locking-gui-c-sharp
http://stackoverflow.com/questions/17865406/timers-delay-without-freezing-the-app-c-sharp

EDIT:
http://social.msdn.microsoft.com/Forums/windows/en-US/48d30dac-7d1f-44ff-8b00-0873b3add879/how-to-set-delay-without-freezinglocking-gui

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Sudhakar_A, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sudhakar_A on: 10/4/2013 [Member] Starter | Points: 25

Up
0
Down
@Chandu......thnk's for u r code,but i m not able to use task.delay in vs2008.

Does it requires .net4.5 framework.if so then can i download it and use in VS2008.

Does it supports?????? or any other easy soln.

Sudhakar_A, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 10/4/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Yes... .NET4.5 framework is required for Tasks.Delay
Refer
http://msdn.microsoft.com/en-us/library/hh194845.aspx

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Sudhakar_A, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sudhakar_A on: 10/6/2013 [Member] Starter | Points: 25

Up
0
Down
@chandu....... i have installed vs2012 ulimate ,but wen i write using system.threading.Tasks namespace,it give me an error in Tasks.

Sudhakar_A, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 10/7/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer this link for "How to integrate .Net 4.0 Tasks with WPF"

http://blog.lab49.com/archives/4034

EDIT:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=754
http://www.jarloo.com/simple-background-processing-in-wpf-using-the-task-framework/

Refer this link for Tasks.Delay in .NET4.5
http://msdn.microsoft.com/en-us/library/system.threading.tasks.task(v=vs.110).aspx


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Sudhakar_A, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response