private void AddNode(IDiagramNode diagramNode)
        {
            var diagramNodeUi = (DiagramNodeViewModel)_diagramShapeUiFactory.CreateDiagramNodeUi(DiagramService, diagramNode, MiniButtonPanelViewModel);

            diagramNodeUi.SizeChanged                  += OnDiagramNodeSizeChanged;
            diagramNodeUi.PayloadAreaSizeChanged       += OnDiagramNodePayloadAreaSizeChanged;
            diagramNodeUi.ShowRelatedNodesRequested    += OnShowRelatedNodesRequested;
            diagramNodeUi.RelatedNodeSelectorRequested += OnEntitySelectorRequested;
            diagramNodeUi.RemoveRequested              += OnRemoveDiagramNodeRequested;

            _diagramNodeToViewModelMap.Set(diagramNode.Id, diagramNodeUi);
            DiagramNodeViewModels.Add(diagramNodeUi);
        }
        private void AddNode(IDiagramNode diagramNode)
        {
            var diagramNodeUi = (DiagramNodeViewModelBase)_diagramShapeUiFactory.CreateDiagramNodeUi(DiagramService, diagramNode, MiniButtonPanelViewModel);

            diagramNodeUi.SizeChanged += OnDiagramNodeSizeChanged;
            diagramNodeUi.ShowRelatedNodesRequested    += OnShowRelatedNodesRequested;
            diagramNodeUi.RelatedNodeSelectorRequested += OnEntitySelectorRequested;
            diagramNodeUi.RemoveRequested += OnRemoveDiagramNodeRequested;

            _diagramNodeToViewModelMap.Set(diagramNode, diagramNodeUi);

            if (DiagramService.TryGetContainerNode(diagramNode, out var containerNode) &&
                IsNodeVisibleOnDiagram(containerNode, out var containerNodeUi))
            {
                ((IContainerDiagramNodeUi)containerNodeUi).AddChildNode(diagramNodeUi);
            }
            else
            {
                DiagramNodeViewModels.Add(diagramNodeUi);
            }
        }
Exemplo n.º 3
0
        private void AddNode(IDiagramNode diagramNode, ModelNodeId?parentNodeId)
        {
            var diagramNodeUi = (DiagramNodeViewModel)_diagramShapeUiFactory.CreateDiagramNodeUi(DiagramService, diagramNode, MiniButtonPanelViewModel);

            diagramNodeUi.SizeChanged += OnDiagramNodeSizeChanged;
            diagramNodeUi.ShowRelatedNodesRequested    += OnShowRelatedNodesRequested;
            diagramNodeUi.RelatedNodeSelectorRequested += OnEntitySelectorRequested;
            diagramNodeUi.RemoveRequested += OnRemoveDiagramNodeRequested;

            _diagramNodeToViewModelMap.Set(diagramNode.Id, diagramNodeUi);

            if (parentNodeId.HasValue)
            {
                if (IsNodeVisibleOnDiagram(parentNodeId.Value, out var containerNodeUi))
                {
                    containerNodeUi.AddChildNode(diagramNodeUi);
                }
            }
            else
            {
                DiagramNodeViewModels.Add(diagramNodeUi);
            }
        }