private void CreateNewSectionItem(NodeConfigSectionBase section1, DiagramNodeViewModel vm)
        {
            var item = Activator.CreateInstance(section1.SourceType) as GenericNodeChildItem;

            item.Node = vm.GraphItemObject as GraphNode;
            DiagramViewModel.CurrentRepository.Add(item);
            item.Name = item.Repository.GetUniqueName(section1.Name);

            OnAdd(section1, item);

            if (typeof(ITypedItem).IsAssignableFrom(section1.SourceType))
            {
                InvertApplication.Execute(new SelectTypeCommand()
                {
                    PrimitiveOnly     = false,
                    AllowNone         = false,
                    IncludePrimitives = true,
                    Item = item as ITypedItem,
                    OnSelectionFinished = () =>
                    {
                        item.IsSelected = true;
                        item.IsEditing  = true;
                    }
                });
            }
            else
            {
                item.IsEditing = true;
            }
        }
        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);
            });
        }
 public GenericItemViewModel(TData data, DiagramNodeViewModel nodeViewModel) : base(data, nodeViewModel)
 {
 }
 public GenericItemViewModel(DiagramNodeViewModel nodeViewModel) : base(nodeViewModel)
 {
 }
 protected TypedItemViewModel(ITypedItem viewModelItem, DiagramNodeViewModel nodeViewModel)
     : base(nodeViewModel)
 {
     DataObject = viewModelItem;
 }
 private void OnAdd(NodeConfigSectionBase section, NodeConfigSectionBase section1, DiagramNodeViewModel vm)
 {
     if (section1.AllowAdding && section1.ReferenceType != null && !section1.HasPredefinedOptions)
     {
         SelectReferenceItem(section, section1);
     }
     else
     {
         if (section1.GenericSelector != null && section1.HasPredefinedOptions)
         {
             SelectFromOptions(section1, vm);
         }
         else
         {
             CreateNewSectionItem(section1, vm);
         }
     }
 }
 public GenericChildItemHeaderDrawer(DiagramNodeViewModel viewModelObject)
     : base(viewModelObject)
 {
 }
 public PropertyFieldViewModel(DiagramNodeViewModel nodeViewModel) : base(nodeViewModel)
 {
 }
 public ItemViewModel(TData data, DiagramNodeViewModel nodeViewModel)
     : base(nodeViewModel)
 {
     Data = data;
 }
 protected TypedItemViewModel(ITypedItem viewModelItem, DiagramNodeViewModel nodeViewModel)
     : base(viewModelItem, nodeViewModel)
 {
 }