I have an old winform application where a winform is showed with form.ShowDialog()
command. However, this approach is non-user friendly as it blocks the main UI until user closes the form. I have tried to changed the code to form.Show
which unfreezes the main UI however the code keeps getting excecuted without waiting for the form
to close and get the received data. Any Idea on how to implement this?
MyObject OnButtonClick(){
var form = new MyForm();
form.Show(); <-- await till it is closed
MyObject results = form.MyCustomResults;
return results;
}