// Describe a control point. private static TextPart[] DescribeControlPoint(SymbolDB symbolDB, EventDB eventDB, Id <ControlPoint> controlId, DescKind descKind) { Debug.Assert(descKind == DescKind.DescPane || descKind == DescKind.Tooltip); List <TextPart> list = new List <TextPart>(); ControlPoint control = eventDB.GetControl(controlId); // Control name/code. list.Add(new TextPart(TextFormat.Title, Util.ControlPointName(eventDB, controlId, NameStyle.Long))); // Control location. if (descKind == DescKind.DescPane) { list.Add(new TextPart(TextFormat.Header, SelectionDescriptionText.Location + " ")); list.Add(new TextPart(TextFormat.SameLine, string.Format("({0:##0.0}, {1:##0.0})", control.location.X, control.location.Y))); } // Which courses is it used in? list.Add(new TextPart(TextFormat.Header, (descKind == DescKind.Tooltip ? SelectionDescriptionText.UsedIn : SelectionDescriptionText.UsedInCourses))); Id <Course>[] coursesUsingControl = QueryEvent.CoursesUsingControl(eventDB, controlId); list.Add(new TextPart(descKind == DescKind.Tooltip ? TextFormat.SameLine : TextFormat.NewLine, CourseListText(eventDB, coursesUsingControl))); // What is the competitor load? int load = QueryEvent.GetControlLoad(eventDB, controlId); int visits = QueryEvent.GetControlVisitLoad(eventDB, controlId); if (load >= 0) { list.Add(new TextPart(TextFormat.Header, (descKind == DescKind.Tooltip ? SelectionDescriptionText.Load : SelectionDescriptionText.CompetitorLoad))); if (visits != load) { list.Add(new TextPart(TextFormat.SameLine, string.Format("{0}/{1}", load, visits))); } else { list.Add(new TextPart(TextFormat.SameLine, string.Format("{0}", load))); } } // Text version of the descriptions if (descKind == DescKind.DescPane) { Textifier textifier = new Textifier(eventDB, symbolDB, QueryEvent.GetDescriptionLanguage(eventDB)); string descText = textifier.CreateTextForControl(controlId, null); list.Add(new TextPart(TextFormat.Header, SelectionDescriptionText.TextDescription)); list.Add(new TextPart(TextFormat.NewLine, descText)); } return(list.ToArray()); }
// Describe the all controls. private static TextPart[] DescribeAllControls(EventDB eventDB, CourseView activeCourseView) { List <TextPart> list = new List <TextPart>(); // Course name list.Add(new TextPart(TextFormat.Title, activeCourseView.CourseName)); // Count controls in use. list.Add(new TextPart(TextFormat.Header, SelectionDescriptionText.ControlsInUse)); list.Add(new TextPart(TextFormat.NewLine, CountControls(activeCourseView, delegate(Id <ControlPoint> controlId) { return(QueryEvent.CoursesUsingControl(eventDB, controlId).Length > 0); }))); // Count controls not in use. list.Add(new TextPart(TextFormat.Header, SelectionDescriptionText.ControlsNotInUse)); list.Add(new TextPart(TextFormat.NewLine, CountControls(activeCourseView, delegate(Id <ControlPoint> controlId) { return(QueryEvent.CoursesUsingControl(eventDB, controlId).Length == 0); }))); return(list.ToArray()); }