public CompetitorRouteAssignment this[Competitor competitor]
 {
     get
     {
         foreach(CompetitorRouteAssignment competitorRouteAssignment in items)
         {
             if (competitor == competitorRouteAssignment.Competitor)
             {
                 return competitorRouteAssignment;
             }
         }
         return null;
     }
 }
 public bool Contains(Competitor item)
 {
     foreach (CompetitorRouteAssignment competitorRouteAssignment in items)
     {
         if (competitorRouteAssignment.Competitor == item)
         {
             return true;
         }
     }
     return false;
 }
示例#3
0
文件: Common.cs 项目: helios57/anrl
        /// <summary>
        /// Creates a Flight Data Sheet for the specified Flight in the PdfSharp.PdfDocument Format.
        /// </summary>
        /// <param name="competitor"></param>
        /// <param name="flight"></param>
        /// <param name="race"></param>
        /// <param name="parcours"></param>
        /// <param name="group"></param>
        /// <returns></returns>
        public static PdfDocument createPdf(Competition competition, Competitor competitor, Flight flight, Race race, Parcours parcours)
        {
            // Create a new PDF document
            PdfDocument document = new PdfDocument();

            // Create an empty page
            PdfPage page = document.AddPage();

            // Get an XGraphics object for drawing
            XGraphics gfx = XGraphics.FromPdfPage(page);

            // Create a font
            XFont font = new XFont("Verdana", 14, XFontStyle.Bold);
            XFont font2 = new XFont("Verdana", 10, XFontStyle.Regular);
            XFont font3 = new XFont("Verdana", 10, XFontStyle.Regular);

            // Draw the text
            string headingText = "Results for " + race.Name + ", " + competition.Date.ToString("dd.MM.yyyy") + " in " + competition.Location;
            gfx.DrawString(headingText, font, XBrushes.DarkMagenta, new XPoint(50, 50), XStringFormat.TopLeft);

            string pilotLine = "Pilot: " + competitor.PilotName + ", " + competitor.PilotFirstName;
            gfx.DrawString(pilotLine, font2, XBrushes.Black, new XPoint(50, 90), XStringFormat.TopLeft);

            string copilotLine = "Navigator: " + competitor.NavigatorName + ", " + competitor.NavigatorFirstName;
            gfx.DrawString(copilotLine, font2, XBrushes.Black, new XPoint(50, 110), XStringFormat.TopLeft);

            string takeoffTime = "Takeoff time: " + flight.TakeOffTime.ToString("HH.mm.ss");
            gfx.DrawString(takeoffTime, font2, XBrushes.Black, new XPoint(50, 130), XStringFormat.TopLeft);

            string startTime = "Start Time: " + flight.StartGateTime.ToString("HH.mm.ss");
            gfx.DrawString(startTime, font2, XBrushes.Black, new XPoint(50, 150), XStringFormat.TopLeft);

            string finishTime = "Finish Time: " + flight.FinishGateTime.ToString("HH.mm.ss");
            gfx.DrawString(finishTime, font2, XBrushes.Black, new XPoint(250, 150), XStringFormat.TopLeft);

            Image image = Common.drawFlight(parcours.ParentMap, parcours, flight);
            int originalHeight = image.Height;
            int originalWidth = image.Width;
            XImage xImage = XImage.FromGdiPlusImage(image);
            double ratio = (double)image.Height / (double)image.Width;
            int height = (int)Math.Ceiling((page.Width.Point - 100) * ratio);
            gfx.DrawImage(xImage, 50, 180, page.Width.Point - 100, height);

            gfx.DrawString("Penalties", font2, XBrushes.Black, 50, height + 200);
            int position = height + 220;
            int i = 0;

            foreach (Penalty penalty in flight.AutomaticPenalties)
            {
                if ((position + i * 20) <= page.Height.Point - 50)
                {
                    gfx.DrawString(penalty.PenaltyPoints.ToString(), font3, XBrushes.Gray, 60, (position + i * 20));
                    gfx.DrawString(penalty.PenaltyType.ToString() + ", " + penalty.Comment, font2, XBrushes.Gray, 120, (position + i * 20));
                    i++;
                }
                else
                {
                    page = document.AddPage();
                    gfx = XGraphics.FromPdfPage(page);
                    i = 0;
                    position = 50;
                }
            }
            return document;
        }
示例#4
0
文件: Common.cs 项目: helios57/anrl
 public TotalResult(Competitor competitor, double result)
 {
     this.Competitor = competitor;
     this.Result = result;
 }
