void ShowOptimizer()
{
// Put the Strategy into the Undo Stack
Data.StackStrategy.Push(Data.Strategy.Clone());
Data.IsStrategyReady = false;
Optimizer optimizer = new Optimizer();
optimizer.SetParrentForm = this;
optimizer.ShowDialog();
if (optimizer.DialogResult == DialogResult.OK)
{ // We accept the optimized strategy
this.Text = Path.GetFileNameWithoutExtension(Data.StrategyName) + "* - " + Data.ProgramName;
Data.IsStrategyChanged = true;
RepaintStrategyLayout();
Calculate(true);
}
else
{ // When we cancel the optimizing, we return the original strategy.
UndoStrategy();
}
Data.IsStrategyReady = true;
}