mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-10-05 04:24:38 +13:00
Remove obsolete sanity check to improve performance significantly e.g. when search starts
This commit is contained in:
parent
8c62122c7e
commit
b377c1aaf6
1 changed files with 24 additions and 28 deletions
|
@ -284,39 +284,35 @@ namespace SystemTrayMenu.DataClasses
|
||||||
|
|
||||||
internal void OpenSubMenu()
|
internal void OpenSubMenu()
|
||||||
{
|
{
|
||||||
// TODO: always true? maybe only when cached in WaitToLoadMenu or keyboardInput?
|
Menu? openSubMenu = Owner?.SubMenu;
|
||||||
if (((List<RowData>?)Owner?.GetDataGridView().Items.SourceCollection)?.Contains(this) ?? false)
|
|
||||||
|
// only re-open when the menu is not already open
|
||||||
|
if (SubMenu != null && SubMenu == openSubMenu)
|
||||||
{
|
{
|
||||||
Menu? openSubMenu = Owner.SubMenu;
|
// Close second level sub menus when already opened
|
||||||
|
openSubMenu.SelectedItem = null;
|
||||||
// only re-open when the menu is not already open
|
if (openSubMenu.SubMenu != null)
|
||||||
if (SubMenu != null && SubMenu == openSubMenu)
|
|
||||||
{
|
{
|
||||||
// Close second level sub menus when already opened
|
openSubMenu.SubMenu.HideWithFade(true);
|
||||||
openSubMenu.SelectedItem = null;
|
openSubMenu.RefreshSelection();
|
||||||
if (openSubMenu.SubMenu != null)
|
|
||||||
{
|
|
||||||
openSubMenu.SubMenu.HideWithFade(true);
|
|
||||||
openSubMenu.RefreshSelection();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// In case another menu exists, close it
|
||||||
|
if (openSubMenu != null)
|
||||||
{
|
{
|
||||||
// In case another menu exists, close it
|
// Give the opening window focus
|
||||||
if (openSubMenu != null)
|
// if closing window lose focus, no window would have focus any more
|
||||||
{
|
Owner?.Activate();
|
||||||
// Give the opening window focus
|
Owner?.FocusTextBox();
|
||||||
// if closing window lose focus, no window would have focus any more
|
openSubMenu.HideWithFade(true);
|
||||||
Owner.Activate();
|
Owner?.RefreshSelection();
|
||||||
Owner.FocusTextBox();
|
}
|
||||||
openSubMenu.HideWithFade(true);
|
|
||||||
Owner.RefreshSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsPointingToFolder)
|
if (IsPointingToFolder)
|
||||||
{
|
{
|
||||||
Owner.RiseStartLoadSubMenu(this);
|
Owner?.RiseStartLoadSubMenu(this);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue