[Feature] Ignore open close events during main preload (#248), 1.1.0.6

This commit is contained in:
Markus Hofknecht 2021-11-23 23:48:59 +01:00
parent 898768ce71
commit 92d7e058a9
3 changed files with 12 additions and 4 deletions

View file

@ -548,8 +548,14 @@ namespace SystemTrayMenu.Business
return (DateTime.Now - dateTimeLastOpening).TotalMilliseconds < 2000;
}
internal void SwitchOpenClose(bool byClick)
internal void SwitchOpenClose(bool byClick, bool isMainPreload = false)
{
// Ignore open close events during main preload #248
if (IconReader.MainPreload && !isMainPreload)
{
return;
}
waitToOpenMenu.MouseActive = byClick;
if (byClick &&
!Config.AlwaysOpenByPin &&
@ -629,11 +635,13 @@ namespace SystemTrayMenu.Business
}
timerShowProcessStartedAsLoadingIcon.Tick += Tick;
timerShowProcessStartedAsLoadingIcon.Interval = 50;
timerShowProcessStartedAsLoadingIcon.Start();
void Tick(object sender, EventArgs e)
{
timerShowProcessStartedAsLoadingIcon.Tick -= Tick;
SwitchOpenClose(false);
timerShowProcessStartedAsLoadingIcon.Interval = Properties.Settings.Default.TimeUntilClosesAfterEnterPressed;
SwitchOpenClose(false, true);
}
if (!Properties.Settings.Default.CacheMainMenu)

View file

@ -16,7 +16,7 @@ namespace SystemTrayMenu.Helper
internal KeyPressedEventArgs(KeyboardHookModifierKeys modifier, Keys key)
{
this.Modifier = modifier;
Modifier = modifier;
this.key = key;
}

View file

@ -309,7 +309,7 @@
</ItemGroup>
<PropertyGroup>
<PreBuildEvent>taskkill /fi "pid gt 0" /im SystemTrayMenu.exe
taskkill /f /fi "pid gt 0" /im SystemTrayMenu.exe
REM taskkill /f /fi "pid gt 0" /im SystemTrayMenu.exe
EXIT 0</PreBuildEvent>
<RepositoryUrl>https://github.com/Hofknecht/SystemTrayMenu</RepositoryUrl>
<PackageIcon>icon.png</PackageIcon>