示例#1
0
        private static void ChargerShowInfo(SimcorpMobile phone)
        {
            var output = new ConsoleOutput();

            while (true)
            {
                try
                {
                    ChargerComponents userChoise = (ChargerComponents)Convert.ToInt32(Console.ReadLine());
                    switch (userChoise)
                    {
                    case ChargerComponents.FakeCharger:
                        phone.ChargerComponent = new FakeCharger(output);
                        break;

                    case ChargerComponents.OriginalCharger:
                        phone.ChargerComponent = new OriginalCharger(output);
                        break;

                    default:
                        Console.WriteLine("Unsupported charger");
                        continue;
                    }
                    break;
                }
                catch
                {
                    Console.WriteLine("Wrong charger component");
                }
            }

            phone.Charge(new object());
        }
示例#2
0
        static void Main(string[] args)
        {
            SimcorpMobile phone = new SimcorpMobile();

            Console.WriteLine(phone.Screen.ToString());
            Console.WriteLine(phone.GetDescription());

            PlayBackCompShow();
            PlayBackShowInfo(phone);

            ChargerCompShow();
            ChargerShowInfo(phone);

            Console.ReadLine();
        }
示例#3
0
        private static void PlayBackShowInfo(SimcorpMobile phone)
        {
            var output = new ConsoleOutput();

            while (true)
            {
                try
                {
                    PlayBackComponents userChoise = (PlayBackComponents)Convert.ToInt32(Console.ReadLine());
                    switch (userChoise)
                    {
                    case PlayBackComponents.iPhoneHeadset:
                        phone.PlaybackComponent = new iPhoneHeadset(output);
                        break;

                    case PlayBackComponents.SamsungHeadset:
                        phone.PlaybackComponent = new SamsungHeadset(output);
                        break;

                    case PlayBackComponents.UnofficaialPhoneHeadset:
                        phone.PlaybackComponent = new UnofficaialPhoneHeadset(output);
                        break;

                    case PlayBackComponents.PhoneSpeaker:
                        phone.PlaybackComponent = new PhoneSpeaker(output);
                        break;

                    default:
                        Console.WriteLine("Unsupported headphones");
                        continue;
                    }
                    break;
                }
                catch
                {
                    Console.WriteLine("Wrong playback component");
                }
            }

            phone.Play(new object());
        }