예제 #1
0
        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();
        }
예제 #2
0
        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();
        }