public override IEnumerable <IMenuBarItem> AllMenuItems()
        {
            yield return(_menuBarItemRepository[MenuBarItemIds.AddObservedData]);

            yield return(_menuBarItemRepository[MenuBarItemIds.LoadObservedData]);

            yield return(CreateMenuButton.WithCaption(AppConstants.MenuNames.ExportToPDF)
                         .WithCommand <ExportCollectionToPDFCommand <DataRepository> >()
                         .WithIcon(ApplicationIcons.ExportToPDF));

            if (_treeNode.AllLeafNodes.OfType <ObservedDataNode>().Any())
            {
                yield return(ObservedDataClassificationCommonContextMenuItems.CreateEditMultipleMetaDataMenuButton(_treeNode).AsGroupStarter());
            }


            yield return(ClassificationCommonContextMenuItems.CreateClassificationUnderMenu(_treeNode, _presenter));

            var groupMenu = createGroupingSubMenu(_treeNode, _presenter);

            if (groupMenu.AllItems().Any())
            {
                yield return(groupMenu);
            }

            yield return(ClassificationCommonContextMenuItems.RemoveClassificationFolderMainMenu(_treeNode, _presenter).AsGroupStarter());
        }
示例#2
0
        public ObservedDataFolderContextMenu(
            ITreeNode <RootNodeType> treeNode,
            IMenuBarItemRepository repository,
            IBuildingBlockRepository buildingBlockRepository,
            IBuildingBlockExplorerPresenter presenter)
        {
            var allCompounds = buildingBlockRepository.All <Compound>().ToList();

            _view.AddMenuItem(repository[MenuBarItemIds.ImportObservedData]);

            //create sub menu containing all compounds
            var subMenu = CreateSubMenu.WithCaption(PKSimConstants.MenuNames.AddObservedDataFor)
                          .WithIcon(ApplicationIcons.ObservedDataForMolecule);

            foreach (var compound in allCompounds)
            {
                subMenu.AddItem(CreateMenuButton.WithCaption(compound.Name)
                                .WithCommandFor <AddObservedDataForCompoundUICommand, Compound>(compound));
            }

            if (allCompounds.Any())
            {
                _view.AddMenuItem(subMenu);
            }

            _view.AddMenuItem(repository[MenuBarItemIds.ImportFractionData].AsGroupStarter());

            _view.AddMenuItem(CreateMenuButton.WithCaption(PKSimConstants.MenuNames.LoadFromTemplate)
                              .WithCommand <LoadObservedDataFromTemplateUICommand>()
                              .WithIcon(ApplicationIcons.LoadFromTemplate)
                              .AsGroupStarter());

            _view.AddMenuItem(CreateMenuButton.WithCaption(PKSimConstants.MenuNames.DevOnlyMenuNameFor("Load from Snapshot"))
                              .WithCommand <LoadObservedDataFromSnapshotUICommand>()
                              .WithIcon(ApplicationIcons.SnapshotImport)
                              .ForDeveloper());


            if (treeNode.AllLeafNodes.OfType <ObservedDataNode>().Any())
            {
                _view.AddMenuItem(ObservedDataClassificationCommonContextMenuItems.CreateEditMultipleMetaDataMenuButton(treeNode).AsGroupStarter());
            }


            _view.AddMenuItem(ClassificationCommonContextMenuItems.CreateClassificationUnderMenu(treeNode, presenter));

            var groupMenu = createGroupingSubMenu(treeNode, presenter);

            if (groupMenu.AllItems().Any())
            {
                _view.AddMenuItem(groupMenu);
            }

            _view.AddMenuItem(createDeleteSubMenu(treeNode, presenter));
        }