Пример #1
0
        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();
        }
Пример #2
0
 /// <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;
             }
         }
     }
 }