Ejemplo n.º 1
0
        private static void Main()
        {
            Mobile mobile = new SimCorpMobile();

            mobile.Output = new ConsoleOutput();

            mobile.Output.WriteLine(mobile.ToString());

            mobile.SelectPlaybackComponent();
            mobile.Play(new object());
            mobile.SelectChargeComponent();
            mobile.Charge();

            Console.ReadKey();
        }
Ejemplo n.º 2
0
 private void ChargeButton_Click(object sender, EventArgs e)
 {
     bCharge    = !bCharge;
     bDischarge = !bDischarge;
     if (bCharge)
     {
         ChargeButton.Text = "Stop charging";
         BatteryChargeTask = new Task(() => {
             while (bCharge)
             {
                 simCorp.Charge(30);
                 BatteryChargeTask.Wait(1000);
             }
         });
         BatteryChargeTask.Start();
     }
     else
     {
         ChargeButton.Text    = "Charge";
         BatteryDischargeTask = new Task(() => { Discharge(); });
         BatteryDischargeTask.Start();
     }
 }