private void addCourseMenu_Click(object sender, EventArgs e) { // Initialize the dialog, use all controls print scale as the default print scale. DescriptionKind allControlsDescKind; float allControlsPrintScale; controller.GetAllControlsProperties(out allControlsPrintScale, out allControlsDescKind); AddCourse addCourseDialog = new AddCourse(); addCourseDialog.HelpTopic = "CourseAddCourse.htm"; addCourseDialog.InitializePrintScales(controller.MapScale); addCourseDialog.PrintScale = allControlsPrintScale; // Display the dialog DialogResult result = addCourseDialog.ShowDialog(); // If the dialog completed successfully, then add the course. if (result == DialogResult.OK) { controller.NewCourse(addCourseDialog.CourseKind, addCourseDialog.CourseName, addCourseDialog.ControlLabelKind, addCourseDialog.ScoreColumn, addCourseDialog.SecondaryTitle, addCourseDialog.PrintScale, addCourseDialog.Climb, addCourseDialog.Length, addCourseDialog.DescKind, addCourseDialog.FirstControlOrdinal); } }
private void InitializeCoursePropertiesDialogWithCurrentValues(AddCourse addCourseDialog) { // Get the properties of the current course. CourseKind courseKind; string courseName, secondaryTitle; float printScale, climb; float? length; DescriptionKind descKind; int firstControlOrdinal; ControlLabelKind labelKind; int scoreColumn; controller.GetCurrentCourseProperties(out courseKind, out courseName, out labelKind, out scoreColumn, out secondaryTitle, out printScale, out climb, out length, out descKind, out firstControlOrdinal); // Initialize the dialog addCourseDialog.InitializePrintScales(controller.MapScale); addCourseDialog.CourseKind = courseKind; addCourseDialog.CourseName = courseName; addCourseDialog.SecondaryTitle = secondaryTitle; addCourseDialog.PrintScale = printScale; addCourseDialog.Climb = climb; addCourseDialog.Length = length; addCourseDialog.DescKind = descKind; addCourseDialog.FirstControlOrdinal = firstControlOrdinal; addCourseDialog.ControlLabelKind = labelKind; addCourseDialog.ScoreColumn = scoreColumn; }
private void propertiesMenu_Click(object sender, EventArgs e) { if (controller.CanChangeCourseProperties()) { // Initialize the dialog AddCourse addCourseDialog = new AddCourse(); InitializeCoursePropertiesDialogWithCurrentValues(addCourseDialog); addCourseDialog.SetTitle(MiscText.CoursePropertiesTitle); addCourseDialog.HelpTopic = "CourseProperties.htm"; // Display the dialog DialogResult result = addCourseDialog.ShowDialog(); // If the dialog completed successfully, then change the course. if (result == DialogResult.OK) { controller.ChangeCurrentCourseProperties(addCourseDialog.CourseKind, addCourseDialog.CourseName, addCourseDialog.ControlLabelKind, addCourseDialog.ScoreColumn, addCourseDialog.SecondaryTitle, addCourseDialog.PrintScale, addCourseDialog.Climb, addCourseDialog.Length, addCourseDialog.DescKind, addCourseDialog.FirstControlOrdinal); } } else { // Change properties of all controls. float printScale; DescriptionKind descKind; controller.GetAllControlsProperties(out printScale, out descKind); // Initialize the dialog AllControlsProperties allControlsDialog = new AllControlsProperties(); allControlsDialog.InitializePrintScales(controller.MapScale); allControlsDialog.PrintScale = printScale; allControlsDialog.DescKind = descKind; // Display the dialog DialogResult result = allControlsDialog.ShowDialog(); // If the dialog completed successfully, then change the course. if (result == DialogResult.OK) { controller.ChangeAllControlsProperties(allControlsDialog.PrintScale, allControlsDialog.DescKind); } } }
private void duplicateCourseMenu_Click(object sender, EventArgs e) { if (controller.CanDuplicateCurrentCourse()) { // Initialize the dialog AddCourse addCourseDialog = new AddCourse(); InitializeCoursePropertiesDialogWithCurrentValues(addCourseDialog); addCourseDialog.SetTitle(MiscText.DuplicateCourseTitle); addCourseDialog.HelpTopic = "CourseDuplicate.htm"; addCourseDialog.CourseName = ""; addCourseDialog.CanChangeCourseKind = false; // Display the dialog DialogResult result = addCourseDialog.ShowDialog(); // If the dialog completed successfully, then add the course. if (result == DialogResult.OK) { controller.DuplicateCurrentCourse(addCourseDialog.CourseName, addCourseDialog.ControlLabelKind, addCourseDialog.ScoreColumn, addCourseDialog.SecondaryTitle, addCourseDialog.PrintScale, addCourseDialog.Climb, addCourseDialog.Length, addCourseDialog.DescKind, addCourseDialog.FirstControlOrdinal); } } }