Quintiq file version 2.0
#parent: #root
Response OnCreated () id:Response_ApplicationLibMacroPlanner_OnCreated
{
  #keys: '[11660.0.19434954]'
  Body:
  [*
    // Update application title.
    this.SelectScenarioManager();
    LabelPeriodRollStatus.Visible( [Boolean] ValueHolderPeriodRollStatus.Value() );
    
    if( not isnull( ScenarioManager ) )
    {                                            
      if( not isnull( MacroPlan ) )
      {                                                    
        // Check that current scenario is created by current user
        // or is authorized for the current user
        scenario := select( ScenarioManager,
                            ScenarioNode.astype( Scenario ),
                            node,
                            node.DatasetMDSID() = MacroPlan.MDSID()
                            and this.IsAuthorizedScenario( node ) )
        if ( isnull( scenario ) )
        {
    
          // false, deselect current scenario and select something else
          this.DeselectScenario( null( internal[GUIComponent] ), MacroPlan );
    
          scenario := select( ScenarioManager,
                              ScenarioNode.astype( Scenario ),
                              node,
                              this.IsAuthorizedScenario( node ) )
        }
        ApplicationLibMacroPlanner.SelectScenario( scenario );    
      }
    
      if( ScenarioManager.ScenarioMP( relsize ) = 0 )
      {
        // Create and launch start-up wizard
        ApplicationLibMacroPlanner.LaunchStartUpWizard();
      } 
    }
    
    ApplicationLibMacroPlanner.EnableWorkflow( guard( SWF_WorkflowDataset.IsWorkflowEnabled(), false ) );
    
    // Configure menus, hide menus with all of their submenus hidden due to functionalities
    if( not isnull( MPDomainHandler ) )
    {
      this.ConfigureMenus();
    }
    
    // Select default representation MacroPlanner instead of Global
    Application.RepresentationManager().SelectRepresentation( "MacroPlanner" );
  *]
  DefinitionID: 'Responsedef_GUIComponent_OnCreated'
  UserRequiresReadWrite: true
}
