private void loadButton_Click(object sender, EventArgs e) { GameData ga = new GameData(); SeedTable st = new SeedTable(); HelperClass helper = new HelperClass();; try { var loaddata = comboBox1.SelectedItem as GameData; // byte [,] Cells = helper.MakeLoadData(loaddata); ClearCells(); Cells = helper.MakeLoadData(loaddata); if (cRun.Checked == true) { cRun.Checked = false; } pView.Refresh(); Populate(); } catch { throw; } }
//Read public string LoadGame(SeedTable s) { using (Connection connection = new Connection()) { var objecttoLoad = s as SeedTable; string SeedString = objecttoLoad.Seed.ToString(); return(SeedString); } }
//Update public void EditSave(SeedTable s) { using (Connection connection = new Connection()) { var objecttoedit = s as SeedTable; connection.SeedTables.AddOrUpdate(s); connection.SaveChanges(); } }
//Create public void SaveGame(SeedTable s) { using (Connection connection = new Connection()) { var gobjecttoAdd = s as SeedTable; connection.SeedTables.Add(s); connection.SaveChanges(); } }
//Delete public void DeleteSave(SeedTable s) { using (Connection connection = new Connection()) { int remID = s.Id; var gametoremove = connection.SeedTables.Find(remID); connection.SeedTables.Remove(gametoremove); connection.SaveChanges(); } }