| Quintiq file version 2.0 | 
| #parent: #root | 
| Method InitializeRecurrencePeriod ( | 
|   shadow[LibCal_RecurrencePeriod] sRecurrencePeriod_i | 
| ) id:Method_LibCal_dlgEvent_InitializeRecurrencePeriod | 
| { | 
|   #keys: '[131092.0.2141066155]' | 
|   Body: | 
|   [* | 
|     // Take over the existing period (if applicable) | 
|     if( not isnull( sRecurrencePeriod_i ) ) | 
|     { | 
|       dsStartOfPeriod.Date( sRecurrencePeriod_i.StartDate() ); | 
|       dhStartOfPeriod.Data( sRecurrencePeriod_i.StartDate() ); | 
|        | 
|       // NoEnd | 
|       if( sRecurrencePeriod_i.istype( shadow[LibCal_RecurrencePeriodWithoutEnd] ) ) | 
|       { | 
|         // Is already initialized | 
|       } | 
|      | 
|       // NrOfOccurrences | 
|       else if( sRecurrencePeriod_i.istype( shadow[LibCal_RecurrencePeriodNrOfOccurrences] ) ) | 
|       { | 
|         period := sRecurrencePeriod_i.astype( shadow[LibCal_RecurrencePeriodNrOfOccurrences] ); | 
|      | 
|         ckbNoEndDate.Checked( false ); | 
|         ckbEndAfter. Checked(  true ); | 
|      | 
|         edtNrOfOccurrences.Text( [String]period.NrOfOccurrences() ); | 
|       } | 
|        | 
|       // WithEndDate | 
|       else if( sRecurrencePeriod_i.istype( shadow[LibCal_RecurrencePeriodWithEndDate] ) ) | 
|       { | 
|         period := sRecurrencePeriod_i.astype( shadow[LibCal_RecurrencePeriodWithEndDate] ); | 
|      | 
|         ckbEndBy.Checked( true ); | 
|         dsEndOfPeriod.Date( period.EndDate() ); | 
|       } | 
|     } | 
|      | 
|     // Workaround for the fact that setting ckbEndOfPeriod.Checked() is not noticed during the first execution | 
|     // of response dsStartOfPeriod.OnChanged(). See method SetEndOfPeriod() of the dialog for more information. | 
|     lblWorkaround.Text( "initialized" ); | 
|      | 
|     this.InitializeDuration();  // Explicitly initialize the duration | 
|     this.SetEndOfPeriod(); | 
|   *] | 
| } |