Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
//here im hitting database
}

But i want to something like backgroud task I mean UI is shown to user without delay and retreving data from data base will be done in background
Posted
Updated 14-Jul-15 3:28am
v4
Comments
[no name] 14-Jul-15 7:45am    
Okay so use a background worker then.
Princingh 14-Jul-15 9:32am    
Yes

1 solution

I would suggest using tasks. Have a look at https://msdn.microsoft.com/en-us/library/system.threading.tasks(v=vs.110).aspx[^] namespace.

To compare the differences between Task and Backgroundworker, have a look at http://blog.stephencleary.com/2013/05/taskrun-vs-backgroundworker-round-1.html[^]

Also for the use in WPF have a look at
- Using the Task Parallel Library (TPL) in WPF[^]
- Task Parallel Library: 1 of n[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900