/// <summary> /// This method is executed with the Add button is clicked. /// Will draw the problem and run it. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddBtn_Click(object sender, RoutedEventArgs e) { UIProblemDrawer drawer = UIProblemDrawer.getInstance(); ActualProblem problem = problems[problemsBox.SelectedValue as string]; //Create the problem description from the actual problem UIProblemDrawer.ProblemDescription desc = new UIProblemDrawer.ProblemDescription(); desc.Points = problem.parser.implied.allFigurePoints; desc.Segments = problem.segments; desc.Circles = problem.circles; //Decide if there is a region to shade ActualShadedAreaProblem saProb = problem as ActualShadedAreaProblem; if (saProb != null) { desc.Regions = saProb.goalRegions; } else { desc.Regions = null; } //Draw the problem drawer.reset(); drawer.clear(); drawer.draw(desc); //Run the problem problem.Run(); Close(); }
public static void create(DrawingHost drawingHost) { Debug.Assert(instance == null, "create() should only be called once."); instance = new ProblemDrawer(drawingHost); UIProblemDrawer.create(instance.invokeDraw, instance.invokeClear, instance.invokeReset); }