private void SetChargeComponentToMobile(WinFormOuput winformOutput) { ICharge chargeComponent = null; if (radioButton1.Checked) { chargeComponent = new iPhoneCharger(winformOutput); } else if (radioButton2.Checked) { chargeComponent = new SamsungCharger(winformOutput); } else if (radioButton3.Checked) { chargeComponent = new UnofficialiPhoneCharger(winformOutput); } mobile.ChargerComponent = chargeComponent; winformOutput.WriteLine("Set charger to Mobile..."); mobile.Charge(); }
private void SetPlaybackComponentToMobile(WinFormOuput winformOutput) { IPlayback playbackComponent = null; if (radioButton1.Checked) { playbackComponent = new iPhoneHeadset(winformOutput); } else if (radioButton2.Checked) { playbackComponent = new SamsungHeadset(winformOutput); } else if (radioButton3.Checked) { playbackComponent = new UnofficialiPhoneHeadset(winformOutput); } else if (radioButton4.Checked) { playbackComponent = new PhoneSpeaker(winformOutput); } mobile.PlaybackComponent = playbackComponent; winformOutput.WriteLine("Set playback to Mobile..."); mobile.Play(); }