private void btnMetrics_Click(object sender, RoutedEventArgs e) { MetricPanel metricPanel = new MetricPanel(); metricPanel.SetMetricSliderValues(simSettings); // Setting the metric values to what's on the simulation settings bool?result = metricPanel.ShowDialog(); if (result.HasValue && result.Value == true) { // Set the simulation setting values for metrics from the metric panel simSettings.Metric1 = metricPanel.Metric1; simSettings.Metric2 = metricPanel.Metric2; simSettings.Metric3 = metricPanel.Metric3; simSettings.Metric4 = metricPanel.Metric4; simSettings.Metric5 = metricPanel.Metric5; } }
private void showCriteriaSettingsDialog() { MetricPanel metricPanel = new MetricPanel(); metricPanel.SetMetricSliderValues(simSettings); // Setting the metric values to what's on the simulation settings metricPanel.Closing += (s, e) => { if (metricPanel.DialogResult == null) { bool yesSelected = MessageBox.Show("Closing this dialog box will use the default criteria.", "", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes; if (yesSelected) { startOptimizing(); } else { e.Cancel = true; } } }; metricPanel.Top = this.Top + 60; metricPanel.Left = this.Left + ((this.Width / 2) - (metricPanel.Width / 2)); bool?result = metricPanel.ShowDialog(); if (result.HasValue && result.Value == true) { // Set the simulation setting values for metrics from the metric panel simSettings.Metric1 = metricPanel.Metric1; simSettings.Metric2 = metricPanel.Metric2; simSettings.Metric3 = metricPanel.Metric3; simSettings.Metric4 = metricPanel.Metric4; simSettings.Metric5 = metricPanel.Metric5; //btnRun_Click(null, null); startOptimizing(); } }