示例#1
0
 private void saveGameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         saveDialog.InitialDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)) + @"\Reversi\Resources";
         if (saveDialog.ShowDialog() == DialogResult.OK)
         {
             XmlSerializer serializer = new XmlSerializer();
             serializer.Serialize(_game.GetState(), saveDialog.FileName);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Неможливо зберегти гру", "Помилка", MessageBoxButtons.OK);
     }
 }