Exemple #1
0
        private void mnu_Add_Click(object sender, EventArgs e)
        {
            FrmLEDDetail frm = new FrmLEDDetail();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                OutDoorLed led = new OutDoorLed()
                {
                    Commport        = frm.Commport,
                    Baud            = frm.BaudRate,
                    CarLedAddress   = frm.CarAddress,
                    MotorLedAddress = frm.MotorAddress,
                    Brightness      = frm.Brightness,
                };
                int row = ledGrid.Rows.Add();
                ShowLedOnRow(ledGrid.Rows[row], led);
            }
        }
Exemple #2
0
 private void mnu_Update_Click(object sender, EventArgs e)
 {
     if (ledGrid.SelectedRows.Count == 1)
     {
         OutDoorLed   led = ledGrid.SelectedRows[0].Tag as OutDoorLed;
         FrmLEDDetail frm = new FrmLEDDetail();
         frm.Commport     = led.Commport;
         frm.BaudRate     = led.Baud;
         frm.CarAddress   = led.CarLedAddress;
         frm.MotorAddress = led.MotorLedAddress;
         frm.Brightness   = led.Brightness;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             led.Commport        = frm.Commport;
             led.Baud            = frm.BaudRate;
             led.CarLedAddress   = frm.CarAddress;
             led.MotorLedAddress = frm.MotorAddress;
             led.Brightness      = frm.Brightness;
             ShowLedOnRow(ledGrid.SelectedRows[0], led);
         }
     }
 }