Exemplo n.º 1
0
        void ISuperGraphRelationshipFactory.ConnectMultipleTranscludedNodes(List <Relationship> relationships, List <Node> fullNodes, INode map)
        {
            if (relationships.Any())
            {
                var modelChangedEventArgs        = new ModelChangedEventArgs <Node, Relationship>();
                var batchTransclusionConnections = new BatchConnectTranscludedNodesOperation(MapManager);
                foreach (var viewModelRelationship in relationships)
                {
                    var from = fullNodes.FirstOrDefault(q => q.Id == viewModelRelationship.From);
                    var to   = fullNodes.FirstOrDefault(q => q.Id == viewModelRelationship.To);

                    if (from != null && to != null)
                    {
                        var operation = new ConnectTranscludedNodesOperation(MapManager);
                        operation.Context = Context.Proxy;
                        operation.From    = from.Proxy;
                        operation.To      = to.Proxy;

                        batchTransclusionConnections.AddConnectTranscludedNodesOperation(operation);
                    }

                    if (viewModelRelationship.Proxy.RelationshipType != viewModelRelationship.Proxy.MapManager.RelationshipTypes["MapContainerRelationship"])
                    {
                        modelChangedEventArgs.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship, ModelOperationType.New));
                    }
                }
                batchTransclusionConnections.ExecuteOperation();
                ModelChanged(this, modelChangedEventArgs);
            }
        }
Exemplo n.º 2
0
        void ISuperGraphRelationshipFactory.ConnectTranscludedNodes(Node from, Node to)
        {
            var connectTranscludedNodesOperation = new ConnectTranscludedNodesOperation(MapManager);

            connectTranscludedNodesOperation.Context = Context.Proxy;
            connectTranscludedNodesOperation.From    = from.Proxy;
            connectTranscludedNodesOperation.To      = to.Proxy;
            connectTranscludedNodesOperation.ExecuteOperation();
            foreach (Proxy.IRelationship modelRelationship in connectTranscludedNodesOperation.Response.Relationships)
            {
                var viewModelRelationship = new Relationship();
                viewModelRelationship.LoadRelationship(modelRelationship);

                var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();
                modelChangedEventArgs.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship, ModelOperationType.New));

                ModelChanged(this, modelChangedEventArgs);
            }
        }