本文整理汇总了C#中IFigure.AsEnumerable方法的典型用法代码示例。如果您正苦于以下问题:C# IFigure.AsEnumerable方法的具体用法?C# IFigure.AsEnumerable怎么用?C# IFigure.AsEnumerable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFigure
的用法示例。
在下文中一共展示了IFigure.AsEnumerable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectionChangedEventArgs
public SelectionChangedEventArgs(IFigure singleSelection)
: this(singleSelection.AsEnumerable())
{
}
示例2: DeleteExecutedEventArgs
public DeleteExecutedEventArgs(IFigure deletedFigure)
: this(deletedFigure.AsEnumerable())
{
}
示例3: FigureCoordinatesChangedEventArgs
public FigureCoordinatesChangedEventArgs(IFigure singleFigure)
: this(singleFigure.AsEnumerable())
{
}
示例4: MouseDown
public override void MouseDown(object sender, MouseButtonEventArgs e)
{
#if !SILVERLIGHT
if (e.ClickCount == 2)
{
Drawing.CoordinateSystem.ZoomExtend();
return;
}
#endif
offsetFromFigureLeftTopCorner = Coordinates(e, false, false, false);
oldCoordinates = offsetFromFigureLeftTopCorner;
coordinatesOnMouseDown = offsetFromFigureLeftTopCorner;
startedMoving = false;
moving = new List<IMovable>();
IEnumerable<IFigure> roots = null;
bool isLocked = false;
found = Drawing.Figures.HitTest(offsetFromFigureLeftTopCorner);
IMovable oneMovable = found as IMovable;
if (oneMovable != null)
{
if (!found.Locked)
{
if (oneMovable is IPoint)
{
// when we drag a point, we want it to snap to the cursor
// so that the point center is directly under the tip of the mouse
offsetFromFigureLeftTopCorner = new Point();
oldCoordinates = oneMovable.Coordinates;
}
else
{
// however when we drag other stuff (such as text labels)
// we want the mouse to always touch the part of the draggable
// where it first touched during MouseDown
// we don't want the draggable to "snap" to the cursor like points do
offsetFromFigureLeftTopCorner = offsetFromFigureLeftTopCorner.Minus(oneMovable.Coordinates);
}
roots = DependencyAlgorithms.FindRoots(f => f.Dependents, found);
if (roots.All(root => (!root.Locked)))
{
moving.Add(oneMovable);
roots = found.AsEnumerable();
}
else
{
isLocked = true;
}
}
else
{
isLocked = true;
}
}
else if (found != null && !found.Locked)
{
if (!found.Locked)
{
roots = DependencyAlgorithms.FindRoots(f => f.Dependencies, found);
if (roots.All(root => root is IMovable))
{
if (roots.All(root => ((IMovable)root).AllowMove()))
{
moving.AddRange(roots.OfType<IMovable>());
}
else
{
isLocked = true;
}
}
}
else
{
isLocked = true;
}
}
if (roots != null)
{
toRecalculate = DependencyAlgorithms.FindDescendants(f => f.Dependents, roots);
toRecalculate.Reverse();
}
else
{
toRecalculate = null;
}
if (moving.IsEmpty() && !isLocked && !Drawing.CoordinateGrid.Locked)
{
moving.Add(Drawing.CoordinateSystem);
//var allFigures = Drawing.Figures.GetAllFiguresRecursive();
//roots = DependencyAlgorithms.FindRoots(f => f.Dependencies, allFigures);
//moving.AddRange(roots.OfType<IMovable>());
//roots = null;
toRecalculate = null; // Figures;
}
}