static void SetPhoneJack(MobilePhoneBase mobile) { string menuTxt = GetMenuTxt(); Console.WriteLine(menuTxt); while (true) { try { int userChoice = Int32.Parse(Console.ReadLine()); IPlayback playback; var output = new ConsoleOutput(); switch (userChoice) { case 1: playback = new iPhoneHeadset(output); break; case 2: playback = new SamsungHeadset(output); break; case 3: playback = new UnofficialiPhoneHeadset(output); break; case 4: playback = new PhoneSpeaker(output); break; default: throw new ArgumentException(" Your choice is out of scope menu options"); } Console.WriteLine(" " + playback.GetType().ToString() + " playback selected"); mobile.PlaybackComponent = playback; return; } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } catch (FormatException) { Console.WriteLine(" Use digits for menu options"); } catch { throw; } } }
public SMSForm() { Mobile = new SimCorpPhone(); InitializeComponent(); MsgEndDateTime.Value = DateTime.Now + TimeSpan.FromHours(1); MessageFormatCB.Items.AddRange(GetMessageFormatCBItems()); MessageFormatCB.SelectedItem = MessageFormatCB.Items[0]; UsersComboBox.Items.Add("All"); UsersComboBox.SelectedItem = UsersComboBox.Items[0]; Mobile.MessageStorage.MessageAdded += OnSMSReceiver; Mobile.Battery.ChargeChanged += RefreshBatteryView; RefreshBatteryView(Mobile.Battery.Charge); Charger = ChargerFactory.GetCharger(Mobile.Battery, ChargerType.Task); }
static void PlaySound(MobilePhoneBase mobile) { Console.WriteLine(" Play sound in Mobile:"); mobile.Play(null); }
public SmsSender(MobilePhoneBase recipient) : this() { vRecipient = recipient; }
public Form1() { InitializeComponent(); Output = new WinFormOutput(textBox1); MobilePhone = new SimCorpPhone(); }