/// <summary> /// 终点站语音播报 /// </summary> public void speechDaoZDZ() { LedShow led = new LedShow(); Speech sp = new Speech(); SpeechOperat spo = new SpeechOperat(); string text1 = null; string text2 = null; string ent1 = "intp65"; string vcn1 = "xiaoyan"; string ent2 = "intp65"; string vcn2 = "henry"; List <SpeechModel> listYu = new List <SpeechModel>(); listYu = spo.SelectSp("终点站提示语"); for (int i = 0; i < listYu.Count; i++) { text1 = listYu[i].speechContent; text2 = listYu[i].speechEnContent; } text1 = "惠而浦冰箱洗衣机提醒您,列车已经安全抵达我们的终点站 " + textBox14.Text + "," + text1; text2 = "Whirlpool refrigerator washing machine remind you,The train has arrived safely at our terminal " + this.dataGridView1.Rows[m].Cells[1].Value.ToString() + " station," + text2; led.ShowLEDMessage(text1 + " " + text2 + " ", this.textBox1.Text, this.textBox17.Text); sp.SpeechTest(text1, ent1, vcn1); Thread.Sleep(2000); // 停顿2秒 sp.SpeechTest(text2, ent2, vcn2); Thread.Sleep(35000); // 停顿35秒 led.ShowLedFLStation(this.textBox2.Text + "——" + this.textBox3.Text, this.textBox1.Text, this.textBox17.Text); }
/// <summary> /// 预到站语音播报 /// </summary> public void speechYu() { LedShow led = new LedShow(); Speech sp = new Speech(); SpeechOperat spo = new SpeechOperat(); string text1 = null; string text2 = null; string ent1 = "intp65"; string vcn1 = "xiaoyan"; string ent2 = "intp65"; string vcn2 = "henry"; List <SpeechModel> listYu = new List <SpeechModel>(); listYu = spo.SelectSp("预到站提示语"); for (int i = 0; i < listYu.Count; i++) { text1 = listYu[i].speechContent; text2 = listYu[i].speechEnContent; } text1 = "惠而浦冰箱洗衣机提醒您,列车即将到达 " + textBox14.Text + "," + text1; text2 = "Whirlpool refrigerator washing machine remind you,The train is about to arrive " + this.dataGridView1.Rows[m].Cells[1].Value.ToString() + " Station," + text2; led.ShowLEDMessage(text1 + " " + text2 + " ", this.textBox1.Text, this.textBox17.Text); sp.SpeechTest(text1, ent1, vcn1); Thread.Sleep(4000); // 停顿4秒 sp.SpeechTest(text2, ent2, vcn2); Thread.Sleep(48000); // 停顿48秒 led.ShowLedFLStation(" ", this.textBox1.Text, this.textBox17.Text); }
/// <summary> /// 添加语音播报内容 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { string type = comboBox1.Text; string content = textBox1.Text; string Encontent = textBox2.Text; SpeechOperat Spo = new SpeechOperat(); Spo.InsertSpeech(type, content, Encontent); }
public void InsertSpeech(string type, string content, string Encontent) { SqlConnection con = SqlConnect.getConn(); SpeechOperat spo = new SpeechOperat(); List <SpeechModel> list = new List <SpeechModel>(); list = spo.SelectSp(type); if (list.Count == 0) { try { String selectSpStr = "insert into Speech (SpeechType,SpeechContent,SpeechEnContent) values (@TYPE,@CONTENT,@ENCONTENT)"; SqlCommand command = con.CreateCommand();// 绑定SqlConnection对象 command.CommandText = selectSpStr; con.Open(); command.Parameters.AddWithValue("@TYPE", type); command.Parameters.AddWithValue("@CONTENT", content); command.Parameters.AddWithValue("@ENCONTENT", Encontent); command.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine("添加语音失败"); } finally { con.Close(); } } else { try { String selectSpStr = "update Speech set SpeechContent = @CONTENT,SpeechEnContent = @ENCONTENT where SpeechType = @TYPE"; SqlCommand command = con.CreateCommand();// 绑定SqlConnection对象 command.CommandText = selectSpStr; con.Open(); command.Parameters.AddWithValue("@TYPE", type); command.Parameters.AddWithValue("@CONTENT", content); command.Parameters.AddWithValue("@ENCONTENT", Encontent); command.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine("修改语音失败"); } finally { con.Close(); } } }
/// <summary> /// 发车语音播报 /// </summary> public void SpeechFa() { LedShow led = new LedShow(); string text1 = null; string text2 = null; string[] str1, str2; string ent1 = "intp65"; string vcn1 = "xiaoyan"; string ent2 = "intp65"; string vcn2 = "henry"; SelectStation sel = new SelectStation(); SpeechOperat spo = new SpeechOperat(); List <Common> listCom = new List <Common>(); List <SpeechModel> listSpFa = new List <SpeechModel>(); List <SpeechModel> listSpJin = new List <SpeechModel>(); Speech sp = new Speech(); str1 = sel.SelectFirstStation().Split(','); str2 = sel.SelectLastStation().Split(','); listCom = sel.SelectComboBoxStation(); text1 = ",惠而浦冰箱洗衣机提醒您,列车已经由 " + this.dataGridView1.Rows[m - 1].Cells[0].Value.ToString() + " 开出,前方到站 " + this.dataGridView1.Rows[m].Cells[0].Value.ToString(); text2 = "Whirlpool refrigerator and washing machine remind you,The train has been started from " + this.dataGridView1.Rows[m - 1].Cells[1].Value.ToString() + " Station " + "and next station is " + this.dataGridView1.Rows[m].Cells[1].Value.ToString() + " Station"; text1 = text1 + ",本次列车为 " + this.textBox1.Text + " 次列车,由 " + this.textBox2.Text + " 发往 " + this.textBox3.Text + ",途径"; text2 = text2 + ",This train is " + this.textBox1.Text + " train,and is sent from " + str1[1] + " Station to " + str2[1] + " Station,channel "; for (int i = 1; i < listCom.Count - 1; i++) { text1 = text1 + listCom[i].StationName + "、"; text2 = text2 + listCom[i].StationEnName + " Station,"; } listSpFa = spo.SelectSp("欢迎提示语"); listSpJin = spo.SelectSp("禁烟提示语"); for (int i = 0; i < listSpFa.Count; i++) { text1 = listSpFa[i].speechContent + text1; text2 = listSpFa[i].speechEnContent + text2; } for (int i = 0; i < listSpJin.Count; i++) { text1 = text1 + listSpJin[i].speechContent; text2 = text2 + listSpJin[i].speechEnContent; } led.ShowLEDMessage(text1 + " " + text2 + " ", this.textBox1.Text, this.textBox17.Text); sp.SpeechTest(text1, ent1, vcn1); sp.SpeechTest(text2, ent2, vcn2); int RowNum = this.dataGridView1.Rows.Count; Thread.Sleep(102000 + (RowNum - 13) * 2 * 1000); // 停顿秒数 LedSWShow(); }
/// <summary> /// 爱护设施提示语显示 /// </summary> public void LedEqumShow() { LedShow show = new LedShow(); SpeechOperat spo = new SpeechOperat(); List <SpeechModel> ListEnvi = new List <SpeechModel>(); List <SpeechModel> ListEqum = new List <SpeechModel>(); string text = null; ListEqum = spo.SelectSp("爱护设施提示语"); for (int i = 0; i < ListEqum.Count; i++) { text = ListEqum[i].speechContent; text = text + " " + ListEqum[i].speechEnContent; } show.ShowLEDMessage(text + " ", this.textBox1.Text, this.textBox17.Text); Thread.Sleep(35000);//暂停35秒 show.ShowLEDMessage(" ", this.textBox1.Text, this.textBox17.Text); }
/// <summary> /// 获取语音播报内容 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ComboBox_TextUpdate(object sender, EventArgs e) { string CombValue = comboBox1.Text; SpeechOperat SO = new SpeechOperat(); List <SpeechModel> list = new List <SpeechModel>(); list = SO.SelectSp(CombValue); if (list.Count == 0) { textBox1.Text = ""; textBox2.Text = ""; } else { for (int i = 0; i < list.Count; i++) { textBox1.Text = list[i].speechContent; textBox2.Text = list[i].speechEnContent; } } }