I made a WinForm and used this code to open it via a Keyin:
Frm_Main frm = new Frm_Main();
WindowManager winManager = Bentley.Windowing.WindowManager.GetForMicroStation();
Size minSize = new Size(frm.MinimumSize.Width, frm.MinimumSize.Height);
WindowContent window = winManager.DockPanel(frm, "frmMain", frm.Text, Bentley.Windowing.DockLocation.Floating, minSize, minSize);
In my FormClosing() Event I check if there are unsaved Changes and prevent the Form from Closing, when the User doesn't want to discard the changes. When I call the Keyin a 2nd Time, everything works fine. When I press the X on the Form, the Event gets fired but the Form is not visible anymore.My Question is if I can prevent the MicroStation to close my Form before I'm letting it through or if I can see that the Form isn't visible anymore and reopen it. Reopening isn't a issue but I can't do it with the Keyin, because then I end up with 2 Windows, one with content and one without.
Is there no solution to this?
Mit freundlichen Grüßen / Best regardsJean-Pierre Hundhausen
| AB_DATE Engineering Software | ab-date.de |
It is easy to prevent a winform to close. We can find below solution from internet seaching.