This commit is contained in:
Markus Hofknecht 2020-05-01 12:41:35 +02:00
parent 43755ae648
commit 4bcaa0e1ad
2 changed files with 6 additions and 4 deletions

View file

@ -62,7 +62,8 @@ namespace SystemTrayMenu.Business
keyboardInput = new KeyboardInput(menus);
keyboardInput.RegisterHotKey();
keyboardInput.HotKeyPressed += SwitchOpenClose;
keyboardInput.HotKeyPressed += KeyboardInput_HotKeyPressed;
void KeyboardInput_HotKeyPressed() => SwitchOpenClose(false);
keyboardInput.ClosePressed += MenusFadeOut;
keyboardInput.RowDeselected += CheckMenuOpenerStop;
keyboardInput.RowSelected += KeyboardInputRowSelected;
@ -76,9 +77,9 @@ namespace SystemTrayMenu.Business
void LeaveTriggered() => FadeHalfOrOutIfNeeded();
}
internal void SwitchOpenClose()
internal void SwitchOpenClose(bool byClick)
{
if ((DateTime.Now - deactivatedTime).TotalMilliseconds < 200)
if (byClick && (DateTime.Now - deactivatedTime).TotalMilliseconds < 200)
{
//By click on notifyicon the menu gets deactivated and closed
}

View file

@ -20,7 +20,8 @@ namespace SystemTrayMenu
menus.LoadStopped += menuNotifyIcon.LoadingStop;
menuNotifyIcon.Exit += Application.Exit;
menuNotifyIcon.Restart += AppRestart.ByMenuNotifyIcon;
menuNotifyIcon.Click += menus.SwitchOpenClose;
menuNotifyIcon.Click += MenuNotifyIcon_Click;
void MenuNotifyIcon_Click() => menus.SwitchOpenClose(true);
menuNotifyIcon.OpenLog += Log.OpenLogFile;
menuNotifyIcon.ChangeFolder += ChangeFolder;
void ChangeFolder()