コード例 #1
0
        void ISuperGraphRelationshipFactory.ConnectNodes(Node from, Node to)
        {
            var connectNodesOperation = new ConnectNodesOperation(MapManager);

            connectNodesOperation.From = from.Proxy;
            connectNodesOperation.To   = to.Proxy;
            connectNodesOperation.ExecuteOperation();
            var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();

            foreach (Proxy.IRelationship modelRelationship in connectNodesOperation.Response.Relationships)
            {
                var viewModelRelationship = new Relationship();
                viewModelRelationship.LoadRelationship(modelRelationship);
                modelChangedEventArgs.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship, ModelOperationType.New));
            }
            ModelChanged(this, modelChangedEventArgs);
        }
コード例 #2
0
        void ISuperGraphNodeFactory.AddLinkedNode(string nodeType, Point location, Node parent)
        {
            var mapNodeOperation = new AddNodeOperation(nodeType, MapManager, Context.Proxy, location);

            mapNodeOperation.ExecuteOperation();

            if (mapNodeOperation.Response.Nodes.Any())
            {
                var viewModelNode = new Node(MapManager);
                viewModelNode.LoadNode(null, mapNodeOperation.Response.Nodes.First());
                ThemeManager.DressNode(viewModelNode);

                viewModelNode.IsFocused = true;
                viewModelNode.VideoInfo = VideoController.CreateVideoInfoViewModel(viewModelNode);

                viewModelNode.PropertyChanged += ViewModelNode_PropertyChanged;
                viewModelNode.LocationChanged += ViewModelNode_LocationChanged;

                var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();
                modelChangedEventArgs.Nodes.Add(new KeyValuePair <Node, ModelOperationType>(viewModelNode, ModelOperationType.New));
                ModelChanged(this, modelChangedEventArgs);


                var connectNodesOperation = new ConnectNodesOperation(MapManager);
                connectNodesOperation.From = viewModelNode.Proxy;
                connectNodesOperation.To   = parent.Proxy;
                connectNodesOperation.ExecuteOperation();
                var relationshipModelCHangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();
                foreach (Proxy.IRelationship modelRelationship in connectNodesOperation.Response.Relationships)
                {
                    var viewModelRelationship = new Relationship();
                    viewModelRelationship.LoadRelationship(modelRelationship);
                    relationshipModelCHangedEventArgs.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship, ModelOperationType.New));
                }
                ModelChanged(this, relationshipModelCHangedEventArgs);
            }
        }