/// <summary>
 /// Gets the number of the page a node is contained in.
 /// </summary>
 /// <param name="node">The node to get the page number for.</param>
 /// <returns>The page number, or -1 if the node is not part of any page.</returns>
 private int GetPageNumber(INode node)
 {
     MultiPageIGraphBuilder.NodeData nodeData =
         GetCurrentGraph().MapperRegistry.GetMapper <INode, MultiPageIGraphBuilder.NodeData>(
             MultiPageIGraphBuilder.MapperKeyNodeData)[node];
     return(nodeData != null ? nodeData.PageNumber : -1);
 }
        /// <summary>
        /// "Jump" to a referencing node of a clicked auxiliary multi-page node.
        /// </summary>
        /// <param name="viewNode">The multi page node that has been clicked</param>
        private void GotoReferencingNode(INode viewNode)
        {
            IGraph graph = GetCurrentGraph();

            // get the ID of the referencing node
            MultiPageIGraphBuilder.NodeData nodeData = graph.MapperRegistry.GetMapper <INode, MultiPageIGraphBuilder.NodeData>(MultiPageIGraphBuilder.MapperKeyNodeData)[viewNode];
            if (nodeData != null && nodeData.IsReferenceNode)
            {
                var referencedNode = nodeData.ReferencedNode;
                if (referencedNode != null)
                {
                    int targetPage = GetPageNumber(referencedNode);
                    // open the page and center on the referencing node
                    if (IsPageNumberValid(targetPage))
                    {
                        SetPageNumber(targetPage, referencedNode);
                    }
                }
            }
        }