public static PuzzlePhraseFile GetInstance() { if (_instance == null) { _instance = new PuzzlePhraseFile(); } return(_instance); }
private void MainForm_Load(object sender, EventArgs e) { // Initialize the current game _currentGame = null; currentPuzzleIndex = -1; // Load the list of phrases puzzlePhraseFile = PuzzlePhraseFile.GetInstance(); // Shuffle the phrases int newIndex; for (int i = 0; i < PuzzlePhraseFile.listOfPuzzlePhrases.Count; i++) { newIndex = randomNumberGenerator.Next(0, PuzzlePhraseFile.listOfPuzzlePhrases.Count); PuzzlePhrase temp = PuzzlePhraseFile.listOfPuzzlePhrases[i]; PuzzlePhraseFile.listOfPuzzlePhrases[i] = PuzzlePhraseFile.listOfPuzzlePhrases[newIndex]; PuzzlePhraseFile.listOfPuzzlePhrases[newIndex] = temp; } // Initalize the controls this.btnNewGame.Enabled = true; this.btnPrevGame.Enabled = false; }