private void SetMenu(IAvnWindow avnWindow, NativeMenu menu) { var setMenu = false; if (_nativeMenu is null) { _nativeMenu = __MicroComIAvnMenuProxy.Create(_factory); _nativeMenu.Initialise(this, menu, ""); setMenu = true; } _nativeMenu.Update(_factory, menu); if (setMenu) { avnWindow.SetMainMenu(_nativeMenu); } }
private void SetMenu(IAvnTrayIcon trayIcon, NativeMenu menu) { var setMenu = false; if (_nativeMenu is null) { _nativeMenu = __MicroComIAvnMenuProxy.Create(_factory); _nativeMenu.Initialize(this, menu, ""); setMenu = true; } _nativeMenu.Update(_factory, menu); if (setMenu) { trayIcon.SetMenu(_nativeMenu); } }
private void SetMenu(NativeMenu menu) { var menuItem = menu.Parent; var appMenuHolder = menuItem?.Parent; if (menu.Parent is null) { menuItem = new NativeMenuItem(); } if (appMenuHolder is null) { appMenuHolder = new NativeMenu(); appMenuHolder.Add(menuItem); } menuItem.Menu = menu; var setMenu = false; if (_nativeMenu is null) { _nativeMenu = (__MicroComIAvnMenuProxy)__MicroComIAvnMenuProxy.Create(_factory); _nativeMenu.Initialise(this, appMenuHolder, ""); setMenu = true; } _nativeMenu.Update(_factory, appMenuHolder); if (setMenu) { _factory.SetAppMenu(_nativeMenu); } }