/// <summary> /// Close and dispose the form. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void OnClose(object sender, Bentley.Windowing.ContentCloseEventArgs e) { e.CloseAction = Bentley.Windowing.ContentCloseAction.Dispose; Form2Form.m_windowContent.Hide(); if (null != Form2Form) { Form2Form.DetachFromMicroStation(); Form2Form.Dispose(); Form2Form = null; } }
/// <summary> /// Show the form and attach to Bentley Windows Form Adapter as top level form. /// </summary> /// <param name="unparsed"></param> internal void ShowForm(string unparsed = "") { if (null != Form2Form) { Form2Form.Focus(); return; } Form2Form = new Form2(); Form2Form.AttachAsTopLevelForm(Program.Addin, true); Form2Form.AutoOpen = true; Form2Form.AutoOpenKeyin = "mdl load Form2"; Form2Form.NETDockable = true; Bentley.Windowing.WindowManager windowManager = Bentley.Windowing.WindowManager.GetForMicroStation(); Form2Form.m_windowContent = windowManager.DockPanel(Form2Form, Form2Form.Name, Form2Form.Text, Bentley.Windowing.DockLocation.Floating); Form2Form.m_windowContent.CanDockHorizontally = false; Form2Form.m_windowContent.ContentCloseQuery += OnClose; }