コード例 #1
0
        public void Build(IMenuBuilder builder, ObjectsViewContext context)
        {
            var objects = context.SelectedObjects.ToList();

            if (objects.Count != 1)
            {
                return;
            }

            var menu = builder.ItemNames.ToList();

            if (!menu.Contains("miCreate"))
            {
                return;
            }

            var subMenu = builder.GetItem("miCreate");
            var index   = subMenu.Count;

            var smartFolderIndex = subMenu.ItemNames.ToList().IndexOf("miCreateSmartfoldertype");

            if (smartFolderIndex != -1)
            {
                index = smartFolderIndex - 1;
            }

            var selected = objects.First();

            if (selected.Type.IsProject)
            {
                subMenu.AddItem(Const.COMMAND_UPDATE_NAME, index)
                .WithHeader(Const.COMMAND_UPDATE_TITLE)
                .WithIcon(IconLoader.GetIcon(_projectCloneCreator.Icon));
            }
            else
            {
                subMenu.AddItem(Const.COMMAND_NAME, index)
                .WithHeader(Const.COMMAND_TITLE)
                .WithIcon(IconLoader.GetIcon(_projectCloneCreator.Icon));
            }
        }
コード例 #2
0
        public void Build(IMenuBuilder builder, MainViewContext context)
        {
            var menuItem = builder.ItemNames.First();

            builder.GetItem(menuItem).AddItem(ABOUT_PROGRAM_MENU, 1).WithHeader("О интеграции с КОМПАС");
        }