// constructors /////////////////////////////////////////////////////////////////////////// public FormStartOptimization(OptimizationFinishListener finishListener) { InitializeComponent(); InitDataSources(); setDataSources(); this.FinishListener = finishListener; // initialize fields this.Config = new OptimizationConfiguration(); this.Optimizer = new OptimizerProxy(); // set default values // model this.listBoxModelType.SelectedIndex = 0; this.buttonGoToEvaluator.Enabled = false; // evaluator this.listBoxEvaluator.SelectedIndex = 0; // stop condition this.listBoxStopConditions.SelectedIndex = 0; buttonGoToRecorder.Enabled = false; // recorder this.listBoxRecorderType.SelectedIndex = 0; buttonGoToAlgorithm.Enabled = false; // algorithm this.listBoxAlgorithm.SelectedIndex = 0; }
// constructors /////////////////////////////////////////////////////////////////////////// public FormOptimization(OptimizerProxy optimizer, String modelName, OptimizationFinishListener finishListener) { InitializeComponent(); this.FinishListener = finishListener; // turnoff all labels before the form is initialized comboBoxParam1.Enabled = false; buttonStop.Enabled = false; buttonSave.Enabled = false; // init fields this.IsFinished = true; // so that the window can be turned of in case of an error MutIsFinished = new Mutex(); this.Optimizer = optimizer; this.StateUpdateTimer = new Stopwatch(); StateUpdateTimer.Start(); this.OptiParams = new Dictionary <String, List <Double> >(); this.IsStateThreadRunning = true; this.FormClosing += FormOptimization_FormClosing; this.OptimizationTimer = new Stopwatch(); MutGraph = new Mutex(); this.ModelName = modelName; this.Text = Properties.Resources.CurrentOptimizationModel + ModelName; this.MethodFinishPerformed = false; this.MutMethodFinshPerformed = new Mutex(); }
private void buttonDisplayResult_Click(object sender, EventArgs e) { openFileDialogResultFile.ShowDialog(); String path = openFileDialogResultFile.FileName; if (!String.IsNullOrEmpty(path)) { OptimizerProxy optimizer = new OptimizerProxy(); OptimizationResult res = optimizer.ReadResult(path); if (res != null) { String[] pathSplitted = path.Split(Path.DirectorySeparatorChar); Form resultForm = new FormShowResult(res, pathSplitted[pathSplitted.Length - 1]); resultForm.ShowDialog(); } else { MessageBox.Show(Properties.Resources.CantReadResult); } openFileDialogResultFile.FileName = null; } }