示例#1
0
 /// <summary>
 /// Give the window critical data and then display the window.
 /// Call this method instead of the inherited Show().
 /// </summary>
 /// <param name="parser">A Drawing Parser initialized with the current drawing. (This method will call Parse)</param>
 /// <param name="currentGivens">A list of all the current givens.</param>
 public void Show(DrawingParserMain parser, List <GroundedClause> currentGivens)
 {
     this.parser        = parser;
     this.currentGivens = currentGivens;
     parser.Parse();
     OnShow();
     Show();
 }
示例#2
0
        void StartRegionShading()
        {
            if (!ShadingMode)
            {
                UpdateShadingMode(true);

                //Parse and set atoms
                DrawingParserMain parser = new DrawingParserMain(drawingHost.CurrentDrawing);
                parser.Parse();
                DynamicGeometry.UI.RegionShading.ShadedRegionCreator.Atoms = parser.backendParser.GetAtomicRegions();
            }
        }
示例#3
0
 /// <summary>
 /// Executed when the parse button is clicked.
 /// Runs the background parse thread.
 /// </summary>
 void ParseToAst()
 {
     if (!parseWorker.IsBusy)
     {
         parser = new DrawingParserMain(drawingHost.CurrentDrawing);
         //Do parse and back-end computation on background worker
         parseWorker.RunWorkerAsync();
     }
     else
     {
         UIDebugPublisher.publishString("Process Busy: Please wait for completion before starting a new parse.");
     }
 }
示例#4
0
        /// <summary>
        /// This event executes when the check solution button is clicked.
        /// Will perform a solution check and update the checkbox.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CheckSolutionBtn_Click(object sender, RoutedEventArgs e)
        {
            bool correctSolution = false;

            if (currentJust.Count > 0 && currentSolution.Values.Count > 0)
            {
                //System.Diagnostics.Debug.Assert(problem != null && wrapper != null);

                List <GroundedClause> solutions = new List <GroundedClause>(currentSolution.Values);
                List <JustificationSwitch.DeductionJustType> justifications = new List <JustificationSwitch.DeductionJustType>();
                currentJust.ForEach <String>(justStr => justifications.Add(justWindow[justStr]));

                var parser = new DrawingParserMain(drawingHost.CurrentDrawing);
                parser.Parse();


                //TODO: Perform checks here. Update the correctSolution variable to true if all checks pass.
                //Use solutions and justifications lists

                /* List<GroundedClause> passed = new List<GroundedClause>();
                 * GroundedClause hint = null;
                 * foreach (GroundedClause step in solutions)
                 * {
                 *   if (wrapper.QueryNodeInGraph(step))
                 *   {
                 *       passed.Add(step);
                 *   }
                 *   else
                 *   {
                 *       hint = wrapper.QueryHint(problem, passed);
                 *       break;
                 *   }
                 * }*/
            }

            //Provide feedback
            if (correctSolution)
            {
                checkSolutionResult.Text = "Correct!";
            }
            else
            {
                checkSolutionResult.Text = "Stuck?\nAsk for a hint.";
            }
        }