• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Occurrence类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Occurrence的典型用法代码示例。如果您正苦于以下问题:C# Occurrence类的具体用法?C# Occurrence怎么用?C# Occurrence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Occurrence类属于命名空间,在下文中一共展示了Occurrence类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Group

 public Group(Group parent)
 {
     Parent = parent;
     Members = new ArrayList();
     this.GroupType = GroupType.None;
     Occurrence = Occurrence.Required;
 }
开发者ID:NoobSkie,项目名称:taobao-shop-helper,代码行数:7,代码来源:Group.cs


示例2: Group

 /// <summary>
 ///   Initialises a new Content Model Group.
 /// </summary>
 /// <param name = "parent">The parent model group.</param>
 public Group(Group parent)
 {
     m_parent = parent;
     Members = new ArrayList();
     m_groupType = GroupType.None;
     m_occurrence = Occurrence.Required;
 }
开发者ID:virmitio,项目名称:devtools,代码行数:11,代码来源:Group.cs


示例3: CheckAllOccurrencesDestinationSlots

        private bool CheckAllOccurrencesDestinationSlots(Occurrence currentOccurrence, Slot currentDestinationSlot, Occurrence editedOccurrence)
        {
            var currentApp = currentOccurrence.Appointment as Appointment;

            var offsetOfTheOccurrence = currentApp.Start - currentOccurrence.Start;
            var destSlotOfMasterApp = OffsetSlot(currentDestinationSlot, offsetOfTheOccurrence);

            var occurrences = currentApp.GetOccurrences(scheduleView.VisibleRange.Start, scheduleView.VisibleRange.End);

            destinationSlot = null;
            foreach (var occ in occurrences)
            {
                var occurrenceDestinationSlot = OffsetSlot(destSlotOfMasterApp, occ.Start - currentApp.Start);

                var appsInOccurrenceDestinationSlot = scheduleView.AppointmentsSource
                    .OfType<IAppointment>()
                    .Where((IAppointment a) => a != occ.Appointment)
                    .All((IAppointment a) => !ConflictChecking.AreOverlapping(a, occurrenceDestinationSlot, editedOccurrence));

                if (!appsInOccurrenceDestinationSlot)
                {
                    ShowErrorWindow();
                    return true;
                }
            }

            return false;
        }
开发者ID:NathanEWhitaker,项目名称:xaml-sdk,代码行数:28,代码来源:Example.xaml.cs


示例4: Group

 /// <summary>
 /// Initializes a new Content Model Group.
 /// </summary>
 /// <param name="parent">The parent model group.</param>
 public Group(Group parent)
 {
     _parent = parent;
     _members = new ArrayList();
     _type = GroupType.None;
     _occurrence = Occurrence.Required;
 }
开发者ID:radischevo,项目名称:Radischevo.Wahha,代码行数:11,代码来源:Group.cs


