//FILLS THE 9 BUTTONS FROM CONST OR VOWL BUTTON /* Get the location of the Button and displays the char passed in by the * btnVowels/btnConsonants btn click events. Also disable the 2 buttons that * generate the letters and makes the entry for the word and Button Visible */ private void sendCharToTextBox(char _letter) //Send char to BUTTON { _listAvailLetters.Add(_letter); //Add the current letters to a list _btnArray[_btnLoc].Content = _letter.ToString(); //sends the letter to the Btn //If all letters are added if (_btnLoc == _btnArray.Length - 1) { enableAllLetterBtns(); //enable all the Btns startTimer(); //Start the Timer ShowStoryboardAnimation.Begin(); //Clock animation SpConstVowel.Visibility = Visibility.Collapsed; SpResetEntrWord.Visibility = Visibility.Visible; _btnLoc = 0;//Reset the btn Location } else { _btnLoc++;//Used to fnd the next TextBox } }
/*Used to send the numbers from the Large/Small num btns to the appropriate btnNumBox */ private void sendNumToBtn(int num) { //Sends the Number to the Btn.content _btnNumLst[_btnLoc].Content = num.ToString(); //If all numbers are added to the buttons if (_btnLoc == _btnNumLst.Count - 1) { enableAllBtns(_btnNumLst); _tempNumBtnAvail.AddRange(_btnNumLst);//Populate the temp Btn slist stkPanNumBtns.Visibility = Visibility.Collapsed; stkPanOperators.Visibility = Visibility.Visible; stkPanReset.Visibility = Visibility.Visible; /////////////////////********************************* _targetNum = rndNumGen(101, 999); txtBoxTarget.Text = _targetNum.ToString(); startTimer(); ShowStoryboardAnimation.Begin(); //Clock animation _btnLoc = 0; //Reset the btn Location } else { _btnLoc++;//Used to fnd the next button } }
/* Resets the games: Buttons, and emptys the textboxes containing letters */ private void resetGame() { disableAllLetterBtns(); _countDownTimer.Stop(); _countDownTimer.Tick -= numTimer_Tick; _countTicks = 28; ShowStoryboardAnimation.Stop(); SpConstVowel.Visibility = Visibility.Visible; txtBoxUsrWord.Text = ""; SpResetEntrWord.Visibility = Visibility.Collapsed; //Reset all the textboxes to have nothing in them foreach (Button t in _btnArray) { _btnArray[_btnLoc++].Content = ""; _listAvailLetters.Clear();//Clear the list } _btnLoc = 0; }