// Describe a leg. private static TextPart[] DescribeLeg(EventDB eventDB, Id <CourseControl> courseControlId1, Id <CourseControl> courseControlId2, DescKind descKind) { Debug.Assert(descKind == DescKind.Tooltip || descKind == DescKind.DescPane); Id <ControlPoint> controlId1 = eventDB.GetCourseControl(courseControlId1).control; Id <ControlPoint> controlId2 = eventDB.GetCourseControl(courseControlId2).control; Id <Leg> legId = QueryEvent.FindLeg(eventDB, controlId1, controlId2); List <TextPart> list = new List <TextPart>(); // Course name list.Add(new TextPart(TextFormat.Title, string.Format("{0} \u2013 {1}", Util.ControlPointName(eventDB, controlId1, NameStyle.Long), Util.ControlPointName(eventDB, controlId2, NameStyle.Long)))); // Course length list.Add(new TextPart(TextFormat.Header, SelectionDescriptionText.Length)); list.Add(new TextPart(TextFormat.SameLine, string.Format("{0:#,###} m", QueryEvent.ComputeLegLength(eventDB, controlId1, controlId2, legId)))); // Which courses list.Add(new TextPart(TextFormat.Header, (descKind == DescKind.Tooltip ? SelectionDescriptionText.UsedIn : SelectionDescriptionText.UsedInCourses))); Id <Course>[] coursesUsingControl = QueryEvent.CoursesUsingLeg(eventDB, controlId1, controlId2); list.Add(new TextPart(descKind == DescKind.Tooltip ? TextFormat.SameLine : TextFormat.NewLine, CourseListText(eventDB, coursesUsingControl))); // What is the competitor load? int load = QueryEvent.GetLegLoad(eventDB, controlId1, controlId2); if (load >= 0) { list.Add(new TextPart(TextFormat.Header, (descKind == DescKind.Tooltip ? SelectionDescriptionText.Load : SelectionDescriptionText.CompetitorLoad))); list.Add(new TextPart(TextFormat.SameLine, string.Format("{0}", load))); } if (descKind == DescKind.DescPane) { // Flagging list.Add(new TextPart(TextFormat.Header, SelectionDescriptionText.Flagging + " ")); list.Add(new TextPart(TextFormat.SameLine, FlaggingType(eventDB, controlId1, controlId2, legId))); } return(list.ToArray()); }