Noberto Pessoa
Noberto Pessoa

Reputation: 125

Create or load controls without freezing the window

When a browser is opened, before it's completely loaded, we can use the controls as others are being loaded (the address bar appears and, while the bookmarks are loaded, we can already type in it).

I'm making a personal browser, and I don't know how to perform that. I imagined creating the controls in another thread, but soon I discovered that that's not possible.

In my last question (where I discovered the above), I received an answer talking about Attribute, Reflection, async/await modifiers and observable collection as the closest solution to that and I'll study them yet. In this new question, I would like to receive others suggestions of how that could be made (allow the user to use the window and controls while others are being created/loaded).

Thanks in advance.

Upvotes: 1

Views: 390

Answers (1)

Matías Fidemraizer
Matías Fidemraizer

Reputation: 64923

Actually I believe the process of loading the UI part of controls isn't the heavy one.

In the other hand, loading the data which is later bound to the control is the problem.

You can't draw controls outside UI thread, but you can load heavy data, preload resources or do calculation in a background thread.

While heavy controls' data is prepared to hit the UI in some background thread, UI will still be responsive.

For example, I guess Web browsers do HTML to DOM parsing in a background thread and they stream results in real time to the UI thread. That is, address bar and other UI components are responsive because UI thread isn't stressed.

Upvotes: 1

Related Questions