예제 #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            WinFormOuput winformOutput = new WinFormOuput(textBox1);

            textBox1.Clear();
            label1.Visible = false;
            //Initialize radiobutton1;
            radioButton1.Visible = false;
            //Initialize radiobutton2;
            radioButton2.Visible = false;
            //Initialize radiobutton3;
            radioButton3.Visible = false;
            //Initialize radiobutton4;
            radioButton4.Visible = false;
            //Initialize ApplyButton;
            button4.Visible = false;
            if (label1.Name == "PlaybackComponent")
            {
                SetPlaybackComponentToMobile(winformOutput);
            }
            else if (label1.Name == "ChargeComponent")
            {
                SetChargeComponentToMobile(winformOutput);
            }
        }
예제 #2
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();
        }
예제 #3
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();
        }