Skip to content

Commit

Permalink
[Feature] Do not close menu when contextmenu copy item was used (#367)…
Browse files Browse the repository at this point in the history
…, version 1.2.9.0
  • Loading branch information
Hofknecht committed Feb 27, 2022
1 parent 37ec270 commit ca85237
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
37 changes: 31 additions & 6 deletions Business/Menus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace SystemTrayMenu.Business
using SystemTrayMenu.DataClasses;
using SystemTrayMenu.Handler;
using SystemTrayMenu.Helper;
using SystemTrayMenu.UserInterface;
using SystemTrayMenu.Utilities;
using Menu = SystemTrayMenu.UserInterface.Menu;
using Timer = System.Windows.Forms.Timer;
Expand Down Expand Up @@ -827,12 +828,6 @@ private static RowData ReadRowData(string fileName, bool isResolvedLnk, bool con
return rowData;
}

private static bool IsActive()
{
return Form.ActiveForm is Menu ||
Form.ActiveForm is UserInterface.TaskbarForm;
}

private static void OpenFolder(string pathToFolder = "")
{
string path = pathToFolder;
Expand All @@ -858,6 +853,36 @@ private static void InvalidateRowIfIndexInRange(DataGridView dgv, int rowIndex)
}
}

private bool IsActive()
{
bool IsShellContextMenuOpen()
{
bool isShellContextMenuOpen = false;
foreach (Menu menu in menus.Where(m => m != null))
{
DataGridView dgv = menu.GetDataGridView();
foreach (DataGridViewRow row in dgv.Rows)
{
RowData rowData = (RowData)row.Cells[2].Value;
if (rowData != null && rowData.IsContextMenuOpen)
{
isShellContextMenuOpen = true;
break;
}
}

if (isShellContextMenuOpen)
{
break;
}
}

return isShellContextMenuOpen;
}

return Form.ActiveForm is Menu or TaskbarForm || IsShellContextMenuOpen();
}

private Menu Create(MenuData menuData, string title = null)
{
Menu menu = new();
Expand Down
2 changes: 1 addition & 1 deletion Packaging/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Identity
Name="49543SystemTrayMenu.SystemTrayMenu"
Publisher="CN=5884501C-92ED-45DE-9508-9D987C314243"
Version="1.2.8.0" />
Version="1.2.9.0" />

<Properties>
<DisplayName>SystemTrayMenu</DisplayName>
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.8.11")]
[assembly: AssemblyFileVersion("1.2.8.11")]
[assembly: AssemblyVersion("1.2.9.0")]
[assembly: AssemblyFileVersion("1.2.9.0")]

0 comments on commit ca85237

Please sign in to comment.