Exemplo n.º 1
0
        private void AddNode(IDiagramNode diagramNode)
        {
            var diagramNodeUi = (DiagramNodeViewModel)DiagramShapeUiFactory.CreateDiagramNodeUi(diagramNode, MiniButtonManager);

            diagramNodeUi.HeaderSizeChanged            += OnDiagramNodeHeaderSizeChanged;
            diagramNodeUi.ShowRelatedNodesRequested    += OnShowRelatedNodesRequested;
            diagramNodeUi.RelatedNodeSelectorRequested += OnEntitySelectorRequested;
            diagramNodeUi.RemoveRequested += OnRemoveDiagramNodeRequested;

            _diagramNodeToViewModelMap.Set(diagramNode.Id, diagramNodeUi);
            DiagramNodeViewModels.Add(diagramNodeUi);
        }
        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);
        }
Exemplo n.º 3
0
        private void AddNode(IDiagramNode diagramNode)
        {
            var diagramNodeViewModel = (DiagramNodeViewModel)DiagramShapeUiFactory.CreateDiagramNodeUi(diagramNode);

            diagramNodeViewModel.SizeChanged += OnDiagramNodeSizeChanged;
            diagramNodeViewModel.ChildrenAreaTopLeftChanged   += OnDiagramNodeChildrenAreaTopLeftChanged;
            diagramNodeViewModel.ShowRelatedNodesRequested    += OnShowRelatedNodesRequested;
            diagramNodeViewModel.RelatedNodeSelectorRequested += OnEntitySelectorRequested;
            diagramNodeViewModel.RemoveRequested += OnRemoveDiagramNodeRequested;

            _diagramNodeToViewModelMap.Set(diagramNode.Id, diagramNodeViewModel);
            DiagramNodeViewModels.Add(diagramNodeViewModel);
        }
        private void AddToViewModels(DiagramShapeViewModelBase diagramShapeViewModel)
        {
            if (diagramShapeViewModel is DiagramNodeViewModel)
            {
                DiagramNodeViewModels.Add((DiagramNodeViewModel)diagramShapeViewModel);
            }

            else if (diagramShapeViewModel is DiagramConnectorViewModel)
            {
                DiagramConnectorViewModels.Add((DiagramConnectorViewModel)diagramShapeViewModel);
            }

            else
            {
                throw new Exception($"Unexpected DiagramShapeViewModelBase: {diagramShapeViewModel.GetType().Name}");
            }
        }
        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.º 6
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);
            }
        }