Beispiel #1
0
    public float CheckProgress()
    {
        float progress = 0f;

        if (IsProcessing)
        {
            // Check if the worker has stopped
            if (worker.Stopped)
            {
                worker       = null;
                progress     = 1f;
                IsProcessing = false;

                // If we were waiting for it to stop, then start it back up with the new values
                if (waitForWorkerToStop)
                {
                    waitForWorkerToStop = false;
                    StartProcessing();
                }
            }
            else
            {
                progress = worker.Progress;
            }
        }

        return(progress);
    }
Beispiel #2
0
    private void StartProcessing()
    {
        possibleWords.Clear();
        possibleWordsCount.Clear();

        IsProcessing = true;

        worker = new CBWordFinderWorker();
        worker.WordDictionary  = wordDictionary;
        worker.WordsToTry      = wordsToTry;
        worker.Cells           = cells;
        worker.AddPossibleWord = AddPossibleWord;
        worker.StartRow        = startRow;
        worker.StartCol        = startCol;
        worker.IsAcross        = isAcross;
        worker.CellCount       = length;
        worker.UsedWords       = usedWords;

        new Thread(new ThreadStart(worker.Run)).Start();
    }