示例#1
0
        public void AddEdge(Edge edge)
        {
            var map = new Map();

            document.Transact((transaction) =>
            {
                edges.InsertFunc(edges.length, map, transaction);
                map.SetFunc("from", new ContentString(edge.Source), transaction);
                map.SetFunc("to", new ContentString(edge.Target), transaction);
            });
        }
示例#2
0
        public void AddNode(UINode node)
        {
            var map = new Map();

            document.Transact((transaction) =>
            {
                nodes.InsertFunc(nodes.length, map, transaction);
                map.SetFunc("x", new ContentBinary(BitConverter.GetBytes(node.Left)), transaction);
                map.SetFunc("y", new ContentBinary(BitConverter.GetBytes(node.Top)), transaction);
                var text = new Text();
                map.SetFunc("text", text, transaction);
            });
            SetNodeUpdateHandler(node, map);
        }