Esempio n. 1
0
        //*************************************************************************
        //  Constructor: TopNByMetricUserSettingsDialog()
        //
        /// <summary>
        /// Initializes a new instance of the <see
        /// cref="TopNByMetricUserSettingsDialog" /> class.
        /// </summary>
        ///
        /// <param name="topNByMetricUserSettings">
        /// The object being edited.
        /// </param>
        ///
        /// <param name="workbook">
        /// Workbook containing the graph contents.
        /// </param>
        //*************************************************************************

        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();
        }
    //*************************************************************************
    //  Constructor: TopNByMetricUserSettingsDialog()
    //
    /// <summary>
    /// Initializes a new instance of the <see
    /// cref="TopNByMetricUserSettingsDialog" /> class.
    /// </summary>
    ///
    /// <param name="topNByMetricUserSettings">
    /// The object being edited.
    /// </param>
    ///
    /// <param name="workbook">
    /// Workbook containing the graph contents.
    /// </param>
    //*************************************************************************

    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();
    }