예제 #1
0
 private void loadLastGameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         openDialog.InitialDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)) + @"\Reversi\Resources";
         if (openDialog.ShowDialog() == DialogResult.OK)
         {
             XmlSerializer serializer = new XmlSerializer();
             GameState     state      = serializer.Deserialize(openDialog.FileName);
             _game.RestoreState(state);
             cb_tips.Checked = _game.EnabledTips;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Неможливо загрузити збережену гру.", "Помилка", MessageBoxButtons.OK);
     }
 }