private void StopCharge(object sender, EventArgs e) { IPoverUnit poverUnit = sender as IPoverUnit; if (poverUnit != null) { poverUnit.OnCharged -= StopCharge; poverUnit.StopCharging(); } }
public void Charge(IPoverUnit poverUnit) { poverUnit.OnCharged += StopCharge; poverUnit.StartCharging(); }