/// <summary> /// Close the menu when the user clicked elsewhere /// </summary> private void OnDeactivate(object sender, EventArgs eventArgs) { // close if the new active windows isn't a menu // ReSharper disable once ObjectCreationAsStatement new DelayedAction(30, () => { if (!ListOfOpenededMenuHandle.Contains(WinApi.GetForegroundWindow()) && !_closing) { BeginInvoke((Action)CloseAll); } }); }
/// <summary> /// Close the menu when the user clicked elsewhere /// </summary> protected override void OnDeactivate(EventArgs e) { // close if the new active windows isn't a menu DelayedAction.StartNew(30, () => { if (!ListOfOpenededMenuHandle.Contains(WinApi.GetForegroundWindow()) && !_closing) { BeginInvoke((Action)CloseAll); } }); base.OnDeactivate(e); }