Answer the question
In order to leave comments, you need to log in
How to make the UI "wait" for an operation to complete?
There is a desktop utility. It reads a large table from a file.
How to make the UI not block while the file is being processed?
Advise sensible guide on streams.
They didn’t ban me on Google, but I can’t find it myself, since I’m new to dotNet. Too complex material.
An async method is not needed.
It is only necessary that the status "Processing a file ..." be in the window while the file is being loaded, but the window itself should be active.
UPD: The problem with streams is that there can be several files. And each new file is added to the MyTable object via the add_file method. That is, we have some kind of state that needs to be stored between reading files.
UPD2: In another way, how to change the object that was created in the UI thread in a new thread and not block the UI thread?
Answer the question
In order to leave comments, you need to log in
(new Thread(() => {
Invoke(new Action(() =>
{
mylabel.Text = "Обработка файла...";
}));
//Тут обработка файла
Invoke(new Action(() =>
{
mylabel.Text = "Обработка файла завершена!";
}));
})).Start();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question