Ejemplo n.º 1
0
        private void btFind_Click(object sender, EventArgs e)
        {
            //this.pbLoad.Focus();
            if (this.tbWord.Text != "" && this.tbWord.Text.IndexOf(" ") == -1)
            {
                this.tbLink.Text = "https://iapi.glosbe.com/en/vi/" + this.tbWord.Text;
            }
            WebActivity wa = new WebActivity();

            rtbSource.Text = wa.getSource(this.tbLink.Text);
            if (rtbSource.Text == "")
            {
                rtbSource.ForeColor = Color.Red;
                rtbSource.Font      = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                rtbSource.Text      = "Error";
                return;
            }
            int    k  = rtbSource.Text.IndexOf("data-url-mp3");
            string h1 = rtbSource.Text;

            if (h1.Length > 20)
            {
                h1 = h1.Substring(k + 14, h1.Length - k - 14);
                tbAudioLink.Text = "https://iapi.glosbe.com/" + h1.Substring(0, h1.IndexOf('\"'));
            }
            string h = rtbSource.Text;

            k = h.IndexOf("IPA");
            h = h.Substring(k + 18);
            int    num = h.IndexOf(',');
            string u;

            if (num == -1 || num > 50)
            {
                u = h.Substring(0, h.IndexOf(';'));
            }
            else
            {
                u = h.Substring(0, h.IndexOf(','));
            }
            if (u.IndexOf('>') != -1)
            {
                return;
            }
            tbPronunciation.Text += u + "\n";
            rtbSource.Text        = h;
        }
Ejemplo n.º 2
0
        private void btGetAudio_Click(object sender, EventArgs e)
        {
            WebActivity wa = new WebActivity();

            wa.getAudio(tbAudioLink.Text, pgbGetAudio);
        }