예제 #1
0
        private void Button_ListItem_Click(object sender, RoutedEventArgs e)
        {
            Button      currentButton = (Button)sender;
            PhoneClient data          = (PhoneClient)currentButton.DataContext;

            MessageBox.Show(data.Name + " tapped");
        }
예제 #2
0
        private void serialPortList_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            messageList.Items.Clear();

            try {
                ProgressShow("Opening Phone...");
                using (PhoneClient phoneClient = new PhoneClient(serialPortList.Text)) {
                    ProgressShow("Listing messages...");
                    try {
                        List <SmsDeliverMessage> messages = phoneClient.List(ListType.All);
                        foreach (SmsDeliverMessage message in messages)
                        {
                            ListViewItem item = new ListViewItem();
                            item.Text = message.DateReceived.ToString();
                            item.SubItems.Add(message.SenderAddress.PhoneNumber);
                            item.SubItems.Add(message.Text);
                            item.Tag = message;

                            messageList.Items.Add(item);
                        }
                    } catch (Exception ex) {
                        ProgressShow("Failed to list messages: " + ex.ToString());
                    }
                }
            } catch (Exception ex) {
                ProgressShow("Failed to open phone: " + ex.Message);
            }
        }
예제 #3
0
 private void ClearClient_Click(object sender, EventArgs e)
 {
     Document.Clear();
     NameClient.Clear();
     PhoneClient.Clear();
     Email.Clear();
     AddresClient.Clear();
 }
예제 #4
0
        static void Main(string[] args)
        {
            Subject      subject      = new MessageStream();
            PhoneClient  phoneClient  = new PhoneClient(subject);
            TabletClient tabletClient = new TabletClient(subject);

            phoneClient.AddMessage("Here is a new message!");
            tabletClient.AddMessage("Another new message!");
        }
예제 #5
0
 private void SaveClient_Click(object sender, EventArgs e)
 {
     CL.AgregarCliente(Document.Text, NameClient.Text, AddresClient.Text, PhoneClient.Text, Email.Text);
     Document.Clear();
     NameClient.Clear();
     AddresClient.Clear();
     PhoneClient.Clear();
     Email.Clear();
     Document.Focus();
     CL.MostrarClientes(dataGridView2);
 }
        public static void Perform()
        {
            IPhoneFactory nokiaMobilePhone = new NokiaFactory();
            PhoneClient   nokiaClient      = new PhoneClient(nokiaMobilePhone);

            Console.WriteLine("********* NOKIA **********");
            Console.WriteLine(nokiaClient.GetSmartPhoneDetails());
            Console.WriteLine(nokiaClient.GetNormalPhoneDetails());

            IPhoneFactory samsungMobilePhone = new SamsungFactory();
            PhoneClient   samsungClient      = new PhoneClient(samsungMobilePhone);

            Console.WriteLine("******* SAMSUNG **********");
            Console.WriteLine(samsungClient.GetSmartPhoneDetails());
            Console.WriteLine(samsungClient.GetNormalPhoneDetails());
        }
예제 #7
0
 private void newMessageSend_Click(object sender, EventArgs e)
 {
     try {
         ProgressShow("Opening Phone...");
         using (PhoneClient phoneClient = new PhoneClient(serialPortList.Text)) {
             ProgressShow("Sending message...");
             try {
                 phoneClient.Send(new SmsSubmitMessage(new Address(newMessageTo.Text, TypeOfAddress.International, NumberingPlan.ISDNOrPhone), newMessageText.Text));
                 ProgressShow("Message Sent!");
             } catch (Exception ex) {
                 ProgressShow("Failed to list messages: " + ex.ToString());
             }
         }
     } catch (Exception ex) {
         ProgressShow("Failed to open phone: " + ex.Message);
     }
 }
예제 #8
0
        public void NokiaFactoryPositiveTest()
        {
            IPhoneFactory nokiaFactory = new NokiaFactory();

            PhoneClient phoneClient     = new PhoneClient(nokiaFactory, "SmartPhone");
            var         phoneName       = phoneClient.GetPhoneName();
            var         cordedPhoneName = phoneClient.GetCordedPhoneName();

            PhoneClient phoneClient2     = new PhoneClient(nokiaFactory, "BasicPhone");
            var         phoneName2       = phoneClient2.GetPhoneName();
            var         cordedPhoneName2 = phoneClient2.GetCordedPhoneName();

            Assert.AreEqual("SmartPhone", phoneName);
            Assert.AreEqual("HomePhone", cordedPhoneName);
            Assert.AreEqual("BasicPhone", phoneName2);
            Assert.AreEqual("Payphone", cordedPhoneName2);
        }
예제 #9
0
        private void existingMessageDelete_Click(object sender, EventArgs e)
        {
            if (messageList.SelectedItems.Count > 0)
            {
                SmsDeliverMessage message = messageList.SelectedItems[0].Tag as SmsDeliverMessage;
                try {
                    ProgressShow("Opening Phone...");
                    using (PhoneClient phoneClient = new PhoneClient(serialPortList.Text)) {
                        phoneClient.Delete(message);
                        messageList.Items.Remove(messageList.SelectedItems[0]);
                    }
                } catch (Exception ex) {
                    ProgressShow("Failed to open phone: " + ex.Message);
                }

                // reindex messages
                serialPortList_SelectedIndexChanged(null, null);
            }
        }