示例#1
0
        void ISuperGraphNodeFactory.DeleteNode(Node viewModelNode)
        {
            var deleteNodeOperation = new DeleteNodeOperation(viewModelNode, MapManager);

            deleteNodeOperation.ExecuteOperation();
            var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();

            modelChangedEventArgs.Nodes.Add(new KeyValuePair <Node, ModelOperationType>(viewModelNode, ModelOperationType.Deleted));
            ModelChanged(this, modelChangedEventArgs);
        }
示例#2
0
        void ISuperGraphRelationshipFactory.DeleteNodes(List <Node> nodes, INode map, bool isSameMap)
        {
            if (nodes.Any())
            {
                var batchTransclusionDeletions = new BatchDeleteNodesOperation(MapManager);

                foreach (var node in nodes)
                {
                    batchTransclusionDeletions.Nodes.Add(new KeyValuePair <Node, ModelOperationType>(node, ModelOperationType.Deleted));

                    if (node.IsTranscluded && node.NumTranclusions > 1)
                    {
                        var deleteTranscludedNodesOperation = new DeleteTranscludedNodeOperation(MapManager);
                        deleteTranscludedNodesOperation.Context = map.Proxy;
                        deleteTranscludedNodesOperation.Node    = node.Proxy;

                        batchTransclusionDeletions.AddDeleteNodeOperation(deleteTranscludedNodesOperation);
                    }
                    else
                    {
                        var deleteNodesOperation = new DeleteNodeOperation(node, MapManager);

                        batchTransclusionDeletions.AddDeleteNodeOperation(deleteNodesOperation);
                    }
                }

                batchTransclusionDeletions.ExecuteOperation();
                if (isSameMap)
                {
                    var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();
                    var response = batchTransclusionDeletions.Response;
                    modelChangedEventArgs.Nodes = batchTransclusionDeletions.Nodes;
                    foreach (Proxy.IRelationship modelRelationship in response.Relationships)
                    {
                        var viewModelRelationship = new Relationship();
                        viewModelRelationship.LoadRelationship(modelRelationship);

                        modelChangedEventArgs.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship, ModelOperationType.Deleted));
                    }
                    ModelChanged(this, modelChangedEventArgs);
                }
            }
        }