Ejemplo n.º 1
0
    private void AutoGenerateWordsButton_Click(object sender, EventArgs e)
    {
        TextModeComboBox.Enabled               = false;
        NumerologySystemComboBox.Enabled       = false;
        AddVerseAndWordValuesCheckBox.Enabled  = false;
        AddPositionsCheckBox.Enabled           = false;
        AddDistancesToPreviousCheckBox.Enabled = false;
        ValueCombinationDirectionLabel.Enabled = false;
        NumberTypeLabel.Enabled         = false;
        AutoGenerateWordsButton.Enabled = false;
        GenerateWordsButton.Enabled     = false;
        InspectButton.Enabled           = false;
        TextModeComboBox.Refresh();
        NumerologySystemComboBox.Refresh();
        AddVerseAndWordValuesCheckBox.Refresh();
        AddPositionsCheckBox.Refresh();
        AddDistancesToPreviousCheckBox.Refresh();
        ValueCombinationDirectionLabel.Refresh();
        NumberTypeLabel.Refresh();
        AutoGenerateWordsButton.Refresh();
        GenerateWordsButton.Refresh();
        InspectButton.Refresh();

        this.Cursor = Cursors.WaitCursor;
        try
        {
            // at the start of running
            ProgressBar.Value = 0;
            ProgressBar.Refresh();
            WordCountLabel.Text      = "0 Lines";
            WordCountLabel.ForeColor = Numbers.GetNumberTypeColor(0L);
            WordCountLabel.Refresh();

            if (m_generated_lines == null)
            {
                m_generated_lines = new List <string>();
            }
            if (m_generated_lines != null)
            {
                m_generated_lines.Clear();
            }

            if (ModifierKeys == Keys.Shift)
            {
                int loops = 0;
                foreach (string text_mode in TextModeComboBox.Items)
                {
                    TextModeComboBox.SelectedItem = text_mode;
                    TextModeComboBox.Refresh();

                    loops += NumerologySystemComboBox.Items.Count;
                }

                int i = 0;
                foreach (string text_mode in TextModeComboBox.Items)
                {
                    TextModeComboBox.SelectedItem = text_mode;
                    TextModeComboBox.Refresh();

                    foreach (string numerology_system in NumerologySystemComboBox.Items)
                    {
                        NumerologySystemComboBox.SelectedItem = numerology_system;
                        NumerologySystemComboBox.Refresh();

                        ProcessNumerologySystem();

                        // display progress
                        i++;
                        ProgressBar.Value = ((i + 1) * 100) / loops;
                        if (m_generated_lines != null)
                        {
                            WordCountLabel.Text      = m_generated_lines.Count + " Line" + (m_generated_lines.Count == 1 ? "" : "s");
                            WordCountLabel.ForeColor = Numbers.GetNumberTypeColor(m_generated_lines.Count);
                            WordCountLabel.Refresh();
                        }
                        Application.DoEvents();
                    } // foreach NumerologySystem
                }     // foreach TextMode
            }
            else
            {
                ProcessNumerologySystem();
            }

            // at the end of running
            ProgressBar.Value = 100;
            ProgressBar.Refresh();
            if (m_generated_lines != null)
            {
                WordCountLabel.Text      = m_generated_lines.Count + " Line" + (m_generated_lines.Count == 1 ? "" : "s");
                WordCountLabel.ForeColor = Numbers.GetNumberTypeColor(m_generated_lines.Count);
                WordCountLabel.Refresh();
            }
        }
        finally
        {
            TextModeComboBox.Enabled               = true;
            NumerologySystemComboBox.Enabled       = true;
            AddVerseAndWordValuesCheckBox.Enabled  = true;
            AddPositionsCheckBox.Enabled           = true;
            AddDistancesToPreviousCheckBox.Enabled = true;
            ValueCombinationDirectionLabel.Enabled = true;
            NumberTypeLabel.Enabled         = true;
            AutoGenerateWordsButton.Enabled = true;
            GenerateWordsButton.Enabled     = true;
            InspectButton.Enabled           = true;

            this.Cursor = Cursors.Default;
        }
    }
Ejemplo n.º 2
0
    private void GotoNextNumberType()
    {
        switch (m_number_type)
        {
        case NumberType.Natural:
        {
            m_number_type             = NumberType.Prime;
            NumberTypeLabel.Text      = "P";
            NumberTypeLabel.ForeColor = Numbers.GetNumberTypeColor(19L);
            ToolTip.SetToolTip(NumberTypeLabel, "allow prime combined letter values only");
        }
        break;

        case NumberType.Prime:
        {
            m_number_type             = NumberType.AdditivePrime;
            NumberTypeLabel.Text      = "AP";
            NumberTypeLabel.ForeColor = Numbers.GetNumberTypeColor(47L);
            ToolTip.SetToolTip(NumberTypeLabel, "allow additive prime combined letter values only");
        }
        break;

        case NumberType.AdditivePrime:
        {
            m_number_type             = NumberType.NonAdditivePrime;
            NumberTypeLabel.Text      = "XP";
            NumberTypeLabel.ForeColor = Numbers.GetNumberTypeColor(19L);
            ToolTip.SetToolTip(NumberTypeLabel, "allow non-additive prime combined letter values only");
        }
        break;

        case NumberType.NonAdditivePrime:
        {
            m_number_type             = NumberType.Composite;
            NumberTypeLabel.Text      = "C";
            NumberTypeLabel.ForeColor = Numbers.GetNumberTypeColor(14L);
            ToolTip.SetToolTip(NumberTypeLabel, "allow composite combined letter values only");
        }
        break;

        case NumberType.Composite:
        {
            m_number_type             = NumberType.AdditiveComposite;
            NumberTypeLabel.Text      = "AC";
            NumberTypeLabel.ForeColor = Numbers.GetNumberTypeColor(114L);
            ToolTip.SetToolTip(NumberTypeLabel, "allow additive composite combined letter values only");
        }
        break;

        case NumberType.AdditiveComposite:
        {
            m_number_type             = NumberType.NonAdditiveComposite;
            NumberTypeLabel.Text      = "XC";
            NumberTypeLabel.ForeColor = Numbers.GetNumberTypeColor(25L);
            ToolTip.SetToolTip(NumberTypeLabel, "allow non-additive composite combined letter values only");
        }
        break;

        case NumberType.NonAdditiveComposite:
        {
            m_number_type             = NumberType.Natural;
            NumberTypeLabel.Text      = "";
            NumberTypeLabel.ForeColor = Numbers.GetNumberTypeColor(0L);
            ToolTip.SetToolTip(NumberTypeLabel, "allow all combined letter values only");
        }
        break;
        }
        NumberTypeLabel.Refresh();
    }