Example #1
0
 private void solveToolStripMenuItem1_Click(object sender, EventArgs e)
 {
   DialogSolutionFinder dlg = new DialogSolutionFinder(new TwoPhaseAlgorithm(), this.cubeModel.Rubik, this);
   if (dlg.ShowDialog() == DialogResult.OK)
   {
     rotations.Clear();
     dlg.Algorithm.Moves.ForEach(m => rotations.Add(m));
   }
 }
Example #2
0
        private void solveToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            DialogSolutionFinder dlg = new DialogSolutionFinder(new TwoPhaseAlgorithm(), this.cubeModel.Rubik, this);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                rotations.Clear();
                dlg.Algorithm.Moves.ForEach(m => rotations.Add(m));
            }
        }
 private void solveToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     //2 onderstaande variabelen implementen IDisposable niet -> nakijken
     var rbk = this.cubeModel.Rubik;
     var tpa = new TwoPhaseAlgorithm();
     using(var dlg = new DialogSolutionFinder(tpa, rbk, this))
     {
         //var dlg = new DialogSolutionFinder(new TwoPhaseAlgorithm(), this.cubeModel.Rubik, this);
         //DialogSolutionFinder dlg = new DialogSolutionFinder(new BeginnerSolver(), this.cubeModel.Rubik, this);
         //DialogSolutionFinder dlg = new DialogSolutionFinder(new FridrichSolver(), this.cubeModel.Rubik, this);
         if (dlg.ShowDialog() != DialogResult.OK)
         {
             return;
         }
         this.rotations.Clear();
         dlg.Algorithm.Moves.ForEach(m => this.rotations.Add(m));
         GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
     }
     //dlg.Dispose();
 }
        private void solveToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            //if (currentSolver == null) { currentSolver = new TwoPhaseAlgorithm(); }
            //if (currentSolver == null) { currentSolver = new FridrichSolver.FridrichSolver(); }
            //if (currentSolver == null) { currentSolver = new BeginnerSolver.BeginnerSolver(); }
            if (currentSolver != null)
            {
                using (DialogSolutionFinder dlg = new DialogSolutionFinder(currentSolver, this.cubeModel.Rubik, this))
                {

                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        rotations.Clear();
                        dlg.Algorithm.Moves.ForEach(m => rotations.Add(m));
                    }
                }
            } else
            {
                MessageBox.Show("No solver selected");
            }
        }