V
V
vilix2015-08-05 15:12:58
WPF
vilix, 2015-08-05 15:12:58

How to make a load wait in C#?

I have an application that, on the click of a button, creates a new form and loads pictures in it synchronously in Window_Loaded and then shows them, the question is actually how to make it so that when the button is clicked, a temporary form (dialogue) opens, for example, with a wait and animation inscription, and then closes when the code from Window_Loaded is executed.
PS
While writing the question, such a solution came to mind, when you click on the button, also create this temporary form that will be TOPMOST and then just close it at the end of Window_Loaded.
Will this solution be normal or is there a better method?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Makarov, 2015-08-05
@vilix

1) We would not create a new form, but a control with a picture on the old one, it would look nicer
2) Make a request asynchronously (it depends on what and where you load it), check the readiness with a timer, and also animate the wait.
If you do not create a second eventloop, then the second form will not help you, because the message loop will not take control due to the synchronous code in Windows_Loaded.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question