Example #1
0
        public DiagramNodeViewModel(IDiagramNode graphItemObject, DiagramViewModel diagramViewModel)
            : this()
        {
            ColumnSpan       = 2;
            DiagramViewModel = diagramViewModel;
            GraphItemObject  = graphItemObject;

            OutputConnectorType = graphItemObject.GetType();
            InputConnectorType  = graphItemObject.GetType();
        }
Example #2
0
        public override IDiagramNodeUi CreateDiagramNodeUi(IDiagramService diagramService, IDiagramNode diagramNode)
        {
            if (diagramNode is RoslynTypeDiagramNode roslynTypeDiagramNode)
            {
                return(new RoslynTypeDiagramNodeViewModel(ModelService, diagramService, roslynTypeDiagramNode, IsDescriptionVisible));
            }

            throw new InvalidOperationException($"Unexpected diagram node type {diagramNode?.GetType().Name}");
        }
        public FilterItem AddNode(IDiagramNode newNodeData, Vector2 position)
        {
            newNodeData.GraphId = GraphData.Identifier;
            CurrentRepository.Add(newNodeData);

            if (string.IsNullOrEmpty(newNodeData.Name))
            {
                newNodeData.Name =
                    CurrentRepository.GetUniqueName("New" + newNodeData.GetType().Name.Replace("Data", ""));
            }

            return(GraphData.CurrentFilter.ShowInFilter(newNodeData, position));
        }
        public override IDiagramNodeUi CreateDiagramNodeUi(IDiagramService diagramService, IDiagramNode diagramNode)
        {
            if (diagramNode is TypeDiagramNode typeDiagramNode)
            {
                return(new TypeDiagramNodeViewModel(ModelService, diagramService, typeDiagramNode));
            }

            if (diagramNode is PropertyDiagramNode propertyDiagramNode)
            {
                return(new PropertyDiagramNodeViewModel(ModelService, diagramService, propertyDiagramNode));
            }

            throw new ArgumentException($"Unexpected type {diagramNode.GetType().Name} in {GetType().Name}");
        }
        public FilterItem AddNode(IDiagramNode newNodeData, Vector2 position)
        {
            newNodeData.GraphId = GraphData.Identifier;
            CurrentRepository.Add(newNodeData);

            if (string.IsNullOrEmpty(newNodeData.Name))
                newNodeData.Name =
                    CurrentRepository.GetUniqueName("New" + newNodeData.GetType().Name.Replace("Data", ""));

            return GraphData.CurrentFilter.ShowInFilter(newNodeData, position);
        }