// Describe a course. private static TextPart[] DescribeCourse(EventDB eventDB, CourseView activeCourseView) { List <TextPart> list = new List <TextPart>(); CourseDesignator courseDesignator = activeCourseView.CourseDesignator; // Course name if (courseDesignator.AllParts) { list.Add(new TextPart(TextFormat.Title, string.Format(SelectionDescriptionText.CourseName, activeCourseView.CourseName))); } else { list.Add(new TextPart(TextFormat.Title, string.Format(SelectionDescriptionText.CourseNameAndPart, activeCourseView.CourseName, courseDesignator.Part + 1))); } if (activeCourseView.Kind == CourseView.CourseViewKind.Normal || activeCourseView.Kind == CourseView.CourseViewKind.AllVariations) { // Course length if (!courseDesignator.AllParts) { list.Add(new TextPart(TextFormat.Header, SelectionDescriptionText.Length)); list.Add(new TextPart(TextFormat.SameLine, Util.GetLengthInKm(activeCourseView.PartLength, activeCourseView.PartLength, 2))); } else { list.Add(new TextPart(TextFormat.Header, SelectionDescriptionText.Length)); list.Add(new TextPart(TextFormat.SameLine, Util.GetLengthInKm(activeCourseView.MinTotalLength, activeCourseView.MaxTotalLength, 2))); // If the user specified a length, show both that length and the calculated length. if (activeCourseView.MinTotalLength != activeCourseView.MinMeasuredLength || activeCourseView.MaxTotalLength != activeCourseView.MaxMeasuredLength) { list.Add(new TextPart(TextFormat.Header, SelectionDescriptionText.CalculatedLength)); list.Add(new TextPart(TextFormat.SameLine, Util.GetLengthInKm(activeCourseView.MinMeasuredLength, activeCourseView.MaxMeasuredLength, 2))); } } // Don't have climb for a single part of multi-part course. if (activeCourseView.TotalClimb >= 0 && courseDesignator.AllParts) { list.Add(new TextPart(TextFormat.Header, SelectionDescriptionText.Climb + " ")); list.Add(new TextPart(TextFormat.SameLine, string.Format("{0:#,###} m", Math.Round(activeCourseView.TotalClimb, MidpointRounding.AwayFromZero)))); } } else if (activeCourseView.Kind == CourseView.CourseViewKind.Score) { // Total controls list.Add(new TextPart(TextFormat.Header, SelectionDescriptionText.TotalControls + " ")); list.Add(new TextPart(TextFormat.SameLine, string.Format("{0}", activeCourseView.TotalNormalControls))); if (activeCourseView.TotalScore > 0) { list.Add(new TextPart(TextFormat.Header, SelectionDescriptionText.TotalScore + " ")); list.Add(new TextPart(TextFormat.SameLine, string.Format("{0}", activeCourseView.TotalScore))); } } // What is the competitor load? int load = QueryEvent.GetCourseLoad(eventDB, activeCourseView.BaseCourseId); if (load >= 0) { list.Add(new TextPart(TextFormat.Header, SelectionDescriptionText.CompetitorLoad)); list.Add(new TextPart(TextFormat.SameLine, string.Format("{0}", load))); } return(list.ToArray()); }