示例#1
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); });
     }
 }
示例#2
0
        private void SelectFromOptions(NodeConfigSectionBase section1, DiagramNodeViewModel vm)
        {
            InvertGraphEditor.WindowManager.InitItemWindow(section1.GenericSelector(GraphItem).ToArray(),
                                                           (selected) =>
            {
                var item = selected as GenericNodeChildItem;

                item.Node = vm.GraphItemObject as GraphNode;
                DiagramViewModel.CurrentRepository.Add(item);
                if (section1.OnAdd != null)
                {
                    section1.OnAdd(item);
                }
                else
                {
                    item.Name = item.Repository.GetUniqueName(section1.Name);
                }

                item.IsEditing = true;
                OnAdd(section1, item);
            });
        }