コード例 #1
0
        public void Init(AudioQueue qu, SpeechSynthesizer syn,
                         string title, string caption, Icon ic,
                         String text,             // if null, no text box or wait complete
                         bool waitcomplete, bool literal,
                         AudioQueue.Priority prio,
                         string startname, string endname,
                         string voicename,
                         string volume,
                         string rate,
                         Variables ef)        // effects can also contain other vars, it will ignore
        {
            comboBoxCustomPriority.Items.AddRange(Enum.GetNames(typeof(AudioQueue.Priority)));

            queue                  = qu;
            synth                  = syn;
            this.Text              = caption;
            Title.Text             = title;
            this.Icon              = ic;
            textBoxBorderTest.Text = "The quick brown fox jumped over the lazy dog";

            bool defaultmode = (text == null);

            if (defaultmode)
            {
                textBoxBorderText.Visible         = checkBoxCustomComplete.Visible = comboBoxCustomPriority.Visible = labelStartTrigger.Visible = labelEndTrigger.Visible =
                    checkBoxCustomLiteral.Visible = textBoxBorderStartTrigger.Visible = checkBoxCustomV.Visible = checkBoxCustomR.Visible = textBoxBorderEndTrigger.Visible = false;

                int offset = comboBoxCustomVoice.Top - textBoxBorderText.Top;
                foreach (Control c in panelOuter.Controls)
                {
                    if (!c.Name.Equals("Title"))
                    {
                        c.Location = new Point(c.Left, c.Top - offset);
                    }
                }

                this.Height -= offset;
            }
            else
            {
                textBoxBorderText.Text              = text;
                checkBoxCustomComplete.Checked      = waitcomplete;
                checkBoxCustomLiteral.Checked       = literal;
                comboBoxCustomPriority.SelectedItem = prio.ToString();
                textBoxBorderStartTrigger.Text      = startname;
                textBoxBorderEndTrigger.Text        = endname;
                buttonExtDevice.Visible             = false;
            }

            comboBoxCustomVoice.Items.Add("Default");
            comboBoxCustomVoice.Items.Add("Female");
            comboBoxCustomVoice.Items.Add("Male");
            comboBoxCustomVoice.Items.AddRange(synth.GetVoiceNames());
            if (comboBoxCustomVoice.Items.Contains(voicename))
            {
                comboBoxCustomVoice.SelectedItem = voicename;
            }
            else
            {
                comboBoxCustomVoice.SelectedIndex = 0;
            }

            int i;

            if (!defaultmode && volume.Equals("Default", StringComparison.InvariantCultureIgnoreCase))
            {
                checkBoxCustomV.Checked = false;
                trackBarVolume.Enabled  = false;
            }
            else
            {
                checkBoxCustomV.Checked = true;
                if (volume.InvariantParse(out i))
                {
                    trackBarVolume.Value = i;
                }
            }

            if (!defaultmode && rate.Equals("Default", StringComparison.InvariantCultureIgnoreCase))
            {
                checkBoxCustomR.Checked = false;
                trackBarRate.Enabled    = false;
            }
            else
            {
                checkBoxCustomR.Checked = true;
                if (rate.InvariantParse(out i))
                {
                    trackBarRate.Value = i;
                }
            }

            effects = ef;

            ExtendedControls.ThemeableFormsInstance.Instance?.ApplyToForm(this, System.Drawing.SystemFonts.DefaultFont);
        }