static void Main(string[] args) { IMobile mobile = MobileFactory.CreateMobile(BrandType.Apple); mobile.GetMobile(); Console.ReadKey(); }
private void SMSViewerForm_Load(object sender, EventArgs e) { MobileFactory factory = MobileFactory.Instance(); _output = new WindowsFormOutput(messagesListView, systemOutputTextBox); _mobile = factory.GetMobile(_model, _output); _mobile.SetChargeLevelChangedHandler(ChargeLevelChangedHandler); FormatUtils.formatOptions.ForEach(value => formatOptionsComboBox.Items.Add(value)); formatOptionsComboBox.SelectedIndex = 0; _charger = BatteryChargerFactory.Instance().GetBatteryCharger(BatteryChargerType.THREAD, 3); _charger.Start(); var chargerTypes = Enum.GetValues(typeof(BatteryChargerType)); foreach (var chargerType in chargerTypes) { chargerTypeComboBox.Items.Add(chargerType); } chargerTypeComboBox.SelectedIndex = 0; var providerTypes = Enum.GetValues(typeof(SMSProviderType)); foreach (var providerType in providerTypes) { providerTypeComboBox.Items.Add(providerType); } providerTypeComboBox.SelectedIndex = 0; }
private void MobilePhoneForm_Load(object sender, EventArgs e) { MobileFactory factory = MobileFactory.Instance(); _output = new WindowsFormOutput(mobilePhoneTextBox); _mobile = factory.GetMobile(_model, _output); _mobile.ConnectBluetoothSoundDevice(new AirPods()); _mobile.ConnectBluetoothSoundDevice(new BluetoothSpeaker()); _mobile.ConnectHeadPhones(new HeadPhones()); UpdateSoundPlayingDeviceListBox(); }
private Mobile getConfiguredMobilePhone(MobileModels model) { MobileFactory factory = MobileFactory.Instance(); Mobile mobile = factory.GetMobile(model, _output); var airPods = new AirPods(); mobile.ConnectBluetoothSoundDevice(airPods); var bluetoothSpeaker = new BluetoothSpeaker(); mobile.ConnectBluetoothSoundDevice(bluetoothSpeaker); return(mobile); }
public void TestThatBluetoothAccessoriesPrintMessageAboutConnection() { MobileFactory factory = MobileFactory.Instance(); Mobile mobile = factory.GetMobile(MobileModels.SC1102, _output); var airPods = new AirPods(); mobile.ConnectBluetoothSoundDevice(airPods); Assert.AreEqual($"Connection with {airPods.Name} has established.", _output.Output); var bluetoothSpeaker = new BluetoothSpeaker(); mobile.ConnectBluetoothSoundDevice(bluetoothSpeaker); Assert.AreEqual($"Connection with {bluetoothSpeaker.Name} has established.", _output.Output); }
static void Main(string[] args) { ProductFactory factory = null; Console.Write("Enter the product type you would like to process: "); string pro = Console.ReadLine(); Console.Write("Enter the product name you would like to process: "); string name = Console.ReadLine(); Console.WriteLine("*********************"); switch (pro.ToLower()) { case "mobile": factory = new MobileFactory(name.ToLower()); break; case "book": factory = new BookFactory(name.ToLower()); break; case "video": factory = new VideoFactory(name.ToLower()); break; case "new membership": factory = new NewMemberFactory(name.ToLower()); break; case "upgrade membership": factory = new UpgradeMemberFactory(name.ToLower()); break; default: break; } if (factory != null) { Product prod = factory.GetPayment(); Console.ReadLine(); } else { Console.WriteLine("Product need to be added to repository"); Console.ReadLine(); } }
static void Main(string[] args) { IOutput output = new ConsoleOutput(); MobileFactory factory = MobileFactory.Instance(); List <Mobile> mobiles = new List <Mobile>(3) { factory.GetMobile(MobileModels.SC1102, output), factory.GetMobile(MobileModels.SC1103, output), factory.GetMobile(MobileModels.SC1104, output) }; var simCard1 = new SimCard(MobileOperators.LIFECELL, new List <Modes> { Modes.GSM, Modes.THREEG, Modes.FOURG, Modes.LTE }, 2); var simCard2 = new SimCard(MobileOperators.VODAPHONE, new List <Modes> { Modes.GSM, Modes.THREEG }, 1); simCard1.IsEnabled = true; mobiles.ForEach(mobile => { mobile.InstallSimCard(simCard1); mobile.InstallSimCard(simCard2); } ); mobiles.ForEach(mobile => Console.WriteLine(mobile)); var mobile1 = mobiles[0]; var airPods = new AirPods(); var bluetoothSpeaker = new BluetoothSpeaker(); mobile1.ConnectBluetoothSoundDevice(airPods); mobile1.ConnectBluetoothSoundDevice(bluetoothSpeaker); mobile1.ConnectHeadPhones(new HeadPhones()); mobile1.PlayMusic(); Console.ReadKey(); mobile1.DisconnectBluetoothSoundDevice(airPods); mobile1.DisconnectBluetoothSoundDevice(bluetoothSpeaker); mobile1.PlayMusic(); Console.ReadKey(); }
public static void Main(string[] args) { var chinaScreenFactory = new ScreenFactory(); var i14 = chinaScreenFactory.CreateScreen(14, 720); var taiwanScreenfactory = new ScreenFactory(); var i15 = taiwanScreenfactory.CreateScreen(15, 1024); var japanBatteryFactory = new BatteryFactory(); var liIon = japanBatteryFactory.CreateBattery(400, "li-ion"); var koreaBatteryFactory = new BatteryFactory(); var nicd = koreaBatteryFactory.CreateBattery(500, "NiCd"); var Apple = new MobileFactory(); var iPhone = GetIPhone(Apple); var Sumsung = new MobileFactory(); var Galaxy = Sumsung.CreateMobile("Sumsung", 128, 5, 720, 500, "NiCd"); }
static void Main(string[] args) { IMobile mobile; Console.WriteLine("1. Sony"); Console.WriteLine("2. Samsung"); Console.WriteLine("3. iPhone"); Console.WriteLine("Enter Your Choice"); string ch = Console.ReadLine(); if (ch == "1") { mobile = MobileFactory.Create(Mobile.Sony, "Snapdragon 810", 4, 21.00); } else if (ch == "2") { mobile = MobileFactory.Create(Mobile.Samsung, 2, "Snapdragon 810", 12.2, "Marshmallow"); } else if (ch == "3") { mobile = MobileFactory.Create(Mobile.IPhone, 2, "IPhone", 12.2); } else { mobile = null; } if (mobile == null) { Console.WriteLine("Wrong Choice"); } else { Console.WriteLine(mobile.GetType()); } mobile = MobileFactory.Create(Mobile.Sony, "Snapdragon 810", 4, 21.00); Console.ReadKey(); }
private static void Run() { var mobileTypes = new MobileType[] { MobileType.Android, MobileType.IPhone, MobileType.WindowsPhone, MobileType.QNXPhone, MobileType.Other }; foreach (var mobileType in mobileTypes) { var mobile = MobileFactory.CreateTestMobile(mobileType); string fileName = "This is a test file name for mms."; string message = "This is a test message for sms."; mobile.SendMMS(fileName); mobile.SendSMS(message); } }
private static Mobile GetIPhone(MobileFactory Apple) { return(Apple.CreateMobile("Apple", 64, 6, 1024, 400, "liIon")); }