|
|
|
|
@ -185,14 +185,18 @@ namespace Lib.NotifyIcon.Windows |
|
|
|
|
uint i = 1; |
|
|
|
|
foreach (var item in ContextMenu.Items) |
|
|
|
|
{ |
|
|
|
|
MenuItem menuItem = (MenuItem)item; |
|
|
|
|
if (item is MenuItem menuItem) |
|
|
|
|
{ |
|
|
|
|
// Add items to the native context menu by simply reusing |
|
|
|
|
// the information provided within the Avalonia ContextMenu. |
|
|
|
|
WindowApi.AppendMenu(popupMenu, MenuFlags.MfString, i, (string) menuItem.Header); |
|
|
|
|
|
|
|
|
|
// Add items to the native context menu by simply reusing |
|
|
|
|
// the information provided within the Avalonia ContextMenu. |
|
|
|
|
WindowApi.AppendMenu(popupMenu, MenuFlags.MfString, i, (string) menuItem.Header); |
|
|
|
|
// Add the mapping so that we can find the selected item later |
|
|
|
|
contextItemLookup.Add(i, menuItem); |
|
|
|
|
} |
|
|
|
|
else if (item is Separator) |
|
|
|
|
WindowApi.AppendMenu(popupMenu, MenuFlags.MfSeparator, i, null); |
|
|
|
|
|
|
|
|
|
// Add the mapping so that we can find the selected item later |
|
|
|
|
contextItemLookup.Add(i, menuItem); |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|