Exemplo n.º 1
0
        private void ListCreator()
        {
            Block1 = new Block(0, 0, 1);
            Block2 = new Block(1, 0, 2);
            Block3 = new Block(2, 0, 3);
            Block4 = new Block(0, 1, 4);
            Block5 = new Block(1, 1, 5);
            Block6 = new Block(2, 1, 6);
            Block7 = new Block(0, 2, 7);
            Block8 = new Block(1, 2, 8);
            Block9 = new Block(2, 2, 9);

            _fieldList = new List<IFieldViewModel>(81);
            for (var column = 0; column < 9; column++)
            {
                for (var row = 0; row < 9; row++)
                {
                    Block currentBlock = null;
                    if (row < 3)
                    {
                        if (column < 3)
                        {
                            currentBlock = Block1;
                        }
                        else if (column < 6)
                        {
                            currentBlock = Block2;
                        }
                        else if (column < 9)
                        {
                            currentBlock = Block3;
                        }
                    }
                    else if (row < 6)
                    {
                        if (column < 3)
                        {
                            currentBlock = Block4;
                        }
                        else if (column < 6)
                        {
                            currentBlock = Block5;
                        }
                        else if (column < 9)
                        {
                            currentBlock = Block6;
                        }
                    }
                    else if (row < 9)
                    {
                        if (column < 3)
                        {
                            currentBlock = Block7;
                        }
                        else if (column < 6)
                        {
                            currentBlock = Block8;
                        }
                        else if (column < 9)
                        {
                            currentBlock = Block9;
                        }
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }

                    _fieldList.Add(new FieldViewModel(0, currentBlock, column, row));
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Selcts the block to fill with the blockindex
 /// </summary>
 /// <param name="blockIndex">Index Of the Block; On which place the Block is in the Board</param>
 /// <returns></returns>
 public BoardFactory SelectBlock(int blockIndex)
 {
     _currentBlock = _board.BlockList.FirstOrDefault(b => b.BlockIndex == blockIndex);
     return this;
 }