ConvertAndAdd() public méthode

public ConvertAndAdd ( IEnumerable regularItems, Action itemAction, bool categoriesByGroups = true ) : void
regularItems IEnumerable
itemAction Action
categoriesByGroups bool
Résultat void
        private void SelectReferenceItem(NodeConfigSectionBase section, NodeConfigSectionBase section1)
        {
            if (section.AddCommandType != null)
            {
            }

            var menu = new SelectionMenu();


            if (section1.AllowDuplicates)
            {
                menu.ConvertAndAdd(section1.GenericSelector(GraphItem).ToArray().OfType <IItem>(), _ =>
                {
                    GraphItem.AddReferenceItem(_ as TData, section1);
                });


                //InvertGraphEditor.WindowManager.InitItemWindow(section1.GenericSelector(GraphItem).ToArray(),
                //    (selected) => { GraphItem.AddReferenceItem(selected, section1); });
            }
            else
            {
                menu.ConvertAndAdd(section1.GenericSelector(GraphItem).Where(
                                       p =>
                                       !GraphItem.PersistedItems.OfType <GenericReferenceItem>()
                                       .Select(x => x.SourceIdentifier)
                                       .Contains(p.Identifier)).ToArray().OfType <IItem>(), _ =>
                {
                    GraphItem.AddReferenceItem(_ as TData, section1);
                });
            }

            InvertApplication.SignalEvent <IShowSelectionMenu>(_ => _.ShowSelectionMenu(menu));
        }
Exemple #2
0
        public void SelectItem()
        {
            var menu = new SelectionMenu();

            menu.AddItem(new SelectionMenuItem(string.Empty, "[None]", () =>
            {
                ReferenceItem.SetInput(null);
            }));
            menu.ConvertAndAdd(ReferenceItem.GetAllowed().OfType <IItem>(), _ =>
            {
                var item = _ as IValueItem;
                if (item == null)
                {
                    return;
                }
                if (IsInput)
                {
                    ReferenceItem.SetInput(item);
                }
                else
                {
                    ReferenceItem.SetOutput(item);
                }
            });

            InvertApplication.SignalEvent <IShowSelectionMenu>(_ => _.ShowSelectionMenu(menu));

//            InvertGraphEditor.WindowManager.InitItemWindow(ReferenceItem.GetAllowed().ToArray(), _ =>
//            {
//                InvertApplication.Execute(new LambdaCommand("Set Item", () =>
//                {
//
//
//                }));
//            });
        }
        public void SelectItem()
        {

            var menu = new SelectionMenu();
            menu.AddItem(new SelectionMenuItem(string.Empty,"[None]", () =>
            {
                ReferenceItem.SetInput(null);
            }));
            menu.ConvertAndAdd(ReferenceItem.GetAllowed().OfType<IItem>(), _ =>
            {
                var item = _ as IValueItem;
                if (item == null) return;
                if (IsInput)
                {
                    ReferenceItem.SetInput(item);
                }
                else
                {
                    ReferenceItem.SetOutput(item);
                }
            });

            InvertApplication.SignalEvent<IShowSelectionMenu>(_=>_.ShowSelectionMenu(menu));

//            InvertGraphEditor.WindowManager.InitItemWindow(ReferenceItem.GetAllowed().ToArray(), _ =>
//            {
//                InvertApplication.Execute(new LambdaCommand("Set Item", () =>
//                {
//                    
//                   
//                }));
//            });
        }