Stores attributes that describe how a graph was created.
The attributes are stored as key/value pairs in a dictionary, where the keys and values are strings. All the key/value pairs are optional and may be missing from the dictionary.

The entire collection of attributes can be saved to a single delimited string using PersistableStringDictionary.ToString, and the collection can be restored from the delimited string using .

Inheritance: PersistableStringDictionary
示例#1
0
        CreateGraphTitle
        (
            Microsoft.Office.Interop.Excel.Workbook workbook
        )
        {
            Debug.Assert(workbook != null);

            GraphHistory oGraphHistory =
                (new PerWorkbookSettings(workbook)).GraphHistory;

            String sGraphTitle;

            // Order of precedence: suggested title, suggested file name,
            // workbook name.

            if (
                !oGraphHistory.TryGetValue(
                    GraphHistoryKeys.ImportSuggestedTitle,
                    out sGraphTitle)
                &&
                !oGraphHistory.TryGetValue(
                    GraphHistoryKeys.ImportSuggestedFileNameNoExtension,
                    out sGraphTitle)
                )
            {
                Debug.Assert(!String.IsNullOrEmpty(workbook.Name));

                sGraphTitle = workbook.Name;
            }

            return(sGraphTitle);
        }
示例#2
0
        btnClear_Click
        (
            object sender,
            System.EventArgs e
        )
        {
            AssertValid();

            m_oGraphHistory            = new GraphHistory();
            m_oAutoFillWorkbookResults = new AutoFillWorkbookResults();
            DoDataExchange(false);
        }
    FromString
    (
        String attributes
    )
    {
        Debug.Assert(attributes != null);

        GraphHistory oGraphHistory = new GraphHistory();

        PopulateDictionary(oGraphHistory, attributes);

        return (oGraphHistory);
    }
示例#4
0
        FromString
        (
            String attributes
        )
        {
            Debug.Assert(attributes != null);

            GraphHistory oGraphHistory = new GraphHistory();

            PopulateDictionary(oGraphHistory, attributes);

            return(oGraphHistory);
        }
        SetGraphHistoryValue
        (
            String graphHistoryKey,
            String graphHistoryValue
        )
        {
            Debug.Assert(!String.IsNullOrEmpty(graphHistoryKey));
            AssertValid();

            GraphHistory oGraphHistory = this.GraphHistory;

            oGraphHistory[graphHistoryKey] = graphHistoryValue;
            this.GraphHistory = oGraphHistory;
        }
        ClearGraphHistory()
        {
            AssertValid();

            // Clear everything except the comments, if there are any.

            GraphHistory oNewGraphHistory = new GraphHistory();

            String sComments;

            if (this.GraphHistory.TryGetValue(GraphHistoryKeys.Comments,
                                              out sComments))
            {
                oNewGraphHistory[GraphHistoryKeys.Comments] = sComments;
            }

            this.GraphHistory = oNewGraphHistory;
        }
示例#7
0
        SummarizeGraphInternal
        (
            GraphHistory oGraphHistory,
            AutoFillWorkbookResults oAutoFillWorkbookResults,
            OverallMetrics oOverallMetrics,
            String oTopNByMetrics,
            String oTwitterSearchNetworkTopItems
        )
        {
            Debug.Assert(oGraphHistory != null);
            Debug.Assert(oAutoFillWorkbookResults != null);

            StringBuilder oStringBuilder = new StringBuilder();

            AppendGraphHistoryValues(oGraphHistory, oStringBuilder,
                                     GraphHistoryKeys.ImportDescription,
                                     GraphHistoryKeys.GraphDirectedness,
                                     GraphHistoryKeys.GroupingDescription,
                                     GraphHistoryKeys.LayoutAlgorithm
                                     );

            StringUtil.AppendLineAfterEmptyLine(oStringBuilder,
                                                oAutoFillWorkbookResults.ConvertToSummaryString());

            if (oOverallMetrics != null)
            {
                StringUtil.AppendLineAfterEmptyLine(oStringBuilder,
                                                    "Overall Graph Metrics:");

                oStringBuilder.AppendLine(
                    oOverallMetrics.ConvertToSummaryString());
            }

            StringUtil.AppendLineAfterEmptyLine(oStringBuilder, oTopNByMetrics);

            StringUtil.AppendLineAfterEmptyLine(oStringBuilder,
                                                oTwitterSearchNetworkTopItems);

            AppendGraphHistoryValues(oGraphHistory, oStringBuilder,
                                     GraphHistoryKeys.Comments
                                     );

            return(oStringBuilder.ToString());
        }
示例#8
0
        TrySummarizeGraph
        (
            GraphHistory graphHistory,
            AutoFillWorkbookResults autoFillWorkbookResults,
            OverallMetrics overallMetrics,
            String topNByMetrics,
            String twitterSearchNetworkTopItems,
            out String graphSummary
        )
        {
            Debug.Assert(graphHistory != null);
            Debug.Assert(autoFillWorkbookResults != null);

            graphSummary = SummarizeGraphInternal(graphHistory,
                                                  autoFillWorkbookResults, overallMetrics, topNByMetrics,
                                                  twitterSearchNetworkTopItems);

            return(graphSummary.Length > 0);
        }
