Exemplo n.º 1
0
    public float CheckProgress()
    {
        float progress = 0f;

        if (IsProcessing)
        {
            // Check if the worker has stopped
            if (worker.Stopped)
            {
                // Get the completed board from the worker
                CompletedBoard = worker.CompletedBoard;

                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);
    }
Exemplo n.º 2
0
    public List <List <bool> > GenerateRandomBlocks(CBWordDict wordDictionary, int boardSize, int maxNeighbourCount, bool noSquares)
    {
        CBAutoFillerWorker tempWorker = new CBAutoFillerWorker();

        tempWorker.WordDictionary = wordDictionary;
        tempWorker.BoardSize      = boardSize;

        // This method completes really fast so theres no need to run it in a seperate thread
        return(tempWorker.GenerateRandomBlocks(maxNeighbourCount, noSquares));
    }
Exemplo n.º 3
0
    private void StartProcessing()
    {
        worker = new CBAutoFillerWorker();
        worker.WordDictionary = wordDictionary;
        worker.BoardSize      = boardSize;
        worker.Blocks         = blocks;

        Cancelled      = false;
        IsProcessing   = true;
        CompletedBoard = "";

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