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;
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
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);
        }