private void BTN_MANAGE_LINEUPS_Click(object sender, RoutedEventArgs e) { Object item = CB_LIST_OF_TEAMS.SelectedItem; if (item is Team) { Team team = (Team)item; LineupListDlg dlg = new LineupListDlg(team, engine.StoredLineups[team.Abrv]); System.Windows.Forms.DialogResult result = dlg.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK && dlg.ApplyAsTemplate) { List <Team> teams = engine.TeamReportFile.getTeams(); foreach (Team otherTeam in teams) { if (team == otherTeam) { continue; } TeamLineup otherTeamLineup = LineupPersistence.lookupTeamLineup(engine.StoredLineups, otherTeam); dlg.applyConfigurationToAnotherTeam(otherTeamLineup); syncUpTheData(engine.StoredLineups); LineupPersistence.saveDatabase(engine.StoredLineups); } //Update the table! CB_LIST_OF_TEAMS_SelectionChanged(this, null); } else if (result == System.Windows.Forms.DialogResult.OK) { //Update the table! CB_LIST_OF_TEAMS_SelectionChanged(this, null); } } }
public void testStoreAndLoadPersistenceObject() { int TEST_COUNT = 5; Dictionary <String, TeamLineup> teamLineups = LineupPersistence.loadDatabase(); Assert.IsTrue(teamLineups.Count == 0); fillWithTestTeams(teamLineups, TEST_COUNT); LineupPersistence.saveDatabase(teamLineups); Dictionary <String, TeamLineup> lineup2 = LineupPersistence.loadDatabase(); Assert.IsTrue(lineup2.Count() == TEST_COUNT); Assert.IsTrue(lineup2.ContainsKey(TEST_TEAM_NAME + "1")); TeamLineup lineup = teamLineups[TEST_TEAM_NAME + "1"]; Assert.IsTrue(lineup.Lineups.Count == 2); Assert.AreEqual(18, lineup2[TEST_TEAM_NAME + "1"].playerByGRID.Count); Assert.AreEqual(18, lineup2[TEST_TEAM_NAME + "2"].playerByGRID.Count); }
private void LineupUsageCalculator_Closing(object sender, System.ComponentModel.CancelEventArgs e) { syncUpTheData(engine.StoredLineups); LineupPersistence.saveDatabase(engine.StoredLineups); }