本文整理汇总了C#中System.Windows.Controls.TextBlock.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# TextBlock.GetLength方法的具体用法?C# TextBlock.GetLength怎么用?C# TextBlock.GetLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.TextBlock
的用法示例。
在下文中一共展示了TextBlock.GetLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Validate
public void Validate( ref TextBlock[,] textblocks, List<Point> alreadyUsedPoints )
{
var laidPoints = new List<Point>();
for(var i = 0; i < textblocks.GetLength(1); i++)
{
for(var j = 0; j < textblocks.GetLength(0); j++)
{
if(!Util.IsEmpty(textblocks[j, i]?.Text))
{
laidPoints.Add(new Point(j,i));
}
}
}
for(var i = 0; i < textblocks.GetLength(1); i++)
{
for(var j = 0; j < textblocks.GetLength(0); j++)
{
if(App.GameModel.PlayerToMove != App.GameModel.Me)
{
textblocks[j, i].AllowDrop = false;
continue;
}
// noch keine Buchstaben gelegt in diesen Zug
switch (alreadyUsedPoints.Count)
{
case 0:
// erster Zug ueberhaupt
if(App.GameModel.IsFirstMove)
{
ValidateBetweenPoints(ref textblocks, Util.NullPoint, App.GameModel.Centre, j, i);
}
// ein spaeterer Zug
else
{
foreach(var p2 in laidPoints)
{
var b = ValidateBetweenPoints(ref textblocks, Util.NullPoint, p2, j, i);
if(b) break;
}
}
break;
case 1:
{
var p1 = alreadyUsedPoints.FirstOrDefault();
// erster Zug ueberhaupt
if(App.GameModel.IsFirstMove)
{
ValidateBetweenPoints(ref textblocks, p1, App.GameModel.Centre, j, i);
}
// ein spaeterer Zug
else
{
// Alle Punkt,in gleicher Spalte oder Zeile, die 7 Einheiten entfernt sind
var endPoints = laidPoints.Where(p => ( Util.DoubleCompare(p.X, p1.X) || Util.DoubleCompare(p.Y, p1.Y) ) && Util.CalcDistance(p, p1) <= 7 && Util.CalcDistance(p, p1) > 0);
foreach(var p2 in endPoints)
{
var b = ValidateBetweenPoints(ref textblocks, p1, p2, j, i);
if(b) break;
}
}
}
break;
default:
{
var p1 = alreadyUsedPoints.ElementAtOrDefault(0);
var p2 = alreadyUsedPoints.ElementAtOrDefault(1);
var d = Util.PointRelativeTo(p1, p2);
// horizontal
if (d == Util.Direction.Left || d == Util.Direction.Right)
{
var leftestPoint = Util.MinPoint(alreadyUsedPoints, Util.Axis.X);
var rightestPoint = Util.MaxPoint(alreadyUsedPoints, Util.Axis.X);
ValidateBetweenPoints(ref textblocks, leftestPoint, rightestPoint, j, i);
}
// vertikal
else if (d == Util.Direction.Top || d == Util.Direction.Bottom)
{
var highestPoint = Util.MinPoint(alreadyUsedPoints, Util.Axis.Y);
var lowestPoint = Util.MaxPoint(alreadyUsedPoints, Util.Axis.Y);
ValidateBetweenPoints(ref textblocks, highestPoint, lowestPoint, j, i);
}
}
break;
}
}
}
}