public void buttonRestart_Click(object sender, EventArgs e) { string name = this.Owner.Name; switch (name) { case "Krestiki_Noliki": Krestiki_Noliki tic_tac = this.Owner as Krestiki_Noliki; tic_tac.Restart(); break; case "Shashki": Shashki shashki = this.Owner as Shashki; shashki.Restart(); break; case "Chess": Chess chess = this.Owner as Chess; chess.Restart(); break; case "Miner": Miner miner = this.Owner as Miner; if (miner != null) { miner.Close(); selectForm = new Miner(); } break; case "ThreeRow": ThreeRow threeRow = this.Owner as ThreeRow; if (threeRow != null) { threeRow.Close(); selectForm = new ThreeRow(); } break; } selectForm.Show(); this.Close(); }
//Метод для вызова определённого режима игры "Крестики-Нолики" public void tic_tac_plqy(bool result) { Krestiki_Noliki krestiki_Noliki = new Krestiki_Noliki(result); krestiki_Noliki.Show(); }