/// <summary> /// Funkcja obsługująca przycisk odpowiedzialny za wczytanie zapisanej gry /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonLoadGame_Click(object sender, EventArgs e) { this.Hide(); string line; double cash; int dayCounter, amountOfPills; using (StreamReader sr = new StreamReader("savedGame.txt")) { line = sr.ReadLine(); dayCounter = Int32.Parse(line); line = sr.ReadLine(); cash = Int32.Parse(line); line = sr.ReadLine(); amountOfPills = Int32.Parse(line); } FormGame game = new FormGame(dayCounter, cash, amountOfPills, 0); game.Show(); }