コード例 #1
0
        private void SetMenu(NativeMenu menu)
        {
            var appMenu = _factory.ObtainAppMenu();

            if (appMenu is null)
            {
                appMenu = _factory.CreateMenu();
            }

            var menuItem = menu.Parent;

            if (menu.Parent is null)
            {
                menuItem = new NativeMenuItem();
            }

            menuItem.Menu = menu;

            appMenu.Clear();
            AddItemsToMenu(appMenu, new List <NativeMenuItemBase> {
                menuItem
            });

            _factory.SetAppMenu(appMenu);
        }
コード例 #2
0
        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);
            }
        }