Smrf.NodeXL.ExcelTemplate.TopNByMetricUserSettingsDialog.TopNByMetricUserSettingsDialog C# (CSharp) Method

TopNByMetricUserSettingsDialog() public method

Initializes a new instance of the class.
public TopNByMetricUserSettingsDialog ( TopNByMetricUserSettings topNByMetricUserSettings, Microsoft workbook ) : System
topNByMetricUserSettings TopNByMetricUserSettings /// The object being edited. ///
workbook Microsoft /// Workbook containing the graph contents. ///
return System
    public TopNByMetricUserSettingsDialog
    (
        TopNByMetricUserSettings topNByMetricUserSettings,
        Microsoft.Office.Interop.Excel.Workbook workbook
    )
    {
        Debug.Assert(topNByMetricUserSettings != null);
        Debug.Assert(workbook != null);

        m_oTopNByMetricUserSettings = topNByMetricUserSettings;
        m_oWorkbook = workbook;

        InitializeComponent();

        nudN.Minimum = TopNByMetricUserSettings.MinimumN;
        nudN.Maximum = TopNByMetricUserSettings.MaximumN;

        // This dialog is hard-coded for now to get only the top vertices from
        // the vertex worksheet.  It can be updated later to get the top items
        // from any worksheet later, if necessary.  If that is done,
        // TopNByMetrics.ToString() must also be updated.

        cbxWorksheetName.Items.Add(WorksheetNames.Vertices);
        cbxItemNameColumnName.Items.Add(VertexTableColumnNames.VertexName);

        ListObject oVertexTable;

        if ( ExcelTableUtil.TryGetTable(m_oWorkbook, WorksheetNames.Vertices,
            TableNames.Vertices, out oVertexTable) )
        {
            cbxRankedColumnName.PopulateWithTableColumnNames(oVertexTable);
        }

        // Instantiate an object that saves and retrieves the user settings for
        // this dialog.  Note that the object automatically saves the settings
        // when the form closes.

        m_oTopNByMetricUserSettingsDialogUserSettings =
            new TopNByMetricUserSettingsDialogUserSettings(this);

        DoDataExchange(false);

        AssertValid();
    }