示例#9
0
        AppendGraphHistoryValues
        (
            GraphHistory oGraphHistory,
            StringBuilder oStringBuilder,
            params String [] asGraphHistoryKeys
        )
        {
            Debug.Assert(oGraphHistory != null);
            Debug.Assert(oStringBuilder != null);
            Debug.Assert(asGraphHistoryKeys != null);

            String sGraphHistoryValue;

            foreach (String sGraphHistoryKey in asGraphHistoryKeys)
            {
                if (oGraphHistory.TryGetValue(sGraphHistoryKey,
                                              out sGraphHistoryValue))
                {
                    StringUtil.AppendLineAfterEmptyLine(oStringBuilder,
                                                        sGraphHistoryValue);
                }
            }
        }
    AppendGraphHistoryValues
    (
        GraphHistory oGraphHistory,
        StringBuilder oStringBuilder,
        params String [] asGraphHistoryKeys
    )
    {
        Debug.Assert(oGraphHistory != null);
        Debug.Assert(oStringBuilder != null);
        Debug.Assert(asGraphHistoryKeys != null);

        String sGraphHistoryValue;

        foreach (String sGraphHistoryKey in asGraphHistoryKeys)
        {
            if ( oGraphHistory.TryGetValue(sGraphHistoryKey,
                out sGraphHistoryValue) )
            {
                StringUtil.AppendLineAfterEmptyLine(oStringBuilder,
                    sGraphHistoryValue);
            }
        }
    }
    SummarizeGraphInternal
    (
        GraphHistory oGraphHistory,
        AutoFillWorkbookResults oAutoFillWorkbookResults,
        OverallMetrics oOverallMetrics,
        String oTopNByMetrics,
        String oTwitterSearchNetworkTopItems
    )
    {
        Debug.Assert(oGraphHistory != null);
        Debug.Assert(oAutoFillWorkbookResults != null);

        StringBuilder oStringBuilder = new StringBuilder();

        AppendGraphHistoryValues(oGraphHistory, oStringBuilder,
            GraphHistoryKeys.ImportDescription,
            GraphHistoryKeys.GraphDirectedness,
            GraphHistoryKeys.GroupingDescription,
            GraphHistoryKeys.LayoutAlgorithm
            );

        StringUtil.AppendLineAfterEmptyLine( oStringBuilder,
            oAutoFillWorkbookResults.ConvertToSummaryString() );

        if (oOverallMetrics != null)
        {
            StringUtil.AppendLineAfterEmptyLine(oStringBuilder,
                "Overall Graph Metrics:");

            oStringBuilder.AppendLine(
                oOverallMetrics.ConvertToSummaryString() );
        }

        StringUtil.AppendLineAfterEmptyLine(oStringBuilder, oTopNByMetrics);

        StringUtil.AppendLineAfterEmptyLine(oStringBuilder,
            oTwitterSearchNetworkTopItems);

        AppendGraphHistoryValues(oGraphHistory, oStringBuilder,
            GraphHistoryKeys.Comments
            );

        return ( oStringBuilder.ToString() );
    }
    TrySummarizeGraph
    (
        GraphHistory graphHistory,
        AutoFillWorkbookResults autoFillWorkbookResults,
        OverallMetrics overallMetrics,
        String topNByMetrics,
        String twitterSearchNetworkTopItems,
        out String graphSummary
    )
    {
        Debug.Assert(graphHistory != null);
        Debug.Assert(autoFillWorkbookResults != null);

        graphSummary = SummarizeGraphInternal(graphHistory,
            autoFillWorkbookResults, overallMetrics, topNByMetrics,
            twitterSearchNetworkTopItems);

        return ( ShowWarningIfNoGraphSummary(graphSummary) );
    }
    //*************************************************************************
    //  Constructor: TwitterSearchNetworkTopItemsCalculator2()
    //
    /// <summary>
    /// Initializes a new instance of the <see
    /// cref="TwitterSearchNetworkTopItemsCalculator2" /> class.
    /// </summary>
    ///
    /// <param name="graphHistory">
    /// Describes how the graph was created.
    /// </param>
    //*************************************************************************

    public TwitterSearchNetworkTopItemsCalculator2
    (
        GraphHistory graphHistory
    )
    {
        m_oGraphHistory = graphHistory;
        m_oTwitterStatusTextParser = new TwitterStatusTextParser();

        AssertValid();
    }
    ClearGraphHistory()
    {
        AssertValid();

        // Clear everything except the comments, if there are any.

        GraphHistory oNewGraphHistory = new GraphHistory();

        String sComments;
        
        if ( this.GraphHistory.TryGetValue(GraphHistoryKeys.Comments,
            out sComments) )
        {
            oNewGraphHistory[GraphHistoryKeys.Comments] = sComments;
        }

        this.GraphHistory = oNewGraphHistory;
    }
    SetGraphHistoryValue
    (
        String graphHistoryKey,
        String graphHistoryValue
    )
    {
        Debug.Assert( !String.IsNullOrEmpty(graphHistoryKey) );
        AssertValid();

        GraphHistory oGraphHistory = this.GraphHistory;
        oGraphHistory[graphHistoryKey] = graphHistoryValue;
        this.GraphHistory = oGraphHistory;
    }
    btnClear_Click
    (
        object sender,
        System.EventArgs e
    )
    {
        AssertValid();

        m_oGraphHistory = new GraphHistory();
        m_oAutoFillWorkbookResults = new AutoFillWorkbookResults();
        DoDataExchange(false);
    }