Smrf.NodeXL.GraphMLLib.TwitterSearchNetworkGraphMLUtil.AppendVertexTooltipXmlNodes C# (CSharp) Method

AppendVertexTooltipXmlNodes() public static method

public static AppendVertexTooltipXmlNodes ( GraphMLXmlDocument graphMLXmlDocument, TwitterUser>.Dictionary userIDDictionary ) : void
graphMLXmlDocument Smrf.XmlLib.GraphMLXmlDocument
userIDDictionary TwitterUser>.Dictionary
return void
    AppendVertexTooltipXmlNodes
    (
        GraphMLXmlDocument graphMLXmlDocument,
        Dictionary<String, TwitterUser> userIDDictionary
    )
    {
        Debug.Assert(graphMLXmlDocument != null);
        Debug.Assert(userIDDictionary != null);

        foreach (TwitterUser twitterUser in userIDDictionary.Values)
        {
            // The tooltip is the user's screen name followed by the first
            // tweet returned by Twitter.

            ICollection<TwitterStatus> statuses = twitterUser.Statuses;

            String firstStatus = statuses.Count > 0 ?
                statuses.First().Text : String.Empty;

            // The Excel template doesn't wrap long tooltip text.  Break the
            // status into lines so the entire tooltip will show in the graph
            // pane.

            firstStatus = StringUtil.BreakIntoLines(firstStatus, 30);

            String toolTip = String.Format(
                "{0}\n\n{1}"
                ,
                twitterUser.ScreenName,
                firstStatus
                );

            graphMLXmlDocument.AppendGraphMLAttributeValue(
                twitterUser.VertexXmlNode, VertexToolTipID, toolTip);
        }
    }