private void btnExportAll_Click(object sender, EventArgs e) { if (qualificRound != null && dataGridView2.Rows.Count > 0) { List <ComboBoxFlights> ctl = new List <ComboBoxFlights>(); foreach (DataGridViewRow dgvr in dataGridView2.Rows) { FlightSet flt = dgvr.Tag as FlightSet; if (flt.Point.Count == 0) // skip flights without imported logger data { continue; } ComboBoxFlights cboFlt = new ComboBoxFlights(flt, new string[] { "--" }); ctl.Add(cboFlt); } String dirPath = System.Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments) + @"\AirNavigationRace\"; DirectoryInfo di = Directory.CreateDirectory(dirPath); if (!di.Exists) { di.Create(); } PDFCreator.CreateResultPDF(visualisationPictureBox1, Client, qualificRound, ctl, dirPath + @"\Results_" + cleanedString(qualificRound.Name) + "_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".pdf"); } }
private void btnExportSingle_Click(object sender, EventArgs e) { if (qualificRound != null && dataGridView2.SelectedRows.Count > 0) { List <ComboBoxFlights> ctl = new List <ComboBoxFlights>(); DataGridViewRow dgvr = dataGridView2.SelectedRows[0]; { FlightSet flt = dgvr.Tag as FlightSet; if (flt.Point.Count > 0) // skip flights without imported logger data { ComboBoxFlights cboFlt = new ComboBoxFlights(flt, new string[] { "--" }); ctl.Add(cboFlt); String dirPath = System.Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments) + @"\AirNavigationRace\"; DirectoryInfo di = Directory.CreateDirectory(dirPath); if (!di.Exists) { di.Create(); } PDFCreator.CreateResultPDF(visualisationPictureBox1, Client, qualificRound, ctl, dirPath + @"\Results_" + cleanedString(qualificRound.Name) + "_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".pdf"); } else { MessageBox.Show("Logger data for the selected flight is missing. The MapSet will not be exported.", "Single MapSet Export", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void ExportResultRanking(bool exportAsPdf = true) { if (qualificRound != null && dataGridView2.Rows.Count > 0) { List <FlightSet> lstFlt = new List <FlightSet>(); List <ComboBoxFlights> ctl = new List <ComboBoxFlights>(); foreach (DataGridViewRow dgvr in dataGridView2.Rows) { FlightSet flt = dgvr.Tag as FlightSet; if (flt.Point.Count > 0) { ComboBoxFlights cboFlt = new ComboBoxFlights(flt, new string[] { "--" }); ctl.Add(cboFlt); } } String dirPath = System.Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments) + @"\AirNavigationRace\"; DirectoryInfo di = Directory.CreateDirectory(dirPath); if (!di.Exists) { di.Create(); } if (exportAsPdf) { PDFCreator.CreateRankingListPDF(Client, qualificRound, ctl, dirPath + @"\Results_" + cleanedString(qualificRound.Name) + "_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".pdf"); } else { using (SaveFileDialog sfd = new SaveFileDialog()) { string _fileFilter = "Excel Files (*.xls, *.xlsx)|*.xls;*.xlsx| Csv files (*.csv)|*.csv| All files (*.*)|*.*"; sfd.FileName = @"\Results_" + cleanedString(qualificRound.Name) + "_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"; sfd.Filter = _fileFilter; sfd.FilterIndex = 0; sfd.OverwritePrompt = true; if (sfd.ShowDialog() == DialogResult.OK) { OpenOfficeCreator.CreateRankingListExcel(Client.SelectedCompetition.Name, qualificRound.Name, ctl, sfd.FileName); MessageBox.Show("Ranking list saved", "Ranking list saved", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { competition = null; if (comboBoxCompetition.SelectedItem != null) { CompetitionComboEntry cce = comboBoxCompetition.SelectedItem as CompetitionComboEntry; if (cce != null) { competition = cce.comp; listViewFlights.Items.Clear(); long min = long.MaxValue; long max = long.MinValue; List<Flight> CompetitionTeamList = competition.Flight.ToList(); CompetitionTeamList.Sort((p, q) => p.StartID.CompareTo(q.StartID)); List<Point> points = new List<Point>(); foreach (Flight ct in competition.Flight) { ComboBoxFlights lvi2 = new ComboBoxFlights(ct, new string[] { ct.StartID.ToString(), "0", getTeamDsc(ct), new DateTime(ct.TimeTakeOff).ToShortTimeString(), new DateTime(ct.TimeStartLine).ToShortTimeString(), new DateTime(ct.TimeEndLine).ToShortTimeString(), getRouteText(ct.Route) }); lvi2.Tag = ct; listViewFlights.Items.Add(lvi2); points.AddRange(ct.Point); min = Math.Min(ct.TimeTakeOff, min); max = Math.Max(ct.TimeEndLine, max); } listViewFlights.Enabled = true; parcour = cce.comp.Parcour; Map map = parcour.Map; MemoryStream ms = new MemoryStream(map.Picture.Data); visualisationPictureBox1.Image = System.Drawing.Image.FromStream(ms); visualisationPictureBox1.SetConverter(new Converter(map)); visualisationPictureBox1.SetParcour(parcour); visualisationPictureBox1.Invalidate(); visualisationPictureBox1.Refresh(); updatePoints(); } else { listViewFlights.Enabled = false; listViewFlights.Items.Clear(); listViewPenalty.Items.Clear(); } } else { listViewFlights.Enabled = false; listViewFlights.Items.Clear(); listViewPenalty.Items.Clear(); } }