public void populateForm()
        {
            if (!Visited || hasBackgroundChanged())
            {
                comboSource = wm.DBManager.StoryData.getBackgroundStoryChoice(wm.Choices.BackgroundChoice.Name);
                backgroundComboBox.BeginUpdate();
                backgroundComboBox.DataSource = null;
                backgroundComboBox.DataSource = comboSource.Options;
                backgroundComboBox.EndUpdate();

                backgroundBox.Text = comboSource.Name;
                introLabel.Text    = comboSource.Description;
            }

            if (Visited && !hasBackgroundChanged())
            {
                if (backgroundComboBox.Items.Contains(wm.Choices.BackgroundChoice.StoryChoice.getSelectedOption()))
                {
                    backgroundComboBox.SelectedItem = wm.Choices.BackgroundChoice.StoryChoice.getSelectedOption();
                }
            }

            lastBackground = wm.Choices.BackgroundChoice.Name;
            Visited        = true;
        }
        /// <summary>
        /// gets the story choice for a given background
        /// </summary>
        /// <param name="background">chosen background</param>
        public BackgroundStoryChoice getBackgroundStoryChoice(string background)
        {
            BackgroundStoryChoice storyChoice = new BackgroundStoryChoice();

            using (SQLiteConnection connection = new SQLiteConnection(ConnectionString))
                using (SQLiteCommand command = new SQLiteCommand(connection))
                {
                    connection.Open();
                    command.CommandText = "SELECT extraBackgroundChoices.title, extraBackgroundChoices.description, extraBackgroundChoiceOptions.text " +
                                          "FROM extraBackgroundChoices " +
                                          "INNER JOIN backgrounds ON extraBackgroundChoices.backgroundId=backgrounds.backgroundId " +
                                          "INNER JOIN extraBackgroundChoiceOptions ON extraBackgroundChoiceOptions.extraChoiceId=extraBackgroundChoices.extraChoiceId " +
                                          "WHERE backgrounds.name=@Background " +
                                          "ORDER BY extraBackgroundChoiceOptions.diceValue ASC";
                    command.Parameters.AddWithValue("@Background", background);

                    using (SQLiteDataReader dbReader = command.ExecuteReader())
                    {
                        while (dbReader.Read())
                        {
                            if (!dbReader.IsDBNull(0))
                            {
                                if (string.IsNullOrEmpty(storyChoice.Name))
                                {
                                    storyChoice = new BackgroundStoryChoice(dbReader.GetString(0), dbReader.GetString(1));
                                }
                                storyChoice.addOption(dbReader.GetString(2));
                            }
                        }
                    }
                }

            return(storyChoice);
        }
        public BackgroundStoryControl(WizardManager inputWizardManager)
        {
            wm      = inputWizardManager;
            Visited = false;

            lastBackground = "";

            comboSource = new BackgroundStoryChoice();

            InitializeComponent();
        }