private void BackgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { DayGenerator generator = new DayGenerator(e.Argument as DayGeneratorParameters); using ProgressUpdater progressUpdater = new ProgressUpdater(generator, this, toolStripProgressBar1, toolStripStatusLabel1, timer1); generatedDay = generator.Generate(); }
private void BTNimportplayersforday_Click(object sender, EventArgs e) { Day recentDayInHistory = history.LastOrDefault(); if (recentDayInHistory != null && !string.IsNullOrEmpty(recentDayInHistory.date)) { OFDplayersinday.FileName = Tools.GuessFilename(recentDayInHistory) + ".txt"; } if (OFDplayersinday.ShowDialog() == DialogResult.Cancel) { return; } ReadWriteTable.ImportPlayerForDay(OFDplayersinday.FileName, players, playersSelectedForDay, out List <string> namesNotImported); if (namesNotImported.Count == 1) { MessageBox.Show($"I could not find anyone with the name {namesNotImported[0]}", "Incomplete import"); } else if (namesNotImported.Count > 1) { string msg = "I could not find anyone with these names:"; foreach (string name in namesNotImported) { msg += "\n" + name; } MessageBox.Show(msg, "Incomplete import"); } RefreshPageMatchesPlayers(); }
public static bool ExportPlayersFromDay(string filename, Day day) { using SingleColumnWriter singleColumnWriter = new SingleColumnWriter(filename); foreach (Player player in day.Players()) { singleColumnWriter.AddRow(player.Name); } return(true); }
private void BTNaddfixedmatch_Click(object sender, EventArgs e) { if (fixedMatchesDay == null) { fixedMatchesDay = new Day { date = DateTime.Now.ToString("d", CultureInfo.CurrentCulture) }; } fixedMatchesDay.matches.Add(new Match(MatchSize.Triples, true, false)); DisplayFixedMatches(); }
private void BTNnewgamesave_Click(object sender, EventArgs e) { if (generatedDay == null) { return; } generatedDay.matches.Sort(Sorts.MatchRinkCompare); history.Add(generatedDay); Save(); generatedDay = null; fixedMatchesDay = null; playersSelectedForDay.Clear(); SetMatchSizes(new Counter <MatchSize>()); RefreshFullListOfPlayers(); DisplayFixedMatches(); RefreshHistoryList(); tabControlMatches.SelectedTab = pagePlayers; BTNmainhistory.PerformClick(); }