Exemplo n.º 1
0
        private void EditExistingBox(PuzzleWord word, int startCol, int startRow)
        {
            //Don't need to check if the expected letters are the same because we already checked them
            var          theBoxList = TheGrid.Children.Cast <UIElement>().Where(k => (Grid.GetRow(k) == startRow) && (Grid.GetColumn(k) == startCol)).ToList();
            PuzzleLetter theBox     = theBoxList[theBoxList.Count - 1] as PuzzleLetter; //Some grid boxes contain labels as well as textboxes. The textboxes are always added last

            if ((HeaderTemp.GetDefaultNumber(theBox) == "") && ((startCol == word.StartColumn) && (startRow == word.StartRow)))
            {
                HeaderTemp.SetDefaultNumber(theBox, word.ClueNumber.ToString());
            }
        }
Exemplo n.º 2
0
        private void DrawLetterBox(PuzzleWord word, int startCol, int startRow, char letter, bool letterVisible)
        {
            //Check the textbox doesn't exist
            if (ControlPresent[startCol, startRow])
            {
                EditExistingBox(word, startCol, startRow);
            }
            else
            {
                PuzzleLetter box = CreateNewBox(word, startCol, startRow, letter, letterVisible);

                TheGrid.Children.Add(box);
                ControlPresent[startCol, startRow] = true;
            }
        }
Exemplo n.º 3
0
        private static PuzzleLetter CreateNewBox(PuzzleWord word, int startCol, int startRow, char letter, bool letterVisible)
        {
            string cornerNumber = "";

            if ((startCol == word.StartColumn) && (startRow == word.StartRow))
            {
                cornerNumber = word.ClueNumber.ToString();
            }
            //Create textbox because it doesn't already exist
            PuzzleLetter box = new PuzzleLetter(letter, cornerNumber);

            if (letterVisible)
            {
                box.Text = box.ExpectedLetter.ToString();
            }

            //determine the starting position
            Grid.SetColumn(box, startCol);
            Grid.SetRow(box, startRow);
            return(box);
        }