예제 #1
0
        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));
        }
예제 #2
0
 private void SelectReferenceItem(NodeConfigSectionBase section, NodeConfigSectionBase section1)
 {
     if (section.AddCommandType != null)
     {
     }
     if (section1.AllowDuplicates)
     {
         InvertGraphEditor.WindowManager.InitItemWindow(section1.GenericSelector(GraphItem).ToArray(),
                                                        (selected) => { GraphItem.AddReferenceItem(selected, section1); });
     }
     else
     {
         IEnumerable <GenericReferenceItem> ritems = GraphItem.PersistedItems.OfType <GenericReferenceItem>();
         IEnumerable <IGraphItem>           items  = section1.GenericSelector(GraphItem).ToArray().Where(p => !ritems.Select(x => x.SourceIdentifier).Contains(p.Identifier));
         InvertGraphEditor.WindowManager.InitItemWindow(items, (selected) => { GraphItem.AddReferenceItem(selected, section1); });
     }
 }