c# - Properly use Background Worker in a WPF application -


I am stuck in using the background worker properly, the app needs to communicate with the database, It takes a little more time and the UI freezes for a while, I need to build database things and wait until the work is finished, for this time, I want to display a window of type that gives the user an app state Indicates (loading C, which, to download).

My code

I have not written any code yet, but what I want here:

  / / Instructions initializeComponent (); // Do this in the background and wait until it finnishes GetEntitiesFromDatabase (); Institutional Review ITSource = Some List; (GetEntitiesFromDatabase will initialize this list) // ....  

How can I move forward, I know that this question can already be asked in the forum but I If it can be done in another way, please help me, thanks in advance.

If you're going to be able to manipulate the UI directly, you'll need to Dispatcher.BeginInvoke is required when you are not on the UI thread (read in BackgroundWorker ).

  Dispatcher.BeginInWalk (new action (=) ({Institutions listview.itsmsource = some list;}), tap;  

You can tie items for the source of a steady model (a better idea) and this setting will martial the changes in the property bound for you

Actually, either Dispatcher.BeginInvoke or switch to MVVM (which was done to use WPF anyway).


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -