//==================================================================================== public void SDK_ProblemMakerReal(CancellationToken ct) //Creating problems[Automatic] { try{ int mlt = MltProblem; pGNPX_Eng.Set_MethodLst_Run(); do { if (ct.IsCancellationRequested) { ct.ThrowIfCancellationRequested(); return; } LoopCC++; TLoopCC++; List <UCell> BDL = GeneratePuzzleCandidate( ); //Problem candidate generation UPuzzle P = new UPuzzle(BDL); pGNPX_Eng.SetGP(P); pGNPX_Eng.AnalyzerCounterReset(); pGNPX_Eng.sudokAnalyzerAuto(ct); if (GNPZ_Engin.retCode == 0) { #if DEBUG __ret000 = true; //########## #endif string prbMessage; int DifLevel = pGNPX_Eng.GetDifficultyLevel(out prbMessage); if (DifLevel < lvlLow || lvlHgh < DifLevel) { continue; //Difficulty check } #if DEBUG __ret001 = true; //########## #endif P.DifLevel = DifLevel; P.Name = prbMessage; P.TimeStamp = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); P.solMessage = pGNPX_Eng.DGViewMethodCounterToString(); pGNP00.SDK_ProblemListSet(P); SDKEventArgs se = new SDKEventArgs(ProgressPer: (--mlt)); Send_Progress(this, se); //(can send information in the same way as LoopCC.) if (CbxNextLSpattern) { rxCTRL = 0; //Change LS pattern at next problem generation } } }while(mlt > 0); } catch (TaskCanceledException) { WriteLine("...Canceled by user."); } catch (Exception ex) { WriteLine(ex.Message + "\r" + ex.StackTrace); } }
public void AnalyzerRealAuto(CancellationToken ct) //Analysis[solveUp] { try{ LoopCC++; TLoopCC++; bool chbConfirmMultipleCells = GNPXApp000.chbConfirmMultipleCells; pGNPX_Eng.Set_MethodLst_Run(false); pGNPX_Eng.sudokAnalyzerAuto(ct); SDKEventArgs se = new SDKEventArgs(ProgressPer: (GNPZ_Engin.retCode)); Send_Progress(this, se); } catch (TaskCanceledException) { WriteLine("...Canceled by user."); } catch (Exception ex) { WriteLine(ex.Message + "\r" + ex.StackTrace); } }
public void AnalyzerReal(CancellationToken ct) //Analysis[step] { try{ int ret2 = 0; retNZ = -1; LoopCC++; TLoopCC++; pGNPX_Eng.Set_MethodLst_Run(false); pGNPX_Eng.AnalyzerControl(ct, ref ret2, true); SDKEventArgs se = new SDKEventArgs(ProgressPer: (retNZ)); Send_Progress(this, se); } catch (TaskCanceledException) { WriteLine("...Canceled by user."); } catch (Exception ex) { WriteLine(ex.Message + "\r" + ex.StackTrace); } }
//The following two routines is launched from another thread(taskSDK). //Then can not operate windows elements. public void DigitsRecogReport(object sender, SDKEventArgs e) { try{ if (e.SDK81 == null) { return; } GNP00.SDK81 = e.SDK81; GNP00.pGP_DgtRecog.SetNo_fromIntArray(GNP00.SDK81); GNP00.GNPX_Eng.pGP = GNP00.pGP_DgtRecog; displayTimer.Start(); } catch (Exception e2) { WriteLine(e2.Message + "\r" + e2.StackTrace); } }
private void task_SDKsolver_ProgressChanged(object sender, SDKEventArgs e) { _ProgressPer = e.ProgressPer; }
//Progress display public void BWGenPrb_ProgressChanged(object sender, SDKEventArgs e) { _ProgressPer = e.ProgressPer; }