Example #1
0
        //*************************************************************************
        //  Constructor: CalculateGraphMetricsDialog()
        //
        /// <summary>
        /// Initializes a new instance of the <see
        /// cref="CalculateGraphMetricsDialog" /> class with a default list of
        /// graph metric calculators.
        /// </summary>
        ///
        /// <param name="graph">
        /// Graph to calculate the graph metrics for, or null.  If null, the graph
        /// is read from <paramref name="workbook" />.
        /// </param>
        ///
        /// <param name="workbook">
        /// Workbook where the graph metrics will get written.  If <paramref
        /// name="graph" /> is null, the graph is read from this workbook, too.
        /// </param>
        //*************************************************************************

        public CalculateGraphMetricsDialog
        (
            IGraph graph,
            Microsoft.Office.Interop.Excel.Workbook workbook
        )
        {
            InitializeComponent();

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

            m_oCalculateGraphMetricsDialogUserSettings =
                new CalculateGraphMetricsDialogUserSettings(this);

            m_oGraph    = graph;
            m_oWorkbook = workbook;
            m_oGraphMetricCalculators            = null;
            m_bActivateRelevantWorksheetWhenDone = true;

            m_oGraphMetricCalculationManager = new GraphMetricCalculationManager();

            m_oGraphMetricCalculationManager.GraphMetricCalculationProgressChanged
                += new ProgressChangedEventHandler(
                       GraphMetricCalculationManager_GraphMetricCalculationProgressChanged);

            m_oGraphMetricCalculationManager.GraphMetricCalculationCompleted +=
                new RunWorkerCompletedEventHandler(
                    GraphMetricCalculationManager_GraphMetricCalculationCompleted);

            DoDataExchange(false);

            // Assume that calculations will not succeed.

            this.DialogResult = DialogResult.Cancel;

            AssertValid();
        }
    //*************************************************************************
    //  Constructor: CalculateGraphMetricsDialog()
    //
    /// <summary>
    /// Initializes a new instance of the <see
    /// cref="CalculateGraphMetricsDialog" /> class with a default list of
    /// graph metric calculators.
    /// </summary>
    ///
    /// <param name="graph">
    /// Graph to calculate the graph metrics for, or null.  If null, the graph
    /// is read from <paramref name="workbook" />.
    /// </param>
    ///
    /// <param name="workbook">
    /// Workbook where the graph metrics will get written.  If <paramref
    /// name="graph" /> is null, the graph is read from this workbook, too.
    /// </param>
    //*************************************************************************

    public CalculateGraphMetricsDialog
    (
        IGraph graph,
        Microsoft.Office.Interop.Excel.Workbook workbook
    )
    {
        InitializeComponent();

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

        m_oCalculateGraphMetricsDialogUserSettings =
            new CalculateGraphMetricsDialogUserSettings(this);

        m_oGraph = graph;
        m_oWorkbook = workbook;
        m_oGraphMetricCalculators = null;
        m_bActivateRelevantWorksheetWhenDone = true;

        m_oGraphMetricCalculationManager = new GraphMetricCalculationManager();

        m_oGraphMetricCalculationManager.GraphMetricCalculationProgressChanged
            += new ProgressChangedEventHandler(
        GraphMetricCalculationManager_GraphMetricCalculationProgressChanged);

        m_oGraphMetricCalculationManager.GraphMetricCalculationCompleted +=
            new RunWorkerCompletedEventHandler(
                GraphMetricCalculationManager_GraphMetricCalculationCompleted);

        DoDataExchange(false);

        // Assume that calculations will not succeed.

        this.DialogResult = DialogResult.Cancel;

        AssertValid();
    }