Exemplo n.º 1
0
        private void startButton_Click(object sender, EventArgs e)
        {
            // turn start button blue cuz it looks good
            startButton.ForeColor = System.Drawing.Color.Cyan;

            // find out which categories were selected
            List <string> checkedItemsList = new List <string>();

            for (int i = 0; i <= (genreCheckedListBox.Items.Count - 1); i++)
            {
                if (genreCheckedListBox.GetItemChecked(i))
                {
                    checkedItemsList.Add(genreCheckedListBox.Items[i].ToString());
                }
            }
            // if user did not select a category, warn them and exit.
            if (checkedItemsList.Count < 1)
            {
                MessageBox.Show("Please select a category!");

                return;
            }

            // otherwise, generate a prompt to match
            BasicTextPromptForm prompt = new BasicTextPromptForm();

            prompt.categories = checkedItemsList;
            PromptGenerator promptGenerator = new PromptGenerator(checkedItemsList);
            BasicTextPrompt newPrompt;

            if (speedModeBox.Checked)
            {
                //promptGenerator.generatePrompt(Constants.speedModeTimeLimit);
                prompt.speedModeLimit = Constants.speedModeTimeLimit;
                newPrompt             = promptGenerator.findAPrompt(checkedItemsList, Constants.speedModeTimeLimit);
            }
            else
            {
                //promptGenerator.generatePrompt(Constants.speedModeOff);
                prompt.speedModeLimit = 0;
                newPrompt             = promptGenerator.findAPrompt(checkedItemsList, 0);
            }
            if (newPrompt.ERROR == true)
            {
                Console.WriteLine("BasicTextPromptForm.generateNewPrompt() : Error - failed to make new prompt");
                MessageBox.Show("Error generating prompt. Please try again.");
                return;
            }
            //FancyTextPromptForm promptTest = new FancyTextPromptForm();
            prompt.InitializePrompt(newPrompt);
            prompt.ShowDialog();
        }
Exemplo n.º 2
0
        public void generatePrompt(int timeLimit)
        {
            // find a prompt to match
            BasicTextPrompt myPrompt = findAPrompt(categories, timeLimit);

            // if there was a problem finding a prompt, exit
            if (myPrompt.ERROR)
            {
                Console.WriteLine("startButton_Click(): myPrompt.ERROR = true");
                return;
            }
            // otherwise, set up a new prompt windows form and run it
            BasicTextPromptForm prompt = new BasicTextPromptForm();

            prompt.categories     = this.categories;
            prompt.speedModeLimit = timeLimit;
            //FancyTextPromptForm promptTest = new FancyTextPromptForm();
            prompt.InitializePrompt(myPrompt);
            prompt.ShowDialog();
        }