Beispiel #1
0
 private void btnLoad_Click(object sender, EventArgs e)
 {
     if (File.Exists("data.xml"))
     {
         GameData info = new GameData();
         info = SaveLoad.LoadData("data.xml");
         hits = info.hits;
         misses = info.misses;
         totalShots = info.totalShots;
         avgHits = info.avgHits;
     }
     else
     {
         MessageBox.Show("File does not exist");
     }
 }
Beispiel #2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         GameData info = new GameData();
         info.hits = hits;
         info.misses = misses;
         info.totalShots = totalShots;
         info.avgHits = avgHits;
         SaveLoad.SaveData(info, "data.xml");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }