Esempio n. 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (txtContent.Text == "")
     {
         MessageBox.Show("不想跟友人說點什麼嗎?", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     else
     {
         if (comboBox1.SelectedIndex == 0)//與中國人對話
         {
             if (CheckChinese(txtContent.Text))
             {
                 ISelectLanguage Interface1 = new C_SpeakChinese();
                 Interface1.Speak(txtContent.Text);
             }
             else
             {
                 MessageBox.Show("請和中國友人說漢語?", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
         }
         else//與美國人對話
         {
             if (CheckChinese(txtContent.Text))
             {
                 MessageBox.Show("請和美國友人說英語?", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
             else
             {
                 ISelectLanguage Interface1 = new C_SpeakEnglish();
                 Interface1.Speak(txtContent.Text);
             }
         }
     }
 }
Esempio n. 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (txtContent.Text == "")
     {
         MessageBox.Show("不想跟友人说点什么吗?", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     else
     {
         if (comboBox1.SelectedIndex == 0)//与中国人对话
         {
             if (CheckChinese(txtContent.Text))
             {
                 ISelectLanguage Interface1 = new C_SpeakChinese();
                 Interface1.Speak(txtContent.Text);
             }
             else
             {
                 MessageBox.Show("请和中国友人说汉语?", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
         }
         else//与美国人对话
         {
             if (CheckChinese(txtContent.Text))
             {
                 MessageBox.Show("请和美国友人说英语?", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
             else
             {
                 ISelectLanguage Interface1 = new C_SpeakEnglish();
                 Interface1.Speak(txtContent.Text);
             }
         }
     }
 }