当前位置: 首页>>代码示例>>C#>>正文


C# Range.IntersectsWith方法代码示例

本文整理汇总了C#中Range.IntersectsWith方法的典型用法代码示例。如果您正苦于以下问题:C# Range.IntersectsWith方法的具体用法?C# Range.IntersectsWith怎么用?C# Range.IntersectsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Range的用法示例。


在下文中一共展示了Range.IntersectsWith方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetEventInfos

        protected override IEnumerable<IEventInfo> GetEventInfos(TimeLineVisualizationState state, Telerik.Windows.Core.HierarchicalItem hierarchicalItem)
        {
            foreach (var eventInfo in base.GetEventInfos(state, hierarchicalItem))
            {
                yield return eventInfo;
            }

            var task = hierarchicalItem.SourceItem as GanttTask;
            if (task != null && !task.IsMilestone)
            {
                var roundedStart = state.Rounder.Round(new DateRange(task.Start, task.Start));
                var roundedEnd = state.Rounder.Round(new DateRange(task.End, task.End));
                var offSetTime = 0.3;
                var startLabelRange = new Range<long>(roundedStart.Start.AddDays(-1 - offSetTime).Ticks, roundedStart.Start.AddDays(-offSetTime).Ticks);
                var endLabelRange = new Range<long>(roundedEnd.Start.AddDays(offSetTime).Ticks, roundedEnd.Start.AddDays(1 + offSetTime).Ticks);

                if (startLabelRange.IntersectsWith(state.VisibleTimeRange))
                {
                    yield return new StartLabelEventInfo(startLabelRange, hierarchicalItem.Index)
                    {
                        OriginalEvent = hierarchicalItem.SourceItem
                    };
                }

                if (endLabelRange.IntersectsWith(state.VisibleTimeRange))
                {
                    yield return new EndLabelEventInfo(endLabelRange, hierarchicalItem.Index)
                    {
                        OriginalEvent = hierarchicalItem.SourceItem
                    };
                }
            }
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:33,代码来源:LabelVisualizationBehavior.cs

示例2: GetEventInfos

		protected override IEnumerable<IEventInfo> GetEventInfos(TimeLineVisualizationState state, HierarchicalItem hierarchicalItem)
		{
			foreach (var eventInfo in base.GetEventInfos(state, hierarchicalItem))
			{
				yield return eventInfo;
			}

			var task = hierarchicalItem.SourceItem as GanttDeadlineTask;
			var deadline = task != null ? task.GanttDeadLine : default(DateTime?);

			if (deadline.HasValue)
			{
				if (task.GanttDeadLine.HasValue && projectDeadLine < task.GanttDeadLine.Value)
				{
					deadline = task.GanttDeadLine = projectDeadLine;
					task.Refresh();
				}

				var roundedDeadline = state.Rounder.Round(new DateRange(deadline.Value, deadline.Value));
				var deadlineRange = new Range<long>(roundedDeadline.Start.Ticks, roundedDeadline.End.Ticks);

				if (deadlineRange.IntersectsWith(state.VisibleTimeRange))
				{
					yield return new TimeLineDeadlineEventInfo(deadlineRange, hierarchicalItem.Index, hierarchicalItem.SourceItem as GanttDeadlineTask);
				}
			}

			yield return new ProjectDeadlineEventInfo(new Range<long>(this.projectDeadLine.Ticks), 0, state.VisibleItems.Count - 1);
		}
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:29,代码来源:TimeLineDeadlineBehavior.cs

示例3: TestIntersection

		public void TestIntersection()
		{
			Range<int> one = new Range<int>(0, 10);
			Range<int> two = new Range<int>(2, 5);

			Assert.IsTrue(one.IntersectsWith(two));
			Assert.IsTrue(one.IsBetween(2));
			Assert.IsFalse(one.IsBetween(12));
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:9,代码来源:RangeTest.cs

示例4: GetEventInfosBase

        private IEnumerable<IEventInfo> GetEventInfosBase(TimeLineVisualizationState state, int index, HierarchicalItem hierarchicalItem)
        {
            var dateRange = hierarchicalItem.SourceItem as IDateRange;
            var roundedRange = state.Rounder.Round(dateRange);
            var taskRange = new Range<long>(roundedRange.Start.Ticks, roundedRange.End.Ticks);

            if (taskRange.IntersectsWith(state.VisibleTimeRange))
            {
                var eventInfo = new EventInfo(taskRange, index, 1, new Range<int>(0), IsSummary(hierarchicalItem.SourceItem), IsMilestone(hierarchicalItem.SourceItem))
                {
                    OriginalEvent = hierarchicalItem.SourceItem
                };

                yield return eventInfo;
            }
        }
开发者ID:JoelWeber,项目名称:xaml-sdk,代码行数:16,代码来源:TimeLineRecurrenceBehavior.cs

示例5: GetEventInfos

        protected override IEnumerable<IEventInfo> GetEventInfos(TimeLineVisualizationState state, Telerik.Windows.Core.HierarchicalItem hierarchicalItem)
        {
            foreach (var eventInfo in base.GetEventInfos(state, hierarchicalItem))
            {
                yield return eventInfo;
            }

            var task = hierarchicalItem.SourceItem as GanttDeadlineTask;
            var deadline = task != null ? task.GanttDeadLine : default(DateTime?);

            if (deadline.HasValue)
            {
                var roundedDeadline = state.Rounder.Round(new DateRange(deadline.Value, deadline.Value));
                var deadlineRange = new Range<long>(roundedDeadline.Start.Ticks, roundedDeadline.End.Ticks);

                if (deadlineRange.IntersectsWith(state.VisibleTimeRange))
                {
                    yield return new TimeLineDeadlineEventInfo(deadlineRange, hierarchicalItem.Index);
                }
            }
        }
开发者ID:jigjosh,项目名称:xaml-sdk,代码行数:21,代码来源:TimeLineDeadlineBehavior.cs

示例6: GetEventInfos

		protected override IEnumerable<IEventInfo> GetEventInfos(TimeLineVisualizationState state, HierarchicalItem hierarchicalItem)
		{
			foreach (var eventInfo in base.GetEventInfos(state, hierarchicalItem))
			{
				yield return eventInfo;
			}

			var task = hierarchicalItem.SourceItem as GanttBaselineTask;
			var baselineStartDate = task != null ? task.StartPlannedDate : DateTime.MinValue;

			if (baselineStartDate != null && baselineStartDate != DateTime.MinValue)
			{
				var roundedDeadline = state.Rounder.Round(new DateRange(baselineStartDate, task.EndPlannedDate));
				var baselineRange = new Range<long>(roundedDeadline.Start.Ticks, roundedDeadline.End.Ticks);

				if (baselineRange.IntersectsWith(state.VisibleTimeRange))
				{
					yield return new BaselineEventInfo(baselineRange, hierarchicalItem.Index, hierarchicalItem.SourceItem as GanttBaselineTask);
				}
			}
		}
开发者ID:JoelWeber,项目名称:xaml-sdk,代码行数:21,代码来源:TimeLineBaselineBehavior.cs

示例7: GetEventInfos

        protected override IEnumerable<IEventInfo> GetEventInfos(TimeLineVisualizationState state, Telerik.Windows.Core.HierarchicalItem hierarchicalItem)
        {
            foreach (var eventInfo in base.GetEventInfos(state, hierarchicalItem))
            {
                yield return eventInfo;
            }

            var task = hierarchicalItem.SourceItem as CustomGanttTask;
            foreach (var deadLine in task.CustomDeadLines)
            {
                if (deadLine != null)
                {
                    var roundedDeadline = state.Rounder.Round(deadLine);
                    var deadlineRange = new Range<long>(roundedDeadline.Start.Ticks, roundedDeadline.End.Ticks);

                    if (deadlineRange.IntersectsWith(state.VisibleTimeRange))
                    {
                        yield return new NationalEventSlotInfo(deadlineRange, hierarchicalItem.Index);
                    }
                }
            }
        }
开发者ID:JoelWeber,项目名称:xaml-sdk,代码行数:22,代码来源:EventsTimeLineVisualizationBehavior.cs


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