private static void _ShowPopup(Control parent, string caption, Point location, bool mayBeToLeft) { try { if (currentPopup != null) { currentPopup.Dispose(); } bool returnFocus = (parent != null && parent.Focused); currentPopup = new PopupWindow(parent, caption, location, mayBeToLeft); currentPopupCreated = DateTime.Now; currentPopup.Show(); if (returnFocus) { parent.Focus(); } } catch (Exception e) { LibSys.StatusBar.Trace("popup: e=" + e.Message); } }
private static void _ShowPopup(Control parent, string caption, Point location, bool mayBeToLeft) { try { if(currentPopup != null) { currentPopup.Dispose(); } bool returnFocus = (parent != null && parent.Focused); currentPopup = new PopupWindow(parent, caption, location, mayBeToLeft); currentPopupCreated = DateTime.Now; currentPopup.Show(); if(returnFocus) { parent.Focus(); } } catch (Exception e) { LibSys.StatusBar.Trace("popup: e=" + e.Message); } }
// called often from MainFrame, as part of periodicMaintenance() public static void popupMaintenance() { if(currentPopup != null && ((DateTime.Now - currentPopupCreated).Seconds > 10)) { try { currentPopup.Dispose(); } catch {} currentPopup = null; } }