當前位置: 首頁>>代碼示例>>C#>>正文


C# Schedule.zInternalGetEndDateBasedOnNumberOfOccurrences方法代碼示例

本文整理匯總了C#中ScheduleWidget.ScheduledEvents.Schedule.zInternalGetEndDateBasedOnNumberOfOccurrences方法的典型用法代碼示例。如果您正苦於以下問題:C# Schedule.zInternalGetEndDateBasedOnNumberOfOccurrences方法的具體用法?C# Schedule.zInternalGetEndDateBasedOnNumberOfOccurrences怎麽用?C# Schedule.zInternalGetEndDateBasedOnNumberOfOccurrences使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ScheduleWidget.ScheduledEvents.Schedule的用法示例。


在下文中一共展示了Schedule.zInternalGetEndDateBasedOnNumberOfOccurrences方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetEndDateWithNumberOfOccurrences

 /// <summary>
 /// SetEndDateWithNumberOfOccurrences,
 /// This will use the currently defined event schedule, to choose and set an
 /// EndDateTime that will limit the event to a fixed maximum number of occurrences.
 /// Calling this function will override any previously set EndDateTime.
 /// 
 /// All other desired event parameters should be set before this function is called.
 /// Previously set variables should include at minimum, a StartDateTime, and a Frequency.
 /// 
 /// The reason this sets a "maximum" number of occurrences, is that the number of 
 /// actual occurrences can be reduced by excluding occurrence dates from a Schedule 
 /// instance. Changing the exclusions will not change the EndDateTime.
 /// 
 /// The supplied maximumNumberOfOccurrences value is recorded for informational
 /// purposes only. Only the EndDateTime is used by the Event and Schedule calculations.
 /// 
 /// Setting this to null will clear the NumberOfOccurrencesThatWasLastSet variable, but will
 /// not change the EndDateTime value.
 /// </summary>
 public void SetEndDateWithNumberOfOccurrences(int? numberOfOccurrences)
 {
     // If the supplied parameter is null, clear the last set number of occurrences and return.
     if (numberOfOccurrences == null)
     {
         NumberOfOccurrencesThatWasLastSet = null;
         return;
     }
     // Validate the input parameters.
     if (numberOfOccurrences < 1)
         throw new Exception("SetEndDateTimeForMaximumNumberOfOccurrences(), " +
             "numberOfOccurrences cannot be less than one.");
     // Calculate and set the appropriate end date.
     Schedule schedule = new Schedule(this);
     EndDateTime = schedule.zInternalGetEndDateBasedOnNumberOfOccurrences((int)numberOfOccurrences);
     // Store the last set number of occurrences, for future reference by the user.
     NumberOfOccurrencesThatWasLastSet = numberOfOccurrences;
 }
開發者ID:Rachitman,項目名稱:ScheduleWidget,代碼行數:37,代碼來源:Event.cs


注:本文中的ScheduleWidget.ScheduledEvents.Schedule.zInternalGetEndDateBasedOnNumberOfOccurrences方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。