示例#5
0
文件: Common.cs 项目: helios57/anrl
 /// <summary>
 /// Saves the specified PdfDocument to a specified Location.
 /// </summary>
 /// <param name="doc">PfdDocument to save</param>
 /// <param name="filename">Filepath (e.g. C:\flight.pdf). String must contain file Ending</param>
 public static void savePdf(Competition competition, Competitor competitor, Flight flight, Race race, Parcours parcours, string filename)
 {
     createPdf(competition, competitor, flight, race, parcours).Save(filename);
 }
示例#6
0
 public void Remove(Competitor item)
 {
     items.Remove(item);
 }
示例#7
0
 public bool Contains(Competitor item)
 {
     return items.Contains(item);
 }
示例#8
0
文件: BO.cs 项目: helios57/anrl
 public static void savePdf(Competitor competitor, CompetitorGroup group, string filename)
 {
     // ToDo: get flight
     //Common.savePdf(competitor, competitor.getFlight(group), race, group.Parcours, filename);
 }
 public CompetitorRouteAssignment(Competitor competitor, Route route, DateTime takeOffTime)
 {
     this.competitor = competitor;
     this.route = route;
 }
示例#10
0
文件: GUI.cs 项目: helios57/anrl
 private void compDatagridCompetitors_SelectionChanged(object sender, EventArgs e)
 {
     if (compDatagridCompetitors.SelectedRows.Count > 0)
     {
         currentCompetitor = (Competitor)compDatagridCompetitors.SelectedRows[0].Tag;
     }
     else
     {
         currentCompetitor = null;
     }
     compUpdateCompView();
 }
示例#11
0
文件: GUI.cs 项目: helios57/anrl
 private void compDatagridCompetitors_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         currentCompetitor = (Competitor)compDatagridCompetitors.Rows[e.RowIndex].Tag;
         compUpdateCompView();
     }
 }
示例#12
0
文件: GUI.cs 项目: helios57/anrl
 private void compCmdAddNew_Click(object sender, EventArgs e)
 {
     currentCompetitor = new Competitor();
     currentCompetitor.AcCallsign = compTxtAcCallsign.Text;
     currentCompetitor.CompetitionNumber = getNextCompetitionNumber();
     currentCompetitor.Country = compTxtCountry.Text;
     currentCompetitor.NavigatorFirstName = compTxtNavigatorFirstname.Text;
     currentCompetitor.NavigatorName = compTxtNavigatorLastname.Text;
     currentCompetitor.PilotFirstName = compTxtPilotFirstname.Text;
     currentCompetitor.PilotName = compTxtPilotLastname.Text;
     competition.CompetitorCollection.Add(currentCompetitor);
     compUpdateGrid();
 }
示例#13
0
文件: GUI.cs 项目: helios57/anrl
 void ImportCompetition_FileOk(object sender, CancelEventArgs e)
 {
     IFormatter formatter = new BinaryFormatter();
     Stream stream = new FileStream(((OpenFileDialog)sender).FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
     competition = (Competition)formatter.Deserialize(stream);
     stream.Close();
     currentCompetitor = null;
     currentMap = null;
     currentParcours = null;
     competitionUpdateBaseData();
     UpdateCompetitionMapsCmbSelectMaps();
     UpdateCompetitionParcoursCmbParcoursSelection();
     UpdateMapView();
     UpdateParcoursView();
 }
示例#14
0
文件: GUI.cs 项目: helios57/anrl
 void flightTreeViewGroupsAndCompetitors_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (e.Node.Tag.GetType() == typeof(Competitor))
     {
         flightCurrentCompetitor = e.Node.Tag as Competitor;
         flightCurrentGroup = e.Node.Parent.Tag as CompetitorGroup;
         flightCurrentRace = e.Node.Parent.Parent.Tag as Race;
         updateFlightView();
     }
 }
示例#15
0
 public void Add(Competitor item)
 {
     items.Add(item);
 }
示例#16
0
 private void dataGridCompetitors_SelectionChanged(object sender, EventArgs e)
 {
     if (dataGridCompetitors.SelectedRows.Count > 0)
     {
         currentCompetitor = (Competitor)dataGridCompetitors.SelectedRows[0].Tag;
         cmdAdd.Enabled = true;
         cmdRemove.Enabled = false;
     }
 }
示例#17
0
 private void Submit()
 {
     if (dataGridCompetitors.SelectedRows.Count > 0)
     {
         selectedCompetitor = (Competitor)dataGridCompetitors.SelectedRows[0].Tag;
         SubmitButtonClick(this, new EventArgs());
         this.Close();
     }
 }