btnOK_Click
(
object sender,
System.EventArgs e
)
{
if ( !DoDataExchange(true) )
{
return;
}
if (m_oGraphMetricUserSettings.GraphMetricsToCalculate ==
GraphMetrics.None)
{
this.ShowWarning("No metrics have been selected.");
return;
}
// The IGraphMetricCalculator2 implementations read the
// GraphMetricUserSettings settings, so save them.
m_oGraphMetricUserSettings.Save();
if (m_eMode == DialogMode.EditOnly)
{
DialogResult = DialogResult.OK;
this.Close();
return;
}
// The CalculateGraphMetricsDialog does all the work. Use the
// constructor overload that uses a default list of graph metric
// calculators.
CalculateGraphMetricsDialog oCalculateGraphMetricsDialog =
new CalculateGraphMetricsDialog(null, m_oWorkbook);
if (oCalculateGraphMetricsDialog.ShowDialog() == DialogResult.OK)
{
if ( m_oGraphMetricUserSettings.ShouldCalculateGraphMetrics(
GraphMetrics.TopNBy) )
{
// The CalculateGraphMetricsDialog does not calculate top-N-by
// metrics by default, because those metrics can't always be
// calculated without first calculating other metrics and
// writing them to the workbook. Now that the other metrics
// have been calculated and written to the workbook, calculate
// the top-N-by metrics.
if ( !CalculateTopNByMetrics() )
{
return;
}
}
DialogResult = DialogResult.OK;
this.Close();
}
}