Esempio n. 1
0
        private void buttonInsertTheBatteries_Click(object sender, EventArgs e)
        {
            if (Flashlight.GetBatteriesCount() < 3)
            {
                Flashlight.InsertBatteries();
                switch (Flashlight.GetBatteriesCount())
                {
                case 1:
                    textBoxBattery1.Text = Flashlight.GetVoltage(Flashlight.GetBatteriesCount() - 1).ToString() + " %";
                    break;

                case 2:
                    textBoxBattery2.Text = Flashlight.GetVoltage(Flashlight.GetBatteriesCount() - 1).ToString() + " %";
                    break;

                case 3:
                    textBoxBattery3.Text = Flashlight.GetVoltage(Flashlight.GetBatteriesCount() - 1).ToString() + " %";
                    break;
                }
            }
            else
            {
                MessageBox.Show("Włożono wszystkie baterie.", "Informacja");
            }
        }