示例5: AreOverlapping

        public static bool AreOverlapping(IAppointment appointment, Slot slot, Occurrence draggedOccurrence)
        {
            //check whether the dragged appointment goes over an appointment or an occurrence
            if (appointment.RecurrenceRule == null)
                return (appointment.IntersectsWith(slot) && AreIntersected(appointment.Resources.OfType<IResource>(), slot.Resources.OfType<IResource>()));
            else
                return CheckOccurrences(appointment, slot, draggedOccurrence);

        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:9,代码来源:ConflictCheckingDragDropBehavior.cs


示例6: CheckOccurrences

 public static bool CheckOccurrences(IAppointment app, Slot slot, Occurrence draggedOccurrence)
 {
     var occurrences = app.GetOccurrences(slot.Start, slot.End).Where(p => !p.Equals(draggedOccurrence));
     var realOccurrences = new List<Occurrence>();
     foreach (var occ in occurrences)
     {
         if (occurrences != null)
         {
             if (occ.IntersectsWith(slot) && AreIntersected(occ.Appointment.Resources.OfType<IResource>(), slot.Resources.OfType<IResource>()))
             {
                 realOccurrences.Add(occ);
             }
         }
     }
     return realOccurrences.Count() > 0;
 }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:16,代码来源:ConflictCheckingDragDropBehavior.cs


示例7: GetEventString

        private string GetEventString(Occurrence o, IEvent evt)
        {
            // Get a string that represents our event
            string summary = o.Period.StartTime.ToString("d") + " - " + evt.Summary;
            if (evt.IsAllDay)
                summary += " (All Day)";
            else
            {
                string startTime = _ConvertToLocalTime ?
                    o.Period.StartTime.Local.ToString("t") :
                    o.Period.StartTime.ToString("t") + " " + o.Period.StartTime.TimeZoneName;
                string endTime = _ConvertToLocalTime ?
                    o.Period.EndTime.Local.ToString("t") :
                    o.Period.EndTime.ToString("t") + " " + o.Period.EndTime.TimeZoneName;

                summary += " (" + startTime + " to " + endTime + ")";
            }

            return summary;
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:20,代码来源:Schedule.cs


示例8: Task

 /// <summary>
 /// Creates a new task for the <see cref="TaskScheduler"/> with a time-based <see cref="Schedule"/>.
 /// </summary>
 /// <param name="owner">specifies the owner of this task.</param>
 /// <param name="minute">specifies at which minute this task should run (-1 = every minute).</param>
 /// <param name="hour">specifies at which hour this task should run (-1 = every hour).</param>
 /// <param name="day">specifies at which day of the week this task should run (-1 = every day).</param>
 /// <param name="occurrence">specifies when the task's schedule should occur.</param>
 /// <param name="expires">specifies when the task's schedule should expire.</param>
 /// <param name="forceRun">specifies whether a schedule should be triggered forcefully in case system was down when schedule was due (true).</param>
 /// <param name="wakeup">specifies whether the system should be woken up from standby for this task's schedule (false).</param>
 public Task(string owner, int minute, int hour, int day, Occurrence occurrence, DateTime expires, bool forceRun, bool wakeup)
 {
   _owner = owner;
   _schedule.Minute = minute;
   _schedule.Hour = hour;
   _schedule.Day = day;
   _schedule.Type = ScheduleType.TimeBased;
   _occurrence = occurrence;
   _expires = expires;
   _forceRun = forceRun;
   if (wakeup && (occurrence == Occurrence.EveryStartUp || occurrence == Occurrence.EveryWakeUp))
     throw new ArgumentException("wakeup setting cannot be used together with Occurrence " + _occurrence);
   _wakeup = wakeup;
 }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:25,代码来源:Task.cs


示例9: GetOccurrences

        /// <summary>
        /// Gets the occurrences.
        /// </summary>
        /// <param name="startTime">The start time.</param>
        /// <param name="endTime">The end time.</param>
        /// <remarks> Вычисляет все экземпляры рекурсивного события в соотв с паттерном рекурсии. С учетом exception event.
        /// </remarks>
        /// <returns></returns>
        public override List<Occurrence> GetOccurrences(iCalDateTime startTime, iCalDateTime endTime)
        {
            //Очищаем кеш повторений
            ClearEvaluation();

            List<Occurrence> retVal = base.GetOccurrences(startTime, endTime);

            if(RecurrenceException != null)
            {
                foreach (McEvent exception in RecurrenceException)
                {
                    if (exception.Recurrence_ID != null)
                    {
                        //Start = RecurrenceId, Duration = Parent event duration
                        Occurrence exceptionOccur = new Occurrence(null, new Period(exception.Recurrence_ID, this.Duration));
                        //remove exception from orig occurrences list
                        if (retVal.Contains(exceptionOccur))
                        {
                            retVal.Remove(exceptionOccur);
                        }
                    }
                }
            }
            return retVal;
        }
开发者ID:0anion0,项目名称:IBN,代码行数:33,代码来源:McEvent.cs


示例10: GetOccurrenceText

 /// <summary>
 /// Gets the occurrence text.
 /// </summary>
 /// <param name="occurrence">The occurrence.</param>
 /// <returns></returns>
 private static string GetOccurrenceText( Occurrence occurrence )
 {
     string occurrenceText = string.Empty;
     if ( occurrence.Period.Duration <= new TimeSpan( 0, 0, 1 ) )
     {
         // no or very short duration. Probably a schedule for starting something that doesn't care about duration, like Metrics
         occurrenceText = string.Format( "{0}", occurrence.Period.StartTime.Value.ToString( "g" ) );
     }
     else if ( occurrence.Period.StartTime.Value.Date.Equals( occurrence.Period.EndTime.Value.Date ) )
     {
         // same day for start and end time
         occurrenceText = string.Format( "{0} - {1} to {2} ( {3} hours) ", occurrence.Period.StartTime.Value.Date.ToShortDateString(), occurrence.Period.StartTime.Value.TimeOfDay.ToTimeString(), occurrence.Period.EndTime.Value.TimeOfDay.ToTimeString(), occurrence.Period.Duration.TotalHours.ToString( "#0.00" ) );
     }
     else
     {
         // spans over midnight
         occurrenceText = string.Format( "{0} to {1} ( {2} hours) ", occurrence.Period.StartTime.Value.ToString( "g" ), occurrence.Period.EndTime.Value.ToString( "g" ), occurrence.Period.Duration.TotalHours.ToString( "#0.00" ) );
     }
     return occurrenceText;
 }
开发者ID:Higherbound,项目名称:Higherbound-2016-website-upgrades,代码行数:25,代码来源:ScheduleDetail.ascx.cs


示例11: WriteOccurrence

        public virtual void WriteOccurrence(Occurrence toSave)
        {
            var lines = new[]{toSave.AsWriteable() };

            Paths.AppendAllLines(this.OccurrencesPath,lines);
        }
开发者ID:tophrchris,项目名称:Routinely,代码行数:6,代码来源:CSVDataProvider.cs


示例12: IsOccurrenceOf

        public static bool IsOccurrenceOf(this DateTime date, DayOfWeek day, Occurrence occurrence)
        {
            if (day != date.DayOfWeek)
            {
                return false;
            }

            try
            {
                var compare = date.AddMonths(-1).GetOccurrenceOfNextMonth(day, occurrence);
                return compare.Date == date.Date;
            }
            catch
            {
                return false;
            }
        }
开发者ID:RichardAllanBrown,项目名称:ShinyDate,代码行数:17,代码来源:ShinyDate.cs


示例13: Group

        public Group(Group parent)
        {
            Parent = parent;
            this.GroupType = GroupType.None;
            Occurrence = Occurrence.Required;

            this.members = new ArrayList();
            this.symbols = new Set<string>();
        }
开发者ID:Gremlin2,项目名称:Fb2Fix,代码行数:9,代码来源:SgmlParser.cs


示例14: GetOccurrenceOfNextMonth

        public static DateTime GetOccurrenceOfNextMonth(this DateTime from, DayOfWeek day, Occurrence occurrence)
        {
            DateTime relevantMonthEnd;

            if (occurrence > 0)
            {
                relevantMonthEnd = from.GetFirstOfNextMonth(day);
                occurrence -= 1;
            }
            else
            {
                relevantMonthEnd = from.GetLastOfNextMonth(day);
                occurrence += 1;
            }

            MonthOfYear monthToScan = relevantMonthEnd.MonthOfYear();
            DateTime foundDate = relevantMonthEnd.AddWeeks((int)occurrence);

            if (foundDate.MonthOfYear() == monthToScan)
            {
                return foundDate;
            }

            string errorMessage = String.Format("Cannot get the {0} {1} of {2}", occurrence, day, monthToScan);
            throw new ArgumentOutOfRangeException(errorMessage);
        }
开发者ID:RichardAllanBrown,项目名称:ShinyDate,代码行数:26,代码来源:ShinyDate.cs


示例15: GetNearestOccurrence

        public static DateTime GetNearestOccurrence(this DateTime from, DayOfWeek day, Occurrence occurrence)
        {
            var nextSuitableDate = from.GetOccurrenceOfNextMonth(day, occurrence);
            var previousSuitableDate = from.AddMonths(-1).GetOccurrenceOfNextMonth(day, occurrence);

            return CalculateClosest(previousSuitableDate, from, nextSuitableDate);
        }
开发者ID:RichardAllanBrown,项目名称:ShinyDate,代码行数:7,代码来源:ShinyDate.cs


示例16: WriteOccurrence

 public void WriteOccurrence(Occurrence toSave)
 {
     foreach (var provider in Providers)
         provider.WriteOccurrence (toSave);
 }
开发者ID:tophrchris,项目名称:Routinely,代码行数:5,代码来源:CompositeCheckPointDataProvider.cs


示例17: UnparseOccurrence

		internal static String UnparseOccurrence(Occurrence o)
		{
			String result = String.Empty;
			switch(o)
			{
				case Occurrence.Prefix: result = "prefix"; break;
				case Occurrence.Infix: result = "infix"; break;
				case Occurrence.Postfix: result = "postfix"; break;
				case Occurrence.FunctionModel: result = "function-model"; break;
			}
			return result;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:12,代码来源:Utility.cs


示例18: Evaluate

        public override HashSet<IPeriod> Evaluate(IDateTime referenceDate, DateTime periodStart, DateTime periodEnd, bool includeReferenceDateInResults)
        {
            // Ensure the reference date is associated with the time zone
            if (referenceDate.AssociatedObject == null)
                referenceDate.AssociatedObject = TimeZone;

            List<ITimeZoneInfo> infos = new List<ITimeZoneInfo>(TimeZone.TimeZoneInfos);

            // Evaluate extra time periods, without re-evaluating ones that were already evaluated
            if ((EvaluationStartBounds == DateTime.MaxValue && EvaluationEndBounds == DateTime.MinValue) ||
                (periodEnd.Equals(EvaluationStartBounds)) ||
                (periodStart.Equals(EvaluationEndBounds)))
            {
                foreach (ITimeZoneInfo curr in infos)
                {
                    IEvaluator evaluator = curr.GetService(typeof(IEvaluator)) as IEvaluator;
                    Debug.Assert(curr.Start != null, "TimeZoneInfo.Start must not be null.");
                    Debug.Assert(curr.Start.TZID == null, "TimeZoneInfo.Start must not have a time zone reference.");
                    Debug.Assert(evaluator != null, "TimeZoneInfo.GetService(typeof(IEvaluator)) must not be null.");

                    // Time zones must include an effective start date/time
                    // and must provide an evaluator.
                    if (evaluator != null)
                    {
                        // Set the start bounds
                        if (EvaluationStartBounds > periodStart)
                            EvaluationStartBounds = periodStart;

                        // FIXME: 5 years is an arbitrary number, to eliminate the need
                        // to recalculate time zone information as much as possible.
                        DateTime offsetEnd = periodEnd.AddYears(5);

                        // Adjust our reference date to never fall out of bounds with
                        // the time zone information
                        var tziReferenceDate = referenceDate;
                        if (tziReferenceDate.LessThan(curr.Start))
                            tziReferenceDate = curr.Start;

                        // Determine the UTC occurrences of the Time Zone observances
                        var periods = evaluator.Evaluate(
                            tziReferenceDate,
                            periodStart,
                            offsetEnd,
                            includeReferenceDateInResults);

                        foreach (IPeriod period in periods)
                        {
                            if (!Periods.Contains(period))
                            {
                                Periods.Add(period);

                                Occurrence o = new Occurrence(curr, period);

                                if (!m_Occurrences.ContainsKey(o))
                                    m_Occurrences.Add(o, o);
                            }
                        }

                        if (EvaluationEndBounds == DateTime.MinValue || EvaluationEndBounds < offsetEnd)
                            EvaluationEndBounds = offsetEnd;
                    }
                }
                
                ProcessOccurrences(referenceDate);
            }
            else
            {
                if (EvaluationEndBounds != DateTime.MinValue && periodEnd > EvaluationEndBounds)
                    Evaluate(referenceDate, EvaluationEndBounds, periodEnd, includeReferenceDateInResults);
            }

            return Periods;
        }
开发者ID:devcrafting,项目名称:DDay.iCal,代码行数:73,代码来源:TimeZoneEvaluator.cs


示例19: AddOccurrence

 public void AddOccurrence(char c)
 {
     Occurrence o = Occurrence.Required;
     switch (c) 
     {
         case '?': 
             o = Occurrence.Optional;
             break;
         case '+':
             o = Occurrence.OneOrMore;
             break;
         case '*':
             o = Occurrence.ZeroOrMore;
             break;
     }
     Occurrence = o;
 }
开发者ID:mlnlover11,项目名称:IExtendFramework,代码行数:17,代码来源:SgmlParser.cs


示例20: GetAllOccurrences

 public static IEnumerable<DateTime> GetAllOccurrences(DateTime from, DateTime to, DayOfWeek day, Occurrence occurrence)
 {
     return GetAllDayOfWeek(from, to, day).Where(x => x.IsOccurrenceOf(day, occurrence));
 }
开发者ID:RichardAllanBrown,项目名称:ShinyDate,代码行数:4,代码来源:ShinyDateCollections.cs



注:本文中的Occurrence类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# OciHandle类代码示例发布时间:2022-05-24
下一篇:
C# Observer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap