lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Quintiq file version 2.0
#parent: #root
Method StartNewRunChecks (
  LibOpt_Optimizer optimizer,
  LibOpt_Run run
) as Boolean id:Method_LibOpt_GlobalState_StartNewRunChecks
{
  #keys: '[144996.0.1719791355]'
  Body:
  [*
    // The parameter optimizer or run can be used. Only one needs to be set.
    assert( not isnull( optimizer ) or not isnull( run ), 'not isnull( optimizer ) or not isnull( run )' );
    
    // Check if there are no runs currently running
    optimization := guard( optimizer.Optimization(), run.Optimization() );
    running := optimization.GetRunningRuns();
    running_check := running.Size() = 0
           or MessageBox::Question( this, Translations::LibOpt_Run_StartWithOtherRunning( running.Size() ), Translations::LibOpt_YesNo() ) = 0
    
    // Highlight runs that will be cleaned up
    cleanup_check := not running_check
           or this.CreateRunCleanupCheck( optimizer, run, 1 );
    
    return running_check and cleanup_check;
  *]
}