Show progress bar when Entity Framework transfer data

I have a project that uses data from Entity Framework and present them in WPF. I want show threaded progress bar when Entity Framework load/save data on presentation layer.

Can you please help me to understand how can I do that?

Answers


You can use Dispatcher Thread to achieve this; Basically you need to create a common class that is extended in other UI classes.

To achieve this you can see basic example here; more precise example and downloadable code is available here.


I found this neat example to do that using Skip/Take methods. Basically you load x amount of records each round, which you Skip on the next round, and calculate this from the amount of all data in your table which enables you to update the progress bar each round.

Take a look at this:

List<MyDataTable> someData = new List<MyDataTable>();
int rowCount = dt.myDataTable.Count();

//TODO: <= display a progress bar here, and set max to rowCount...

int currentRows = 0;
while (currentRows < rowCount)
{
  someData.AddRange(dt.myDataTable.Skip(currentRows).Take(10000).ToList());
  currentRows = someData.Count;

  //TODO: <= update progress here...

}

Need Your Help

Can't show android device in ubuntu 13.04

android debugging usb adb device

I have a Android tablet device that can't be showed by android devices on my laptop(T61), but it worked fine on DELL PC with the same OS: Ubuntu 13.04.

swift ios does core data have any function to pre populate

ios database core-data

I am working on turning an web app into an iOS app.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.