| Quintiq file version 2.0 | 
| #parent: #root | 
| Method InitializeDialog ( | 
|   Strategy lastusedstrategy | 
| ) id:Method_DialogRunOptimizer_InitializeDialog | 
| { | 
|   #keys: '[136682.0.2060597919]' | 
|   Body: | 
|   [* | 
|     // Set default values for components | 
|     run := MacroPlan.Optimization().GetLastRegularAlgorithmRun(); | 
|      | 
|     // Initialize dialog | 
|     DropDownListStrategy.Data( lastusedstrategy ); | 
|      | 
|     // Initialize dropdown puzzle | 
|     Form.InitializeDropdownPuzzle(); | 
|      | 
|     run := MacroPlan.Optimization().GetLastRegularAlgorithmRun(); | 
|     CheckboxOverrideManualPlan.Checked( guard( run.HasOverwrittenManualPlanning(), false ) ); | 
|      | 
|     // Initialize periods | 
|     // Set the default planning start and end | 
|     feedback := ''; | 
|     if( Period_MP::HasPeriod( feedback, MacroPlan ) ) | 
|     { | 
|       Form.SetDefaultPlanningStartAndEnd(); | 
|        | 
|       // Prevent the usage of last optimizer start if it is historical | 
|       if( not isnull( run ) | 
|           and MacroPlan.StartOfPlanningPeriod().Start() <= run.PeriodFirstStart() ) | 
|       { | 
|         // Using bound value is not working as expected | 
|         periodstart := select( MacroPlan, PlanningPeriod, p, p.Start() = run.PeriodFirstStart() ); | 
|         periodend := select( MacroPlan, PlanningPeriod, p, p.PeriodEnd() = run.PeriodLastEnd() ); | 
|         DropDownListPeriodsFrom.Data( periodstart ); | 
|         DropDownListPeriodsTo.Data( periodend ); | 
|       } | 
|     } | 
|      | 
|     Form.ShowPopup(); | 
|   *] | 
| } |