private void SetMenu(IAvnWindow avnWindow, NativeMenu menu) { var setMenu = false; if (_nativeMenu is null) { _nativeMenu = IAvnMenu.Create(_factory); _nativeMenu.Initialise(this, menu, ""); setMenu = true; } _nativeMenu.Update(_factory, menu); if (setMenu) { avnWindow.SetMainMenu(_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 = IAvnMenu.Create(_factory); _nativeMenu.Initialise(this, appMenuHolder, ""); setMenu = true; } _nativeMenu.Update(_factory, appMenuHolder); if (setMenu) { _factory.SetAppMenu(_nativeMenu); } }