- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
private List<CellControl[]> ComposeLines(List<CellControl[]> vertical, List<CellControl[]> horizontal)
{
List<CellControl[]> result = new List<CellControl[]>();
foreach (var vLine in vertical)
{
var cellsCount = vLine.Length;
List<CellControl[]> linesToCompose = new List<CellControl[]>();
foreach (var vCell in vLine)
{
foreach (var hLine in horizontal)
{
foreach (var hCell in hLine)
{
if (hCell.X == vCell.X && hCell.Y == vCell.Y)
{
linesToCompose.Add(hLine);
cellsCount += hLine.Length;
break;
}
}
if (linesToCompose.Count == 0)
{
result.Add(hLine);
}
}
}
if (linesToCompose.Count == 0)
{
result.Add(vLine);
}
else
{
linesToCompose.Add(vLine);
var newLine = new CellControl[cellsCount];
var i = 0;
foreach (var line in linesToCompose)
{
foreach (var cellControl in line)
{
newLine[i] = cellControl;
cellControl.Selected = true;
i++;
}
}
result.Add(newLine);
}
}
return result;
}