/// <summary> /// 确认 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button7_Click(object sender, EventArgs e) { textBoxEnable(false); LedShow led = new LedShow(); led.ShowLedFLStation(this.textBox2.Text + "——" + this.textBox3.Text, this.textBox1.Text, this.textBox17.Text); }
private void Form1_Load(object sender, EventArgs e) { //Console.WriteLine(configComString); asc.controllInitializeSize(this); DateViewDetails();//加载运行线路信息 this.timer1.Enabled = false; this.timer1.Interval = 1000; this.textBox15.Text = "360"; //默认最高车速 this.textBox16.Text = "0.5"; //默认加速度 this.textBox1.Text = "G59"; //默认车次 this.textBox17.Text = "11"; //默认车厢 this.textBox4.Text = "0"; this.textBox5.Text = this.dataGridView1.Rows[m - 1].Cells[3].Value.ToString(); this.textBox6.Text = this.dataGridView1.Rows[m - 1].Cells[4].Value.ToString(); this.textBox7.Text = "0"; this.textBox8.Text = "0"; this.textBox9.Text = "0"; this.textBox10.Text = "0"; this.textBox11.Text = "0"; this.textBox12.Text = this.dataGridView1.Rows[m - 1].Cells[4].Value.ToString(); this.textBox13.Text = this.dataGridView1.Rows[m - 1].Cells[3].Value.ToString(); this.textBox14.Text = this.dataGridView1.Rows[m - 1].Cells[0].Value.ToString(); dataGridView1.Rows[0].Selected = false; //dataGridView默认未选中 showStation(); //显示首末站 ComboBoxDetails(); //comboBox1绑定数据源 LedShow led = new LedShow(); led.ShowLedNULL(); }
/// <summary> /// 程序退出 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { DialogResult r = MessageBox.Show("确定要退出程序?", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (r != DialogResult.OK) { e.Cancel = true; } else { try { serialPort1.Close(); LedShow ledS = new LedShow(); ledS.ShowLedNULL(); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } } }
/// <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> public void LedSWShow() { LedShow show = new LedShow(); string text1 = "当前车速:" + v.ToString() + " km/h 外温:" + OutstrWen + " ℃"; string text2 = "Current speed: " + v.ToString() + " km/h Outside temperature: " + OutstrWen + " ℃"; show.ShowLEDMessage(text1 + " " + text2 + " ", this.textBox1.Text, this.textBox17.Text); Thread.Sleep(20000);//暂停20秒 show.ShowLEDMessage(" ", this.textBox1.Text, this.textBox17.Text); }
/// <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> /// Led 车速温度、爱护环境提示语和爱护设施提示语显示 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timer4_Tick(object sender, EventArgs e) { LedSw++; LedShow show = new LedShow(); if (L > 6.5) { if (this.dataGridView1.Rows[m - 1].Cells[0].Value.ToString() == this.textBox2.Text) { //首站 if (LedSw % 2 == 0 && LedSw >= 4 && LedSw != 6) { //车速温度 Thread tread = new Thread(LedSWShow); tread.Start(); } if (LedSw == 5) {//爱护环境 Thread tread = new Thread(LedEnviShow); tread.Start(); } if (LedSw == 6) {//爱护设施 Thread tread = new Thread(LedEqumShow); tread.Start(); } } else { //途径站 if (LedSw % 2 == 0 && LedSw != 6) { //车速温度 Thread tread = new Thread(LedSWShow); tread.Start(); } if (LedSw == 5) {//爱护环境 Thread tread = new Thread(LedEnviShow); tread.Start(); } if (LedSw == 6) {//爱护设施 Thread tread = new Thread(LedEqumShow); tread.Start(); } } } else { LedSw = 0; } }
/// <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> public void speechTuZDZ() { LedShow led = new LedShow(); Speech sp = new Speech(); string text1 = null; string text2 = null; string ent1 = "intp65"; string vcn1 = "xiaoyan"; string ent2 = "intp65"; string vcn2 = "henry"; text1 = "惠而浦冰箱洗衣机提醒您,列车已经由 " + this.dataGridView1.Rows[m - 1].Cells[0].Value.ToString() + " 开出,前方到站是我们的终点站 " + this.dataGridView1.Rows[m].Cells[0].Value.ToString(); text2 = "Whirlpool refrigerator washing machine remind you,The train has been started from " + this.dataGridView1.Rows[m - 1].Cells[1].Value.ToString() + " Station," + "The nest station is our terminus station " + this.dataGridView1.Rows[m].Cells[1].Value.ToString() + " Station."; 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(27000); // 停顿27秒 led.ShowLEDMessage(" ", this.textBox1.Text, this.textBox17.Text); }