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


C# NotifyCollectionChangedEventArgs.GetAddedRange方法代码示例

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


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

示例1: OnCollectionChanged

		protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
		{
			base.OnCollectionChanged(e);

			// todo temp
			HandleCollectionReset();
			return;

			if (e.Action == NotifyCollectionChangedAction.Reset)
			{
				HandleCollectionReset();
			}
			else if (e.Action == NotifyCollectionChangedAction.Add)
			{
				if (e.NewItems != null)
				{
					Range<int> addedRange = e.GetAddedRange();

					if (indexRange.IntersectsWith(addedRange))
					{
						HandleCollectionAdd(e);
					}
					else if (indexRange.Max == addedRange.Min - 1) // item was added into the end of collection
					{
						Path lastPath = drawnPaths.Last();
						int lastCount = LineChartBase.GetPointsCount(lastPath);
						Range<int> requestRange = new Range<int>(addedRange.Min - 1, addedRange.Max);

						// have path with non-filled geometry
						if (lastCount + addedRange.GetLength() <= pathLength)
						{
							canvas.Children.Remove(lastPath);
							drawnPaths.Remove(lastPath);
							pathsPool.Put(lastPath);
							Range<int> lastPathRange = PointChartBase.GetIndexRange(lastPath);
							int min = requestRange.Min;

							if (min % pathLength == 0)
								min -= 1;

							requestRange = new Range<int>(min, addedRange.Max);
						}

						var points = DataSource.GetPointData(requestRange);

						var indexedPoints = IndexWrapper.Generate(points, requestRange.Min);

						// do nothing if there is nothing to draw
						if (!points.Any())
							return;

						int minIndex;
						int maxIndex;
						CreateAndAddPath(indexedPoints, out minIndex, out maxIndex, transformWhileCreateUI);

						this.indexRange = new Range<int>(indexRange.Min, maxIndex);
					}
					else
					{
						// todo
						// do nothing?
					}
				}
				else
				{
					HandleCollectionReset();
				}
			}
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:69,代码来源:LineChart.cs

示例2: HandleCollectionAdd

		private void HandleCollectionAdd(NotifyCollectionChangedEventArgs e)
		{
			Range<int> addedRange = e.GetAddedRange();

			var paths = (from path in drawnPaths
						 let pathRange = PointChartBase.GetIndexRange(path)
						 where pathRange.IntersectsWith(addedRange)
						 let bounds = PointChartBase.GetContentBounds(path)
						 select new { path, bounds }).ToList();

			DataRect unitedContentBounds = paths.Aggregate(
				DataRect.Empty, (rect, other) => DataRect.Union(rect, other.bounds));

			var added = e.NewItems;

			// todo finish
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:17,代码来源:LineChart.cs


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