Quintiq file version 2.0
#parent: #root
Method InitializeDialog () id:Method_DialogCreateEditCampaign_InitializeDialog
{
  #keys: '[146302.1.856950260]'
  Body:
  [*
    // Initialize binding UI fields to dialog data, workaround to prevent values being reverted back
    data := DataHolderDialogData.Data(); 
    RadioButtonGroupQuantityDuration.BoundValue( CampaignType_MP::GetInputType( data.MinQuantity(), 
                                                                                data.HasInputMaxQuantity(), 
                                                                                data.MinDuration(), 
                                                                                data.HasInputMaxDuration() ) );
    // On initialize dialog, toggle max duration/qty
    this.EnableDisableMaxDuration( data.HasInputMaxDuration() );
    this.EnableDisableMaxQuantity( data.HasInputMaxQuantity() );
    
    // Workaround: Removed each component data binding due to dialog methods will calculate label 
    // which trigger data binding to revert back modified value to dialog data
    EditorCampaignMinQuantity.Text( ApplicationMacroPlanner.FormatRealToString( data.MinQuantity() ) );
    EditorCampaignMaxQuantity.Text( ApplicationMacroPlanner.FormatRealToString( data.MaxQuantity() ) );
    DurationSelectorMinDuration.Duration( data.MinDuration() );
    DurationSelectorMaxDuration.Duration( data.MaxDuration() );
    
    this.UpdateCheckboxState();
  *]
}
