本文整理汇总了C#中System.Windows.Documents.List.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# List.GetEnumerator方法的具体用法?C# List.GetEnumerator怎么用?C# List.GetEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.List
的用法示例。
在下文中一共展示了List.GetEnumerator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewEditor
public ViewEditor(MainWindow w)
{
current = w;
//menu = new Menu(current);
GUI_Animations.Initialize(current);
GUI_Changer.initialize(current);
start = DateTime.Now;
actions = new List<Action>();
//actions.Add(() => menu.init_SelectLoadOrCreateState());
actionEnumerator = actions.GetEnumerator();
}
示例2: GetEnumerator
public IEnumerator GetEnumerator()
{
this.EnsureCollectionInSync();
this.VerifyRefreshNotDeferred();
if (this.IsGrouping)
{
CollectionViewGroupRoot rootGroup = this.RootGroup;
if (rootGroup == null)
{
return null;
}
return rootGroup.GetLeafEnumerator();
}
if (this.PageSize <= 0)
{
return new NewItemAwareEnumerator(this, this.InternalList.GetEnumerator(), this.CurrentAddItem);
}
List<object> list = new List<object>();
if (this.PageIndex < 0)
{
return list.GetEnumerator();
}
for (int i = this._pageSize * this.PageIndex; i < Math.Min(this._pageSize * (this.PageIndex + 1), this.InternalList.Count); i++)
{
list.Add(this.InternalList[i]);
}
return new NewItemAwareEnumerator(this, list.GetEnumerator(), this.CurrentAddItem);
}
示例3: OnRender
/// <summary>
/// This method is called when rendering is required.
/// </summary>
/// <param name="drawingContext"></param>
protected override void OnRender(DrawingContext drawingContext)
{
if (!Initializing)
{
// Update the CAmera position
persptCamera.LookDirection = cameraLookDirection;
persptCamera.Position = cameraPosition;
// If the user's mouse is on one of the 3D bar. then enhance the bar and display its values.
if (null != SelectedHit &&
(PrevSelectedHit == null ||
0 != PrevSelectedHit.StringToDisplay.CompareTo(SelectedHit.StringToDisplay)))
{
if (geometryForHitText != null)
{
geometryForHitText = null;
modelForHitText.Content = null;
mainViewPort.Children.Remove(modelForHitText);
}
if (modelsForHitTest != null)
{
List<ModelVisual3D>.Enumerator enumModelsI = modelsForHitTest.GetEnumerator();
while (enumModelsI.MoveNext())
{
mainViewPort.Children.Remove(enumModelsI.Current);
}
}
LetterLengthForHitText = SelectedHit.StringToDisplay.Length * OneLetterWidthForHitText;
Point3D ptToWRite = SelectedHit.P2;
ptToWRite.Y += LITTLE_ABOVE;
geometryForHitText = WriteText(SelectedHit.PointToWrite, LetterLengthForHitText, OneLetterHeightForHitText, SelectedHit.StringToDisplay, Colors.Black);
modelsForHitTest = Draw3DBar(SelectedHit.XItem, SelectedHit.YItem, SelectedHit.ZItem, SelectedHit.PointToStart, SelectedHit.Height, SelectedHit.Width , SelectedHit.BarColor);
List<ModelVisual3D>.Enumerator enumModels = modelsForHitTest.GetEnumerator();
while (enumModels.MoveNext())
{
mainViewPort.Children.Add(enumModels.Current);
}
PrevSelectedHit = SelectedHit;
modelForHitText.Content = geometryForHitText;
mainViewPort.Children.Add(modelForHitText);
}
// Else if there is no bar selected remove the enhancement and Hit text.
else if (null == SelectedHit)
{
geometryForHitText = null;
modelForHitText.Content = null;
mainViewPort.Children.Remove(modelForHitText);
if (modelsForHitTest != null)
{
List<ModelVisual3D>.Enumerator enumModels = modelsForHitTest.GetEnumerator();
while (enumModels.MoveNext())
{
mainViewPort.Children.Remove(enumModels.Current);
}
}
}
}
base.OnRender(drawingContext);
}
示例4: GrahamScan
/// <summary>
/// Finds the ConvexHull of a series of points. See
/// http://www.cs.princeton.edu/courses/archive/spr10/cos226/demo/ah/GrahamScan.html
/// for further information.
/// </summary>
/// <param name="points">The points to compute the ConvexHull for</param>
/// <returns>a collection of points that represents the polygon
/// of the ConvexHull</returns>
private static ICollection<Point> GrahamScan(List<ConvexHullPoint> chPoints)
{
Stack<ConvexHullPoint> chPointStack = new Stack<ConvexHullPoint>();
IEnumerator<ConvexHullPoint> enumerator = chPoints.GetEnumerator();
chPointStack.Push(anchor);
chPointStack.Push(chPoints[0]);
// Advance the enumerator to account for the two points
// that we already got
enumerator.MoveNext();
enumerator.MoveNext();
int i = 1;
// Loop over all the points that were provided
while (i < chPoints.Count)
{
// Ensure that stack contains points
if (chPointStack.Count > 1)
{
ConvexHullPoint firstCHPoint = chPointStack.Pop();
ConvexHullPoint secondCHPoint = chPointStack.Pop();
chPointStack.Push(secondCHPoint);
chPointStack.Push(firstCHPoint);
if (Orientation(secondCHPoint, firstCHPoint, enumerator.Current) == COUNTER_CLOCKWISE)
{
chPointStack.Push(enumerator.Current);
enumerator.MoveNext();
i++;
}
else
chPointStack.Pop();
}
else // No points in stack
{
chPointStack.Push(enumerator.Current);
enumerator.MoveNext();
i++;
}
}
return GetSortedPoints(chPointStack);
}