using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace bai3_tr46_dkthietbitrongnha
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button_den1_Click(object sender, EventArgs e)
        {
            if(button_den1.Text=="ON")
            {
                den1.BackColor = Color.Red;
                button_den1.Text = "OFF";
            }
            else
            {
                den1.BackColor = Color.DarkGray;
                button_den1.Text = "ON";
            }
        }

        private void button_den2_Click(object sender, EventArgs e)
        {
            if (button_den2.Text == "ON")
            {
                den2.BackColor = Color.Red;
                button_den2.Text = "OFF";
            }
            else
            {
                den2.BackColor = Color.DarkGray;
                button_den2.Text = "ON";
            }
        }

        private void button_den3_Click(object sender, EventArgs e)
        {
            if (button_den3.Text == "ON")
            {
                den3.BackColor = Color.Red;
                button_den3.Text = "OFF";
            }
            else
            {
                den3.BackColor = Color.DarkGray;
                button_den3.Text = "ON";
            }
        }

        private void button_den4_Click(object sender, EventArgs e)
        {
            if (button_den4.Text == "ON")
            {
                den4.BackColor = Color.Red;
                button_den4.Text = "OFF";
            }
            else
            {
                den4.BackColor = Color.DarkGray;
                button_den4.Text = "ON";
            }
        }

        private void button_quat1_Click(object sender, EventArgs e)
        {
            if (button_quat1.Text == "ON")
            {
                quat1.BackColor = Color.Red;
                button_quat1.Text = "OFF";
            }
            else
            {
                quat1.BackColor = Color.DarkGray;
                button_quat1.Text = "ON";
            }
        }

        private void button_quat2_Click(object sender, EventArgs e)
        {
            if (button_quat2.Text == "ON")
            {
                quat2.BackColor = Color.Red;
                button_quat2.Text = "OFF";
            }
            else
            {
                quat2.BackColor = Color.DarkGray;
                button_quat2.Text = "ON";
            }
        }

        private void button_quat3_Click(object sender, EventArgs e)
        {
            if (button_quat3.Text == "ON")
            {
                quat3.BackColor = Color.Red;
                button_quat3.Text = "OFF";
            }
            else
            {
                quat3.BackColor = Color.DarkGray;
                button_quat3.Text = "ON";
            }
        }

        private void button_quat4_Click(object sender, EventArgs e)
        {
            if (button_quat4.Text == "ON")
            {
                quat4.BackColor = Color.Red;
                button_quat4.Text = "OFF";
            }
            else
            {
                quat4.BackColor = Color.DarkGray;
                button_quat4.Text = "ON";
            }
        }

        private void button_Exit_Click(object sender, EventArgs e)
        {
            DialogResult answer = MessageBox.Show("Do you want to exit the program?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (answer == DialogResult.Yes)
            {              
                this.Close();
            }
        }
    }
}
