I have two simple forms, one of which contains a grid and a button. When I press the button, my application starts to perform a long operation. While it works, I show another form containing a progress bar. I open it like this:
_busyWindow.ShowDialog();
And determined
public partial class BusyWindow : DevExpress.XtraEditors.XtraForm { public BusyWindow() { InitializeComponent(); } private void BusyWindow_FormClosing(object sender, FormClosingEventArgs e) { this.Hide(); e.Cancel = true;
When the operation is completed, I hide the form as follows
if (ended) _busyWindow.Hide();
It works great. The problem is that when I close the second form (the same closing code), it also closes fine, but my main GUI loses focus. For example, if I have Firefox that opens behind the application, then Firefox gets the focus.
This only happens when I close the second form when busyWindow is opened and not when it doesnβt (if I open the form, I close it without clicking the button, then the main GUI donβt lose focus).
Do you know what is happening or where can I try to search?
source share