Esempio n. 1
0
        public static ISimCard GetSimCard(int simCardType)
        {
            ISimCard simcard = null;

            switch (simCardType)
            {
            case 1:
                simcard = new NanoSim(new ConsoleOutput());
                break;

            case 2:
                simcard = new MicroSim(new ConsoleOutput());
                break;

            case 3:
                simcard = new MiniSim(new ConsoleOutput());
                break;

            case 4:
                simcard = new Sim(new ConsoleOutput());
                break;

            default:
                throw new ArgumentException("Invalid SimCard type");
            }
            return(simcard);
        }
Esempio n. 2
0
 public Mobile(IScreen screen, IBattery battery, IKeyboard keyboard, IMicrophone microphone, ISpeaker speaker, ISimCard simCard)
 {
     this.Screen     = screen;
     this.Battery    = battery;
     this.Keyboard   = keyboard;
     this.Microphone = microphone;
     this.Speaker    = speaker;
     this.SimCard    = simCard;
 }
        public static ISimCard GetSimCard(SimCardTypeik simCardType, IOutput output)
        {
            string typeName = simCardType.ToString();

            typeName = "SimCorp.IMS.MobilePhoneLibrary.MobilePhoneComponents.Simcard." + typeName;
            Type     hType       = Type.GetType(typeName);
            object   SimCardItem = Activator.CreateInstance(hType, output);
            ISimCard simcard     = SimCardItem as ISimCard;

            return(simcard);
        }
Esempio n. 4
0
        public void GetAndProcessUserSelectionOfSimCard(SimCorpMobile simCorpMobile)
        {
            SimCardHandler simCardHandler = new SimCardHandler(Output);

            string enteredSimCardTypeIndex = Input.ReadLine();

            try
            {
                SimCardTypes simCardType      = simCardHandler.GetSimCardType(enteredSimCardTypeIndex);
                ISimCard     simCardComponent = simCardHandler.GetSimCard(simCardType);
                simCardHandler.SetAndConnectSimCard(simCorpMobile, simCardComponent);
            }
            catch (Exception e)
            {
                Output.Write(e.Message);
            }
        }
Esempio n. 5
0
        public ISimCard GetSimCard(SimCardTypes simCardType)
        {
            ISimCard simCard = null;

            switch (simCardType)
            {
            case SimCardTypes.KyivstarSimCard:
                simCard = new KyivstarSimCard(Output);
                Output.WriteLine($"{nameof(KyivstarSimCard)} selected");
                break;

            case SimCardTypes.LifecellSimCard:
                simCard = new LifecellSimCard(Output);
                Output.WriteLine($"{nameof(LifecellSimCard)} selected");
                break;

            case SimCardTypes.VodafoneSimCard:
                simCard = new VodafoneSimCard(Output);
                Output.WriteLine($"{nameof(VodafoneSimCard)} selected");
                break;
            }

            return(simCard);
        }
Esempio n. 6
0
 public void SetAndConnectSimCard(SimCorpMobile simCorpMobile, ISimCard simCard)
 {
     simCorpMobile.SimCard = simCard;
     simCorpMobile.ConnectToLocalMobileNetwork();
 }