private void SetCharger(ICharger charger)
 {
     Output.WriteLine($"{charger.GetType().Name} charger selected");
     Output.WriteLine("Set charger to mobile...");
     Mobile.ChargingComponent = charger;
     Output.WriteLine("Charging mobile:");
     Mobile.Charge();
     Output.WriteLine("");
 }
Esempio n. 2
0
 private void ChooseChargerButton_Click(object sender, EventArgs e)
 {
     if (Charger == null)
     {
         MessageBox.Show("Please choose one of the option", "Info", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     else
     {
         ChargeTextBox.Text = $"{Charger.GetType().Name} selected\r\n";
         Charger.Charge();
     }
 }
        private void buttonChargerUnplug_Click(object sender, System.EventArgs e)
        {
            ICharger unpluggedCharger = mobile.Charger;

            mobile.Charge(null);
            if (unpluggedCharger != null)
            {
                output.WriteLine($"{unpluggedCharger.GetType().Name} unplugged.");
            }

            UpdateOutputEnabled();
        }